id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8026484 | <reponame>irom-lab/AMR-Policies<gh_stars>1-10
import Robot
from Networks import *
import Environment
import warnings
import numpy as np
import Train
import Task
import torch as pt
# Learning Parameters **************************************************************************************************
num_epochs = 300
... | StarcoderdataPython |
9741786 | <reponame>xplorfin/prototype
# Copyright (c) 2020 <NAME>
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php
from moneysocket.nexus.rendezvous.outgoing import OutgoingRendezvousNexus
from moneysocket.layer.layer import Layer
class Ou... | StarcoderdataPython |
3334516 | import decimal
satoshi_to_btc = decimal.Decimal(1e8)
btc_to_satoshi = 1 / satoshi_to_btc
def convert_to_satoshis(btc):
""" Converts an amount in BTC to satoshis.
This function takes care of rounding and quantization issues
(i.e. IEEE-754 precision/representation) and guarantees the
correct BTC valu... | StarcoderdataPython |
11329791 | <reponame>uperetz/AstroTools<gh_stars>0
import re
from numpy import array, finfo
class Fitter(object):
from ._plotdefs import CHANNEL,ENERGY,WAVE
def __init__(self, data = None, resp = None, noinit = False, text = None):
self.axisz = None
self.dataz = None
self.ptype = self.... | StarcoderdataPython |
1788707 | # DESCRIPTION: Tests the performance of the engine.
# 4920646f6e5c2774206361726520696620697420776f726b73206f6e20796f7572206d61636869
# 6e652120576520617265206e6f74207368697070696e6720796f7572206d616368696e6521
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import time, unittest
from l... | StarcoderdataPython |
3298030 | <reponame>eggarcia28/itp-u4-c2-hangman-game
from .exceptions import *
from random import choice
# Complete with your own, just for fun :)
LIST_OF_WORDS = ['python', 'javascript', 'linux', 'computer', 'programming', 'windows' ]
def _get_random_word(list_of_words):
if list_of_words:
return choice(list_of_w... | StarcoderdataPython |
3469668 | <filename>application/sample/views.py
# -*- coding: utf-8 -*-
################################################################################
# _____ _ _____ _ #
# / ____(_) / ____| | | #
# | | ... | StarcoderdataPython |
4853789 | #!/usr/bin/env python3.8
# Copyright 2022 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import json
import urllib.parse
def generate_omaha_client_config(configs):
packages = []
for config in con... | StarcoderdataPython |
9650828 | <filename>helper/auth.py<gh_stars>1-10
from passlib.context import CryptContext
class AuthHandler():
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
def get_password_hash(self, password):
return self.pwd_context.hash(password)
def verify_password(self, plain_password, hashed... | StarcoderdataPython |
5033026 | <filename>home/hairygael/GESTURES/brooke3.py
def brooke3():
i01.attach()
fullspeed()
gestureforlondon4()
sleep(2)
i01.detach()
sleep(30)
brooke4() | StarcoderdataPython |
4892261 | <filename>setup.py<gh_stars>1-10
from setuptools import setup, find_packages
# read the contents of the README file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'Readme.rst'), encoding='utf-8') as f:
long_description = f.read()
requires = [
"aio... | StarcoderdataPython |
339970 | """
Copyright (c) 2019 <NAME>
For suggestions and questions:
<<EMAIL>>
This file is distributed under the terms of the same license,
as the Kivy framework.
"""
def crop_image(cutting_size, path_to_image, path_to_save_crop_image,
corner=0, blur=0, corner_mode='all'):
"""Call functions of cropping... | StarcoderdataPython |
4875088 | <reponame>loonydev/smartt
# -*- coding: utf-8 -*-
from __future__ import print_function
import sqlite3
import pyxhook
import time
import pyperclip
import requests
from lxml import html
import time
def create_db_file(db_name):
con = sqlite3.connect(db_name,check_same_thread=False)
cur = con.cursor()
return con,cur... | StarcoderdataPython |
4911629 | <reponame>Ehsan-Tavan/twitter_crawlers
import os
from data_loader import load_data
from configuration import get_config
from crawler import CrawlKeyWords, CrawlUserTweets, load_saved_users
from utils import extract_key_words, filter_tweets, save_tweets
ARGS = get_config()
def main():
data = load_data(os.path.joi... | StarcoderdataPython |
6650292 | import onnx
import numpy
from .base_operator import QuantOperatorBase
from ..quant_utils import attribute_to_kwarg, ms_domain, QuantType
from onnx import onnx_pb as onnx_proto
'''
Quantize LSTM
'''
class LSTMQuant(QuantOperatorBase):
def __init__(self, onnx_quantizer, onnx_node):
super().__init__(onnx... | StarcoderdataPython |
3392539 | """Defines helper functions for use throughout the application.
Copyright 2020 <NAME>, The Paperless Permission Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/li... | StarcoderdataPython |
3207529 | #Package configuration information
import os.path
import sys
import re
import importlib
import tempfile
import logging
logger = logging.getLogger("QGL")
# Where to store AWG data
if os.getenv('AWG_DIR'):
AWGDir = os.getenv('AWG_DIR')
else:
logger.warning("AWG_DIR environment variable not defined. Unless othe... | StarcoderdataPython |
4864316 | """
LeetCode Problem: 59. Spiral Matrix II
Link: https://leetcode.com/problems/spiral-matrix-ii/
Language: Python
Written by: <NAME>
Time Complexity: O(n^2)
Space Complexity: O(n^2)
"""
class Solution:
def generateMatrix(self, n: int) -> List[List[int]]:
if n == 1:
return [[1]]
... | StarcoderdataPython |
4930997 | <filename>modules/SenseHatDisplay/test/UnitTests.py
import unittest
import json
import sys
sys.path.insert(0, '../')
import app.MessageParser
class UnitTests(unittest.TestCase):
def test_HighestProbabilityTagMeetingThreshold(self):
MessageParser = app.MessageParser.MessageParser()
message1 = json.l... | StarcoderdataPython |
3463699 | <reponame>pmbrull/OpenMetaWrapper
"""OpenMetadata Catalogue API Wrapper"""
__version__ = "0.0.1"
| StarcoderdataPython |
1808129 | from flask import *
from datetime import datetime
import config
from app import db, utils
from .model import User
from ..changelog.model import ChangeLog
from ..transaction.model import Transaction
from ..trade.model import Trade
import re
from flask_cors import CORS
mod_user = Blueprint('user', __name__)
CORS(mod_u... | StarcoderdataPython |
35749 | <filename>finitewave/core/command/__init__.py
from finitewave.core.command.command import Command
from finitewave.core.command.command_sequence import CommandSequence
| StarcoderdataPython |
6482709 | <reponame>r-woo/elfai
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from elf.options import auto_import_options, PyOptionSpec
from rlpytorch i... | StarcoderdataPython |
6482649 | <filename>server/plugins/munkiversion/munkiversion.py
from django.db.models import Count
import sal.plugin
class MunkiVersion(sal.plugin.Widget):
description = 'Chart of installed versions of Munki'
supported_os_families = [sal.plugin.OSFamilies.darwin]
def get_context(self, queryset, **kwargs):
... | StarcoderdataPython |
1847499 | import os
from setuptools import setup
def localopen(fname):
return open(os.path.join(os.path.dirname(__file__), fname))
setup(
name='pymps',
version='0.1',
description='Libary to parse fixed-format MPS files.',
author='<NAME>',
author_email='<EMAIL>',
py_modules=['pymps'],
include_p... | StarcoderdataPython |
341118 | import sublime
import sublime_plugin
import os
from .logging import debug, printf
from .configurations import config_for_scope, is_supported_view
from .workspace import get_project_path
from .types import ClientStates
from .sessions import create_session, Session
# typing only
from .rpc import Client
from .settings i... | StarcoderdataPython |
11234901 | """
验证手机号是否注册了163邮箱
add spider by judy
2019/01/04
更新下载统一为ha
目前看来网易邮箱的只有cookie下载的方式
modify by judy 2020/04/13
cookie中出现两个NTES_SESS
"""
import base64
import json
import re
import time
import traceback
import urllib.parse
from datetime import datetime
import pytz
import requests
from Crypto.Cipher import PKCS1_v1_5
from... | StarcoderdataPython |
6503985 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import wiringpi
import time
def usleep(x):
return time.sleep(x / 1000000.0)
class Lcd1602:
RS = 0
RW = 1
STRB = 2
LED = 3
D4 = 4
D5 = 5
D6 = 6
D7 = 7
LCD_BLINK_CTRL = 0x01
LCD_CURSOR_CTRL = 0x02
LCD_DISPLAY_CTRL = 0x04
... | StarcoderdataPython |
5111810 | <filename>var/spack/repos/builtin/packages/py-x21/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
from spack.package import *
class PyX21(PythonP... | StarcoderdataPython |
223850 | <reponame>clegg89/altaudit<gh_stars>0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 clegg <<EMAIL>>
#
# Distributed under terms of the MIT license.
"""
Gem and Enchant Lookup Tables
"""
"""
To save some API calls we're going to keep this data here. It'll cover most gems.
"""
gem... | StarcoderdataPython |
10604 | <filename>tests/routes/test_hackers.py<gh_stars>0
# flake8: noqa
import json
from src.models.hacker import Hacker
from tests.base import BaseTestCase
from datetime import datetime
class TestHackersBlueprint(BaseTestCase):
"""Tests for the Hackers Endpoints"""
"""create_hacker"""
def test_create_hacker(s... | StarcoderdataPython |
3434735 | <reponame>eflows4hpc/compss<filename>tests/sources/local/python/1_decorator_prolog_epilog/src/modules/testPrologEpilog.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
PyCOMPSs Testbench Tasks
========================
"""
# Imports
import unittest
import os
from pycompss.api.task import task
from pycompss.api.api i... | StarcoderdataPython |
3447215 | #!/usr/bin/python3
#!python3
#encoding:utf-8
import os.path
import subprocess
import dataset
import database.src.Database
import database.src.account.Main
import cui.register.github.api.v3.authorizations.Authorizations
import web.sqlite.Json2Sqlite
class Main:
def __init__(self, path_dir_db):
self.path_dir_... | StarcoderdataPython |
9679868 | #!/usr/bin/env python3
import os
import sys
import subprocess
from jinja2 import Environment, FileSystemLoader
image_name=sys.argv[1]
image_is_cached=True if sys.argv[2] == 'cached' else False
# Load jinja template file
TEMPLATE_FILE = 'Dockerfile.template'
template_loader = FileSystemLoader(searchpath='.')
templa... | StarcoderdataPython |
1977303 | <reponame>Tom-Li1/games
import random, time, sys
#==============导入适用模块,进入函数区域===============
def drawBoard(board):
print(board[7] + '|' + board[8] + '|' + board[9])
print('-+-+-')
print(board[4] + '|' + board[5] + '|' + board[6])
print('-+-+-')
print(board[1] + '|' + board[2] + '|' + board[3])
def inpu... | StarcoderdataPython |
3271484 | #Author: <NAME> <<EMAIL>>
#Based on the utorrent maraschino module
from flask import render_template
from datetime import timedelta
from maraschino import app, logger
from maraschino.tools import *
from rtorrent import RTorrent
def log_error(ex):
logger.log('RTORRENTDL :: EXCEPTION - %s' % ex, 'DEBUG')
@app.route('... | StarcoderdataPython |
5024102 | <reponame>exenGT/pymatgen
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License
"""
This module implements reading and writing of ShengBTE CONTROL files.
"""
import warnings
from typing import Any, Dict, List, Optional, Union
import numpy as np
from monty.dev import requires
fro... | StarcoderdataPython |
8103840 | import json
import logging
from os import path
from pathlib import Path
import time
from reconstruction import reconstruct
import fnmatch
from pprint import pprint
from extension import reconstruct_slices, addition
from futils import timeit
from tqdm import tqdm
from matching import Library, Sequence, match_library... | StarcoderdataPython |
3526996 | <reponame>ATrain951/01.python-com_Qproject
import io
import unittest
from contextlib import redirect_stdout
from unittest.mock import patch
class TestQ(unittest.TestCase):
@patch('builtins.input', side_effect=[
'3',
'5',
'2 6 2 1 7',
'4',
'15 2 1 3',
'5',
'2... | StarcoderdataPython |
9765172 | #########################################################
#Copyright (c) 2020-present, drliang219
#All rights reserved.
#
#This source code is licensed under the BSD-style license found in the
#LICENSE file in the root directory of this source tree.
##########################################################
#########... | StarcoderdataPython |
4902869 | import numpy as np
import pandas as pd
from interface import implements
from six import viewvalues
from toolz import groupby, merge
from .base import PipelineLoader
from zipline.pipeline.common import (
EVENT_DATE_FIELD_NAME,
SID_FIELD_NAME,
TS_FIELD_NAME,
)
from zipline.pipeline.loaders.frame import Data... | StarcoderdataPython |
1736086 | <filename>aisutils/daemon.py<gh_stars>10-100
#!/usr/bin/env python
__author__ = '<NAME>'
__version__ = '$Revision: 11839 $'.split()[1]
__revision__ = __version__
__date__ = '$Date: 2009-05-05 17:34:17 -0400 (Tue, 05 May 2009) $'.split()[1]
__copyright__ = '2007, 2008'
__license__ = 'Apache 2.0'
__doc__ = '... | StarcoderdataPython |
340284 | <gh_stars>1-10
class Base:
WINDOW_W = 700
WINDOW_H = 550
GAME_WH = 500
SIZE = 5
FPS = 60
DEBUG = False
COLORS = {
'0': (205, 193, 180),
'2': (238, 228, 218),
'4': (237, 224, 200),
'8': (242, 177, 121),
'16': (245, 149, 99),
'32': (246, 124, 95... | StarcoderdataPython |
4846822 | <filename>app/models.py
from datetime import datetime
import sys
import json
import os
import re
import parsedatetime as pdt
from pymongo import MongoClient
MONGO_URI = os.environ.get('MONGODB_URI')
if not MONGO_URI:
sys.exit("\nMONGODB_URI environment variable not set, see https://docs.mongodb.com/manual/refere... | StarcoderdataPython |
11283773 | <filename>tests/__init__.py
class Test:
def __init__(self, x, y):
self.x = x
self.y = y
def mult(self):
return self.x * self.y
| StarcoderdataPython |
1989718 | from rest_framework import serializers
from api import models
class UserProfileSerializer(serializers.ModelSerializer):
class Meta:
model=models.UserProfile
fields=('id','username','name','password')
extra_kwargs={
'password':{
'write_only':True,
... | StarcoderdataPython |
12854129 | import json
from typing import Callable, TypeVar, cast
from .constants import CUSTOM_LOG_FORMAT, CUSTOM_EVENT_NAME_MAP, CUSTOM_PAGE_NAME_MAP
from datetime import datetime
import logging
from airflow.settings import TIMEZONE
from airflow.utils.session import create_session
import functools
T = TypeVar("T", bound=Calla... | StarcoderdataPython |
1718955 | <reponame>jeshan/botodocs
from boto3.resources.model import Action, Waiter
from botocore.waiter import WaiterModel
import pythonic
from util import create_new_file, get_botostubs_message, get_link_to_client_function, write_lines, get_variable_name_for
def create_waiter_index(path, client_name, service_name, waiter_n... | StarcoderdataPython |
341639 | <filename>token.py
tokentype = {
'INT': 'INT',
'FLOAT': 'FLOAT',
'STRING': 'STRING',
'CHAR': 'CHAR',
'+': 'PLUS',
'-': 'MINUS',
'*': 'MUL',
'/': 'DIV',
'=': 'ASSIGN',
'%': 'MODULO',
':': 'COLON',
';': 'SEMICOLON',
'<': 'LT',
'>': 'GT',
'[': 'O_BRACKET',
... | StarcoderdataPython |
9776386 | <gh_stars>1-10
import os
import sys
from cps.base import BaseClient
class WebClient(BaseClient):
def info(self, service_id):
service = BaseClient.info(self, service_id)
nodes = self.callmanager(service['sid'], "list_nodes", False, {})
if 'error' in nodes:
return
err... | StarcoderdataPython |
9722368 | def poly_consolidate(poly):
powers = {}
for coeff, power in poly:
power = tuple(power)
powers[power] = powers.get(power, 0) + coeff
conspoly = [[coeff, list(power)] for power, coeff in powers.items()]
return conspoly
def poly_degree(poly):
degree = 0
for i in poly:
if s... | StarcoderdataPython |
3208782 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
.. module:: find_in_wikipedia
:platform: Unix
:synopsis: the top-level submodule of Dragonfire.commands that contains the classes related to Dragonfire's simple if-else struct of searching in wikipedia ability.
.. moduleauthors:: <NAME> <<EMAIL>>
... | StarcoderdataPython |
111632 | <gh_stars>0
# Copyright 2017 AT&T Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | StarcoderdataPython |
6503061 | import pytest
from common.constants import LoginConstants
from models.auth import AuthData
class TestAuth:
"""Класс, представляющий набор тестов для проверки функции аутентификации пользователя."""
@pytest.mark.positive
def test_auth_valid_data(self, app):
"""
Steps
1. Open main ... | StarcoderdataPython |
9605902 | # Generated by Django 2.2.17 on 2021-03-05 16:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('features', '0028_auto_20210216_1600'),
('features', '0029_auto_20210223_2106'),
]
operations = [
]
| StarcoderdataPython |
12812880 | import unittest
from machinetranslation.translator import french_to_english
from machinetranslation.translator import english_to_french
null = ''
class TestTranslator(unittest.TestCase):
def test_f2e(self):
b = 'Bonjour'
self.assertEqual(french_to_english(b), 'Hello')
pass
self.as... | StarcoderdataPython |
9612839 | from torch.utils.data import Dataset
from PIL import Image
import numpy as np
import torch
class PositionDataset(Dataset):
"""Position encoding dataset"""
def __init__(self, image_name):
self.image_name = image_name
#open routine from fastaiv1
with open(self.image_name, 'rb') as f:
... | StarcoderdataPython |
265517 | # https://www.hackerrank.com/contests/w28/challenges/boat-trip
# Author : <NAME>
#!/bin/python3
import sys
n,c,m = input().strip().split(' ')
n,c,m = [int(n),int(c),int(m)]
p = list(map(int, input().strip().split(' ')))
#print("max", max(p))
if max(p) <= m*c:
print("Yes")
else:
print("No")
| StarcoderdataPython |
5003767 | # Problem Set 4B
# Name: <NAME>
# Collaborators: None
# Time Spent: 02:30
import string
from copy import deepcopy
### HELPER CODE ###
def load_words(file_name):
'''
file_name (string): the name of the file containing
the list of words to load
Returns: a list of valid words. Words are strin... | StarcoderdataPython |
8121703 | <gh_stars>0
#! /usr/bin/python
from Tkinter import *
from Adafruit_BME280 import *
sensor = BME280(t_mode=BME280_OSAMPLE_8, p_mode=BME280_OSAMPLE_8, h_mode=BME280_OSAMPLE_8)
root = Tk()
frame=Frame(root)
frame.pack()
degrees = sensor.read_temperature()
pascals = sensor.read_pressure()
hectopascals = pascals / 100
humi... | StarcoderdataPython |
11381267 | from mock import patch
from nose.tools import assert_equals
from prompter import yesno
YESNO_COMBINATIONS = [
('yes', 'yes', True),
('yes', 'YES', True),
('yes', 'Yes', True),
('yes', 'y', True),
('yes', 'Y', True),
('yes', '', True),
('yes', 'no', False),
('yes', 'NO', False),
('ye... | StarcoderdataPython |
1950117 | ''' This plotter expects 3-tuples
(median, firstQuantile, thirdQuantile) as input.
The output is the default Boxerrorbar plot
from gnuplot.
'''
import os
import sys
import subprocess
separator = '|'
def _writePlotHeaderData(gnuplotFile, outputFileName, config, additionalCommands=None):
# For details see the... | StarcoderdataPython |
9667008 | #coding=utf8
from setuptools import setup
try:
long_description = open('README.md', encoding='utf8').read()
except Exception as e:
print(e)
long_description = ''
setup(
name='myrsa',
version='0.0.1',
description='Simple use of RSA for asymmetric encryption and signature | 简单使用 rsa 进行非对称加密和签名... | StarcoderdataPython |
6698653 | # Exceptions
class CheckerException(Exception):
def __str__(self):
return 'Base checker Exception'
class WrongColorError(CheckerException):
def __str__(self):
return 'Wrong color - only black or white for choose'
def __repr__(self):
return 'Wrong color'
class PositionError(Check... | StarcoderdataPython |
1954720 | <filename>math_question/math_so.py<gh_stars>1-10
import numpy as np
import pandas as pd
import tensorflow as tf
import ops
tf.set_random_seed(0)
np.random.seed(0)
np.set_printoptions(precision=5, linewidth=120, suppress=True)
mat_val = np.array([[1 / (i + j + 1) for i in range(10)] for j in range(10)])
rhs_val = 0.... | StarcoderdataPython |
3401646 | <reponame>yupeekiyay/ofta365
from django.urls import path
from . import views
app_name = 'events'
urlpatterns = [
path('<slug>/', views.EventDetailView.as_view(), name='event-detail'),
path('<slug>/update/', views.EventUpdateView.as_view(), name='event-update'),
path('<slug>/delete/', views.EventDeleteVie... | StarcoderdataPython |
3591422 | '''
A quick and dirty skeleton for prototyping GLSL shaders. It consists of a
self contained slice-based volume renderer.
'''
import numpy, sys, wx
from OpenGL.GL import *
from OpenGL.GLU import *
from numpy import array
from transfer_function import TransferFunctionWidget
from wx.glcanvas import GLCanvas
# The s... | StarcoderdataPython |
6483850 | #!/usr/bin/env python
from setuptools import setup
setup(name='fasp',
version='1.0',
packages=['fasp',
'fasp.search'],
) | StarcoderdataPython |
360738 | import os
from JumpScale import j
import re
# requires sshfs package
class SshFS(object):
server = None
directory = None
share = None
filename = None
end_type = None
username = None
password = None
mntpoint = None
_command = 'sshfs'
def __init__(self,end_type,server,directory,u... | StarcoderdataPython |
4882340 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `vimanga` package."""
import pytest
from vimanga.api.core import call_api, get_chapters, get_images
from vimanga.api.types import Manga, Chapters
@pytest.fixture
def manga():
"""Manga Sample"""
return Manga(21937, 'type', 'score', 'name', 'synopsis... | StarcoderdataPython |
122587 | <reponame>gradut/cardboard
# Generated by Django 4.0.1 on 2022-01-07 02:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hunts", "0006_start_end_times"),
]
operations = [
migrations.CreateModel(
... | StarcoderdataPython |
269807 | sequence = input("Enter your sequence: ")
sequence_list = sequence[1:len(sequence)-1].split(", ")
subset_sum = False
for element in sequence_list:
for other in sequence_list:
if int(element) + int(other) == 0:
subset_sum = True
print(str(subset_sum))
| StarcoderdataPython |
1620306 | <filename>src/utilsmodule/test.py
'''
Get all football match on direct
'''
import requests
from bs4 import BeautifulSoup
from urlvalidator import validate_url, ValidationError
from src import WilliamHillURLs as whurls
import pandas as pd
import csv
import os
if __name__ == "__main__":
# -----------------------... | StarcoderdataPython |
6685298 | import torch
from torch import Tensor
from torch import nn
import torch.nn.functional as F
from typing import Tuple
class NNet(nn.Module):
def __init__(self):
super(NNet, self).__init__()
self.layer1 = nn.Linear(2+1,5)
self.layer2 = nn.Linear(5,1)
pass
def forward(self,... | StarcoderdataPython |
385891 | #!/usr/bin/env python
import sys
import os
from subprocess import *
if len(sys.argv) <= 1:
print('Usage: {0} training_file [testing_file]'.format(sys.argv[0]))
raise SystemExit
# svm, grid, and gnuplot executable files
is_win32 = (sys.platform == 'win32')
if not is_win32:
svmscale_exe = "../svm-scale"
svmtrain_... | StarcoderdataPython |
173373 | <reponame>gour/holidata
[
{
'date': '2020-01-01',
'description': 'Nouvel An',
'locale': 'fr-BE',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2020-04-12',
'description': 'Pâques',
'locale': 'fr-BE',
'notes': '',
... | StarcoderdataPython |
325421 | <filename>contrib/0.挖宝行动/youzidata-机坪跑道航空器识别/src/utils/label_converter.py
import numpy as np
from PIL import Image, ImageDraw, ImageFont
from xml.dom import minidom
import random
import cv2
import os
def generateXml(xml_path, boxes, w, h, d):
impl = minidom.getDOMImplementation()
doc = impl.createDocument(Non... | StarcoderdataPython |
9670081 | import torch
import torch.nn as nn
from ..advtrainer import AdvTrainer
class GradAlign(AdvTrainer):
r"""
GradAlign in 'Understanding and Improving Fast Adversarial Training'
[https://arxiv.org/abs/2007.02617]
[https://github.com/tml-epfl/understanding-fast-adv-training]
Attributes:
self.m... | StarcoderdataPython |
9600992 | import os
import sys
import pandas as pd
from yahoo_fin import stock_info as si
import csv
from datetime import datetime, date, time, timedelta, timezone
import alpaca_trade_api as tradeapi
import pytz;
from yahoo_fin import stock_info as si
import time;
import json
api = tradeapi.REST('XyZ','XYZ')
pr... | StarcoderdataPython |
9695275 | <filename>DFS.py<gh_stars>0
'''
find biggest region of connected 1's in a grid of 1s and 0s
'''
def isSafe(grid, row, col, visited):
if (row < 0) or (row >= ROWS) or (col < 0) or (col >= COLS) \
or (grid[row][col] == 0) or (visited[row][col] == 1):
return False
else:
return True
def DFS(grid, row, col, c... | StarcoderdataPython |
3405352 | import pylint
import reward
def test_reward_straight_track_success():
""" Test to see if a straight track results in rewarding 2x """
params = {
'waypoints': [
[0, 1], [1, 2], [2, 3], [3, 4]
],
'closest_waypoints': [1, 2],
'steering_angle': 0
}
assert reward.reward_straight_track(params) ... | StarcoderdataPython |
11391071 | <reponame>jkleczar/ttslabdev
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division, print_function #Py2
__author__ = "<NAME>"
__email__ = "<EMAIL>"
import sys
import os
import multiprocessing
from glob import glob
import subprocess
def extract_lf0(parms):
cmds = "python... | StarcoderdataPython |
3249996 | from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def hello():
return render_template('index.html')
@app.route("/contact")
def about():
return render_template('contact.html')
cars = [
{"car_id": "112093012309120310", "car_model": "Honda",
"car_speed": "200"},
{"car_... | StarcoderdataPython |
6697426 | import numpy as np
import random
import sys
import time
from TicTacToeView import TicTacToeView
from TicTacToeModel import TicTacToeModel
from stubView import stubView
BLUE = (0, 0, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
WHITE = (255, 255, 255)
needToWinGLOBAL = 0
class TicTacToe:
def __in... | StarcoderdataPython |
3352661 | __MAJOR__ = 0
__MINOR__ = 2
__MICRO__ = 0
__VERSION__ = (__MAJOR__, __MINOR__, __MICRO__)
__version__ = '.'.join(str(n) for n in __VERSION__)
__github_url__ = 'http://github.com/JWKennington/apsjournals'
from apsjournals.journals import PRL, PRM, PRA, PRB, PRC, PRD, PRE, PRX, PRAB, PRApplied, PRFluids, PRMaterials, P... | StarcoderdataPython |
3533616 | <reponame>myepes2/MiSiCgui
from tensorflow.keras.models import load_model
from tensorflow.keras.utils import get_file
import numpy as np
from skimage.transform import resize,rescale
from skimage.feature import shape_index
from skimage.util import random_noise
from skimage.io import imread,imsave
import matplotlib.p... | StarcoderdataPython |
11212789 | # -*- coding: utf-8 -*- #
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | StarcoderdataPython |
4981735 | import json
import unittest
from unittest.mock import MagicMock
from conjur_api.models import CreateTokenData
from conjur.errors import MissingRequiredParameterException
from conjur.logic.hostfactory_logic import HostFactoryLogic
from unittest.mock import patch
class HostfactoryLogicTest(unittest.TestCase):
def... | StarcoderdataPython |
6492404 | <gh_stars>0
#!/usr/bin/env python2
import sys
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('ggplot')
filename = sys.argv[1]
print filename
data = pd.read_csv(filename, sep='\t', index_col=False)
df = pd.DataFrame()
for mnode in data['mnode'].unique() :
sub = data[... | StarcoderdataPython |
1634672 | <filename>arkane/encorr/bac.py<gh_stars>100-1000
#!/usr/bin/env python3
###############################################################################
# #
# RMG - Reaction Mechanism Generator #
# ... | StarcoderdataPython |
8107069 | <reponame>peng-data-minimization/minimizer-poc
from collections import deque
import json
from kafka import KafkaProducer, KafkaConsumer
from anonymizer import Anonymizer
consumer = KafkaConsumer(bootstrap_servers="localhost:9092", value_deserializer=json.loads)
consumer.subscribe(["unanon"])
producer = KafkaProducer(... | StarcoderdataPython |
1822449 | <reponame>globocom/globomap-api-client
"""
Copyright 2018 Globo.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required... | StarcoderdataPython |
258701 | <filename>eucaconsole/forms/groups.py
# -*- coding: utf-8 -*-
# Copyright 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of sou... | StarcoderdataPython |
9742971 | import json
import matplotlib.pyplot as plt
public_name = ['hsemem', 'msuofmems']
man = 0
woman = 0
for n in public_name:
with open(f'data/{n}.json', 'r') as f:
data = json.load(f)
for i in data.keys():
if int(data[i]['user']['sex']) == 2:
man += 1
else:
woman... | StarcoderdataPython |
5141482 | """
Handles multidimensional huge data.
since it requires huge size memory:
- we use the mean from different cell types instead of just using samples.
- we use PCA to reduce the number of cell types
There are two approaches:
1. Discrete - discretization for words for each sequence, and then building words by combin... | StarcoderdataPython |
8057467 | <reponame>meetps/rhea
from __future__ import absolute_import
from .iceriver import IceRiver | StarcoderdataPython |
8097739 | from aiosparql.syntax import Node, RDFTerm
from tests.integration.helpers import IntegrationTestCase, unittest_run_loop
class DeltaTestCase(IntegrationTestCase):
@unittest_run_loop
async def test_push_notification(self):
ws = await self.client.ws_connect('/')
test_id = self.uuid4()
te... | StarcoderdataPython |
11215491 | <filename>app/ext/api/controller/users_controller.py<gh_stars>0
from app.ext.api.controller import recipe_controller
from app.ext.api.exceptions import (
EmailAlreadyExist,
InvalidToken,
InvalidUser,
UserNotFound,
)
from app.ext.api.services import token_services, users_services, util_services
from dyna... | StarcoderdataPython |
3440005 | <filename>_site/tomat/apps/ideas/views.py
# -*- coding: utf-8 -*-
from django.shortcuts import get_object_or_404, render
from django.core.paginator import PageNotAnInteger, InvalidPage, Paginator
from django.core.urlresolvers import reverse
from ideas.models import Idea, Category
from products.models import Product
... | StarcoderdataPython |
5181823 | #!/usr/bin/env python3
'''This NetworkTables client demonstrates the use of classes to access values.'''
import time
from networktables import NetworkTables
from networktables.util import ntproperty
import logging
# To see messages from networktables, you must setup logging
logging.basicConfig(level=logging.DEBUG)
N... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.