id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
6698192
# Copyright © 2019 Province of British Columbia # # 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 by applicable law or agr...
StarcoderdataPython
6694054
<filename>CartPole/uploadCartPole.py<gh_stars>0 import gym gym.upload('/tmp/cartpole-v1-experiment-1', api_key='sk_OM2SEFKTTfia7GeMo8dWWA')
StarcoderdataPython
1610641
import tensorflow as tf from neural_toolbox import rnn, utils from generic.tf_utils.abstract_network import AbstractNetwork class GuesserNetwork(AbstractNetwork): def __init__(self, config, num_words, device='', reuse=False): AbstractNetwork.__init__(self, "guesser", device=device) mini_batch_s...
StarcoderdataPython
11211465
from selenium.webdriver import FirefoxProfile from tools.file import FileUtil class FireFoxProfile: DOWNLOAD_TO_DESK_TOP = 0 DOWNLOAD_TO_DEFAULT_PATH = 1 DOWNLOAD_TO_CUSTOMER = 2 def __init__(self): self.__profile = FirefoxProfile() def set_browser_download_path(self, path): pat...
StarcoderdataPython
5049237
# -*- coding: utf-8 -*- import ccxtpro from asyncio import run print('CCXT Pro Version:', ccxtpro.__version__) # This example will run silent and will return your balance only when the balance is updated. # # 1. launch the example with your keys and keep it running # 2. go to the trading section on the website # 3...
StarcoderdataPython
3331767
<filename>utiles/corrige_presentacion.py<gh_stars>0 #!/bin/python import connect, MySQLdb #import sys #tabla=sys.argv[1] db=MySQLdb.connect(host='localhost',user=connect.user,passwd=connect.passwd,db=connect.db) cursor=db.cursor() sql='select * from articulos where presentacion like "%cc%"' cursor.execute(sql) resu...
StarcoderdataPython
3380064
<reponame>apolat2018/LSAT<filename>tune_mlp.py # -*- coding: cp1254 -*- """ This Script tunes the Multi Layer Perceptron Algorithm. RandomizedSearchCV method can be used. A graph is plotted for every selecting parameter. Also the values of Success rate and Prediction rate are seen on screen. Created on Mon Nov 5 22:3...
StarcoderdataPython
5077192
<filename>tools/json_update.py #!/usr/bin/env python2.7 # -*- coding: utf-8 -* """ PCI ID Vendor/Device database collector """ from __future__ import unicode_literals, print_function import json import sys import os CUR_PATH = os.path.dirname(__file__) ABS_PATH = os.path.abspath(CUR_PATH) ROOT_DIR = os.path.dirname(...
StarcoderdataPython
4858737
# -*- coding: utf-8 -*- # import os def parse_project_and_task_from_dag_id(dag_id): """Parse project and task from dag id. Args: dag_id (str): The id of DAG. Returns: (tuple of str): The first item is project. The second item is task. If dag_id is invalid, will return empty s...
StarcoderdataPython
6608083
<filename>TestingStageEnvWin/coinbacktesting_bt.py<gh_stars>1-10 import coinrepo import bt def main(): '''entry point''' # Get Test Data with all fields symbol_list = ['BTC', 'ETH'] history = coinrepo.get_coinhistory(symbol_list) history = history.set_index('Date') # Pivot to have only pr...
StarcoderdataPython
3406966
<gh_stars>0 ''' first code ''' import sys def main(): print("Hello, world!!!") if __name__ == '__main__': main()
StarcoderdataPython
11382049
print("please give me A+")
StarcoderdataPython
8142102
# -*- coding: utf-8 -*- # python -m cProfile filename.py # import base packages import warnings # warnings.filterwarnings("ignore") def ignore_warn(*args, **kwargs): pass warnings.warn = ignore_warn import os import re import time import numpy as np import pandas as pd from pathlib import Path import matplotlib....
StarcoderdataPython
8023920
<gh_stars>10-100 from collections import defaultdict import gzip import re GTF_HEADER = ['seqname', 'source', 'feature', 'start', 'end', 'score', 'strand', 'frame'] R_SEMICOLON = re.compile(r'\s*;\s*') R_COMMA = re.compile(r'\s*,\s*') R_KEYVALUE = re.compile(r'(\s+|\s*=\s*)') def readGTF(filename...
StarcoderdataPython
1828027
<gh_stars>10-100 import cv2 import numpy as np from .camera.parameters import CameraParams, IntrinsicParams, ExtrinsicParams from .camera.coordinate_transformation import CoordinateTransformation, rotationMatrix3D#, reverseX, reverseY from .camera import basic_tools class InversePerspectiveMapping(object): def __i...
StarcoderdataPython
6619677
import datetime as _dt from sqlite3 import Timestamp import sqlalchemy as _sql import sqlalchemy.orm as _orm import passlib.hash as _hash from sqlalchemy.schema import Column from sqlalchemy.types import String, Integer, Enum, DateTime, Boolean, ARRAY, Text from sqlalchemy import ForeignKey from uuid import UUID, uuid4...
StarcoderdataPython
1962355
# coding: utf-8 print("なにか入力してください") #x = raw_input() # version 2のみ有効. version3のinputに相当する x = input() #version2の場合はeval()に渡された評価式(1+2を渡すと3が返る). version3の場合は文字列として返る. version2は数値や"abc"のように評価できる式でないとエラーになる print("あなたが入力したのは {} です".format(x)) print(type(x))
StarcoderdataPython
35227
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2017-12-29 18:33 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('places', '0027_auto_20171229_1606'), ] operations = [ migrations.AddField( ...
StarcoderdataPython
1733422
<gh_stars>10-100 from sqlalchemy import Column, Integer, String from ...models.car_viewmodels import Car from .base_model import BaseModel class CarDataModel(BaseModel): __tablename__ = "cars" id = Column("id", Integer, primary_key=True) year = Column("year", Integer) make = Column("make", String(25...
StarcoderdataPython
6683956
import cv2 as cv import numpy as np #像素运算02 def add_demo(m1,m2): dest = cv.add(m1,m2) cv.imshow("add_demo",dest) def subtract_demo(m1,m2): dest = cv.subtract(m1,m2) cv.imshow("subtract_demo", dest) def divide_demo(m1,m2): dest = cv.divide(m1,m2) cv.imshow("divide_demo", dest) def multiply_d...
StarcoderdataPython
3340782
import threading from queue import Queue def worker(num): """thread worker function""" for i in range(100): print('Worker', num) return if __name__ == '__main__': threads = [] # for i in range(5): # t = threading.Thread(target=worker, args=(i,)) # threads.append(t) # ...
StarcoderdataPython
4917072
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def findTarget(self, root: TreeNode, k: int) -> bool: def dfs(node, nodes): if not node: return False...
StarcoderdataPython
1749127
# ****************************************************************************** # Copyright 2017-2018 Intel Corporation # # 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.apa...
StarcoderdataPython
11200379
from .graphics import plot_importance from .help import *
StarcoderdataPython
3310308
from __future__ import annotations from rich import box from rich.align import Align from rich.console import Console, ConsoleOptions, RenderResult, RenderableType from rich.style import StyleType from textual import events from textual.message import Message from textual.reactive import Reactive from textual.widget ...
StarcoderdataPython
8037785
import psycopg2 conexion = psycopg2.connect( database="test_db", user="postgres", password="<PASSWORD>", host="localhost", port="5432" ) try: with conexion: with conexion.cursor() as cursor: query = """ INSERT INTO persona(nombre, apellido, email) VALUES(%s, %s,...
StarcoderdataPython
28443
"""Execute validated & constructed query on device. Accepts input from front end application, validates the input and returns errors if input is invalid. Passes validated parameters to construct.py, which is used to build & run the Netmiko connections or hyperglass-frr API calls, returns the output back to the front e...
StarcoderdataPython
3274698
nome = str(input('Digite o seu nome completo: ')).strip() print('Seu nome em maiúsculo:', nome.upper()) print('Seu nome em minúsculo:', nome.lower()) print('Seu nome tem ao todo: {} letras'.format(len(nome) - nome.count(' '))) primeiroSeparado = nome.split() print('Seu primeiro nome tem:', len(primeiroSeparado[0]), 'le...
StarcoderdataPython
8138202
ficha = list() while True: nome = input('Nome: ').strip() nota1 = float(input('Nota 1: ')) nota2 = float(input('Nota 2: ')) media = (nota1 + nota2) / 2 ficha.append([nome, [nota1, nota2], media]) # alunos.append(input('Nome: ').strip()) # notas[0].append(float(input('Nota 1: '))) # no...
StarcoderdataPython
5009836
<filename>bus2pwl/bus2pwl.py #!/usr/bin/python # (C) <NAME> <<EMAIL>> from __future__ import print_function, with_statement import os import re import sys from decimal import Decimal # TODO: # - allow comments in input file # - passthru (header) comments # - system info + datetime in output header def usage(): ...
StarcoderdataPython
1755669
<filename>Chapter13_code/ch13_r02_restrict_access_to_web_accessible_paths/controllers/main.py # -*- coding: utf-8 -*- # © 2015 Therp BV <http://therp.nl> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import http from openerp.http import request class Main(http.Controller): @htt...
StarcoderdataPython
3571054
# encoding: utf-8 from pkg_resources import resource_filename from typing_extensions import Final ISLE_DOWNLOAD_URL = "https://github.com/uiuc-sst/g2ps/tree/master/English/ISLEdict.txt" DEFAULT_ISLE_DICT_PATH = resource_filename("pysle", "data/ISLEdict.txt") class LengthOptions: SHORTEST: Final = "shortest" ...
StarcoderdataPython
1941343
<gh_stars>0 import hashlib class Transaction: def __init__(self, from_address, to_address, amount, timestamp): self.from_address = from_address self.to_address = to_address self.amount = amount self.timestamp = timestamp def __repr__(self): return ( f'Tran...
StarcoderdataPython
221079
class Solution: def isPowerOfTwo(self, n: int) -> bool: return n and not (n & n - 1)
StarcoderdataPython
9788057
<gh_stars>1-10 from test import positions__offset_centre from test_autolens.integration.tests.imaging.runner import run_a_mock class TestCase: def _test_positions__offset_centre(self): run_a_mock(positions__offset_centre)
StarcoderdataPython
3415976
# snippet list generation import os # list of snippet files snip_list = [x[:-3] for x in os.listdir (os.path.dirname (__file__)) if not x.startswith('_') and x.endswith('.py')] snip_list.sort() # function used by some or all snippets def snippet_normalize (ctx, width, height): ctx.scale (width, height)...
StarcoderdataPython
8006264
<filename>setup.py from setuptools import setup setup( name='deep-sentiment', version='0.1.0', packages=['sentiment'], url='https://github.com/lanPN85/deep-sentiment', license='MIT', author='<NAME>, <NAME>, <NAME>', author_email='<EMAIL>', description='LSTM-CNN sentiment analysis librar...
StarcoderdataPython
8130638
<filename>hydra/_internal/core_plugins/__init__.py # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from .bash_completion import BashCompletion from .basic_launcher import BasicLauncher from .basic_sweeper import BasicSweeper __all__ = ["BasicLauncher", "BashCompletion", "BasicSweeper"]
StarcoderdataPython
4918479
#!/usr/bin/python # -*- coding: utf-8 -*- # libthumbor - python extension to thumbor # http://github.com/heynemann/libthumbor # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2011 <NAME> <EMAIL> '''Encrypted URLs for thumbor encryption.''' from __future__ import abs...
StarcoderdataPython
11358081
<gh_stars>1-10 import CSDGAN.utils.db as db import CSDGAN.utils.constants as cs import utils.image_utils as iu import utils.utils as uu from CSDGAN.classes.image.ImageDataset import OnlineGeneratedImageDataset from CSDGAN.classes.image.ImageNetD import ImageNetD from CSDGAN.classes.image.ImageNetG import ImageNetG from...
StarcoderdataPython
8071140
<gh_stars>0 # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload fr...
StarcoderdataPython
3317248
# -*- coding: utf-8 -*- # Copyright CNRS 2012, # <NAME> (LULI) # This software is governed by the CeCILL-B license under French law and # abiding by the rules of distribution of free software. from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys import...
StarcoderdataPython
6696229
<filename>flask/app/site/routes/dataset_search.py<gh_stars>0 import flask from flask import session from smtplib import SMTP from flask import Flask, Blueprint, render_template, request, Response, redirect, url_for, jsonify from app.api.models import datasets, UserModel, _runSql import numpy module = Blueprint('datas...
StarcoderdataPython
9726851
<gh_stars>1-10 from conans import CMake, ConanFile, tools from conans.errors import ConanInvalidConfiguration import os class Bullet3Conan(ConanFile): name = "bullet3" description = "Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine...
StarcoderdataPython
3587425
from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView from jobs.models import Job from django.urls import reverse_lazy from .forms import JobForm from django.shortcuts import redirect from django.db.models import Q class JobView(ListView): model = Job template_name = 'jobs....
StarcoderdataPython
6572659
from typing import Dict, List, NamedTuple, Optional from firebolt.common.urls import INSTANCE_TYPES_URL from firebolt.common.util import cached_property from firebolt.model.instance_type import InstanceType, InstanceTypeKey from firebolt.model.region import Region from firebolt.service.base import BaseService class ...
StarcoderdataPython
3333665
import os from setuptools import setup long_description = open(os.path.join(os.path.dirname(__file__), 'README.md')).read() setup( name='kociemba', version='1.2', description='Python/C implementation of Herbert Kociemba\'s Two-Phase algorithm for solving Rubik\'s Cube', long_description=long_descript...
StarcoderdataPython
5054927
# Python test set -- part 3, built-in operations. print '3. Operations' print 'XXX Not yet implemented'
StarcoderdataPython
9778052
#!/usr/bin/env python import os, sys, re, time, json from flash_program_ll import burn_bin_files try: import serial from serial.tools import miniterm except: print("\nNot found pyserial, please install it by: \nsudo python%d -m pip install pyserial" % (sys.version_info.major)) sys.exit(-1) def get_bin...
StarcoderdataPython
3560987
# Generated by Django 3.0.4 on 2020-07-06 20:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('rapport', '0001_initial'), ] operations = [ migrations.AlterField( model_name='rapportsignalprobleme', name='confirm...
StarcoderdataPython
3550389
from rest_framework import serializers from equipment_assigments.models import Equipment_Assigment class Equipment_AssigmentSerializer(serializers.ModelSerializer): class Meta: model = Equipment_Assigment fields = ( 'id', 'id_user', 'id_equipment', ) ...
StarcoderdataPython
9658819
import cv2 import numpy as np import face_recognition import os import datetime import pyrebase config = { "apiKey": "<KEY>", "authDomain": "mark-it-ec28b.firebaseapp.com", "projectId": "mark-it-ec28b", "storageBucket": "mark-it-ec28b.appspot.com", "messagingSenderId": "187768173767", "appId": ...
StarcoderdataPython
1667838
import numpy as np import matplotlib.pyplot as plt def calcY_HM(g, t): v = g*t h = ((g*(t**2))/(g)) return h def calcX_HM(v,t): S = v*t return S def plotGraph(time, XY): t = np.arange(0.0, time, 0.125) fig, ax = plt.subplots() ax.plot(XY[0], XY[1]) ax.set(xlabel='X', ylabel='Y', t...
StarcoderdataPython
3235312
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from habitat_sim._ext.habitat_sim_bindings import ( ArticulatedObjectManager, CollisionGroupHelper, CollisionGroups, JointMotorS...
StarcoderdataPython
5147193
""" Functions for handling dates. Contains: gd2jd -- converts gregorian date to julian date jd2gd -- converts julian date to gregorian date Wish list: Function to convert heliocentric julian date! These functions were taken from Enno Middleberg's site of useful astronomical python references: http://www...
StarcoderdataPython
3402653
<reponame>Honno/coinflip<gh_stars>1-10 import webbrowser from tempfile import NamedTemporaryFile from click.testing import CliRunner from hypothesis import HealthCheck from hypothesis import settings from hypothesis.stateful import Bundle from hypothesis.stateful import RuleBasedStateMachine from hypothesis.stateful i...
StarcoderdataPython
12851456
<filename>scripts/betterX_labs_attributes.py<gh_stars>0 ## Web File def insertWeb(filetype, json, cursor, conn, uid): if (filetype == 'web'): web_page_node(json,uid,cursor,conn) # [pages] / [pageNode] web_entry_node(json, uid, cursor, conn) # [pages] / [entriesNode] def web_entry_response(json_entries_node, u...
StarcoderdataPython
3422828
#Faça um algoritmo que o usuário infomre quantas idades serão informadas e exiba a maior. a=int(input("Digite quantas vezes vc quer informar a idade")) i=0 m=0 for i in range (a): n=int(input("Digite uma idade")) if (n>m): m=n print(m)
StarcoderdataPython
96294
from copy import copy import numpy as np from gym_chess import ChessEnvV1 from gym_chess.envs.chess_v1 import ( KING_ID, QUEEN_ID, ROOK_ID, BISHOP_ID, KNIGHT_ID, PAWN_ID, ) from gym_chess.test.utils import run_test_funcs # Blank board BASIC_BOARD = np.array([[0] * 8] * 8, dtype=np.int8) # Pa...
StarcoderdataPython
8195819
try: from wrapper import * except ImportError: from .wrapper import *
StarcoderdataPython
8043460
<reponame>hershg/ray from __future__ import absolute_import from __future__ import division from __future__ import print_function import ray @ray.remote def f(): return 0 @ray.remote def g(): import time start = time.time() while time.time() < start + 1: ray.get([f.remote() for _ in range(1...
StarcoderdataPython
11314777
<filename>prioritization/prioritization_runner.py import prioritization as pr alphaRangeNum = 5 projects = ['Chart', 'Closure', 'Lang', 'Math', 'Time'] fromVersion = [1, 1, 1, 1, 1] toVersion = [13, 50, 33, 50, 14] #projects = ['Chart'] #fromVersion = [1] #toVersion = [13] sum_additional_elapsed_time = 0 ...
StarcoderdataPython
298504
#!/usr/bin/python import numpy as np import roslib; roslib.load_manifest('hrl_fabric_based_tactile_sensor') roslib.load_manifest('hrl_meka_skin_sensor_darpa_m3') import rospy import hrl_meka_skin_sensor_darpa_m3.skin_patch_calibration as spc from std_msgs.msg import Empty class Fabric_Skin_Calibration(spc.SkinCali...
StarcoderdataPython
6607416
n = int(input()) sum = 0 k = 0 while sum < n: k += 1 sum += k sum -= k count = n - sum if k % 2 == 0: print("{1}/{0}".format(k - count + 1, count)) else: print("{0}/{1}".format(k - count + 1, count))
StarcoderdataPython
3349220
<reponame>waduhek/shopping<filename>cart/models.py from django.db import models from django.contrib.auth.models import User from shop.models import Product class Cart(models.Model): cart_id = models.CharField(max_length=250, blank=True) date_added = models.DateField(auto_now_add=True) class Meta: ...
StarcoderdataPython
8171682
import pandas as pd from config.base_config import column_config_path, data_path from sklearn.pipeline import Pipeline from sklearn.compose import ColumnTransformer from preprocess.Preprocess import PreprocessMissvalue, PreprocessOutlier from feature.FeatureProcess import FeaturesStandard, FeaturesEncoder, FeaturesDeco...
StarcoderdataPython
3336100
<filename>nets/numeric.py """ The ``functional`` modules defines basic functions to generate tensors and transform data. """ # Basic imports import numpy as np try: import cupy as cp except ModuleNotFoundError: pass # NETS Package import nets from nets.cuda import numpy_or_cupy from nets.data import dataset ...
StarcoderdataPython
6451535
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import numpy as np from ..builder import PIPELINES @PIPELINES.register_module() class LoadImageFromFile: """Loading image(s) from file. Required key: "image_file". Added key: "img". Args: to_float32 (bool): Whether to convert the ...
StarcoderdataPython
3207592
import operator import random import statistics import timeit from typing import Any, List, Type import tabulate import pysegmenttree._pysegmenttree_py import pysegmenttree.c_extensions def get_random_query(start: int, end: int): query = [random.randint(start, end), random.randint(start, end)] query.sort() ...
StarcoderdataPython
9799050
from gym.envs.registration import register register( id='RandomWalk-v0', entry_point='rlsuite.envs.random_walk.random_walk:RandomWalk', max_episode_steps=50, )
StarcoderdataPython
6629442
import os import torch from torch.utils.tensorboard import SummaryWriter def build_scheduler(opt, params): lr_decay_factor = params.get('lr_decay_factor') lr_decay_steps = params.get('lr_decay_steps') if lr_decay_factor: return torch.optim.lr_scheduler.StepLR(opt, lr_decay_steps, lr_decay_factor)...
StarcoderdataPython
357701
<reponame>michaelqknguyen/Budget-Buddy import pytest from django.urls import reverse, resolve from budgetbuddy.paychecks.tests.factories import PaycheckFactory, PaystubFactory, DeductionFactory pytestmark = pytest.mark.django_db class TestPaycheckUrl: def test_paychecks(self): assert reverse("paychecks:p...
StarcoderdataPython
9764302
<gh_stars>10-100 from .dixel import Dixel from .sham_dixel import ShamDixel from .mock_dixel import MockStudy, MockSeries, MockInstance from .report import RadiologyReport, MammographyReport, LungScreeningReport, BoneAgeReport from .views import DixelView from .provenance import Provenance from .sham_maps import huid_s...
StarcoderdataPython
3226594
#!/usr/bin/env python # -*- coding: utf-8 -*- """MicroPhone & Play Sound""" from __future__ import print_function import pyaudio import wave from six.moves import queue FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 16000 CHUNK = 512 # MicrophoneStream - original code in https://goo.gl/7Xy3TT class MicrophoneStream(...
StarcoderdataPython
3208343
<filename>setup.py from setuptools import setup VERSION = "1.3.1" setup( name="Oz", version=VERSION, description="A batteries-included web framework built on Tornado", author="<NAME>", author_email="<EMAIL>", url="http://github.com/dailymuse/oz", zip_safe=False, packages=[ "oz...
StarcoderdataPython
5034665
<reponame>modichirag/21cmhod #!/usr/bin/env python3 # # Plots the power spectra and Fourier-space biases for the HI. # import numpy as np import sys, os import matplotlib.pyplot as plt from scipy.interpolate import LSQUnivariateSpline as Spline from scipy.interpolate import InterpolatedUnivariateSpline as ius from scip...
StarcoderdataPython
69303
<reponame>kkkanil/st2<filename>st2common/tests/unit/test_api_model_validation.py # Copyright 2020 The StackStorm Authors. # Copyright 2019 Extreme Networks, Inc. # # 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...
StarcoderdataPython
3257732
<gh_stars>0 # @memecian # toRegional.py # Turns text into Discord Emojis, specifically regional indicators. inputString = input("Input Letters: ") for c in inputString: if c.isalpha(): print(":regional_indicator_" + c + ":", end = "") else: print(c, end = "") input("\nPress Enter to qui...
StarcoderdataPython
4804470
<reponame>fcce-proj/zaifbot from decimal import Decimal class Tick: def __init__(self, currency_pair): self.size = Decimal(str(currency_pair.info['aux_unit_step'])) self._decimal_digits = currency_pair.info['aux_unit_point'] def truncate_price(self, price): price = Decimal(str(price))...
StarcoderdataPython
3298108
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # 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 by applicable law or...
StarcoderdataPython
3534198
import os import sys import inspect from rkd.api.inputoutput import IO from rkd.api.testing import BasicTestingCase TESTS_PATH = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) + '/../' sys.path.insert(0, TESTS_PATH) from infracheck.infracheck.config import ConfigLoader class ConfigTest(B...
StarcoderdataPython
1917112
from pyspider.core.model.mysql_base import * """ 万里牛库存sku数据的保存模块 """ class SkuInventory(Model): goods_code = CharField(max_length=50, verbose_name='商品编码') lock_size = IntegerField(default=0, verbose_name='锁定库存') quantity = IntegerField(default=0, verbose_name='数量') sku_code = CharField(max_length=50,...
StarcoderdataPython
8110276
<filename>tests/__init__.py<gh_stars>1-10 import asynctest import socket from contextlib import contextmanager class BaseCase(asynctest.TestCase): @contextmanager def socketpair(self): server_listener_conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server_listener_conn = server_...
StarcoderdataPython
11322449
<filename>learning-python-development/2-hour-python-coding-bootcamp/04_classes_and_objects.py # Classes and objects class GameCharacter: # attributes name = "" health = 100 position = 0 # initializer def __init__(self, name, position): self.name = name self.position = position ...
StarcoderdataPython
6473530
<reponame>wuemily2/csc290-tut104-mines2019<gh_stars>0 from __future__ import annotations from typing import Tuple, List from Tile import Tile from NumberTile import NumberTile class EmptyTile(Tile): """ The EmptyTile class extends the Tile class. It should have all the attributes and methods of the Tile c...
StarcoderdataPython
12827372
"""Module describing the planemo ``delete_alias`` command.""" import click from planemo import options from planemo.cli import command_function from planemo.galaxy import profiles from planemo.io import error, info try: from tabulate import tabulate except ImportError: tabulate = None # type: ignore @click...
StarcoderdataPython
6657627
<gh_stars>0 from .base_model import * from .dist_model import * from .network_basics import * from .pretrained_networks import * from .ps_util import *
StarcoderdataPython
4834265
<filename>qc2-copy-tool-firefox.py<gh_stars>1-10 #!/usr/bin/python3 import sqlite3 import urllib.request import gzip import re LOCALSTORAGE_PATH = '/home/llama/.mozilla/firefox/m16gwf0a.default/webappsstore.sqlite' def get_qc2_data(site): conn = sqlite3.connect(LOCALSTORAGE_PATH) c = conn.cursor() c.exe...
StarcoderdataPython
8034608
import flops_counter import flops_counter.nn as nn from vision import models class S3FD(nn.Module): def __init__(self): super(S3FD, self).__init__() # backbone self.vgg16 = nn.ModuleList(make_layers(vgg_cfgs['D'])) # s3fd specific self.conv_fc6 = nn.Conv2d(512, 1024, 3, 1,...
StarcoderdataPython
8134724
<reponame>aharonnovo/magma #!/usr/bin/env python3 # @generated AUTOGENERATED file. Do not Change! from dataclasses import dataclass from datetime import datetime from gql.gql.datetime_utils import DATETIME_FIELD from gql.gql.graphql_client import GraphqlClient from functools import partial from numbers import Number f...
StarcoderdataPython
243334
from math import radians, cos, sin, sqrt, radians, pow import math import colorsys from colormath.color_objects import (LCHuvColor, LCHabColor, HSLColor, HSVColor, IPTColor, sRGBColor, XYZColor, AdobeRGBColor) from colormath.color_conversions im...
StarcoderdataPython
6678225
#!/usr/bin/env python3 from aws_cdk import core from s3trigger.s3trigger_stack import S3TriggerStack app = core.App() S3TriggerStack(app, "s3trigger") app.synth()
StarcoderdataPython
3393052
""" Core control module for nimbus buddy """ import argparse import logging import unittest import nimbusdisplay import terraformhandler logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) formatter = logging.Formatter("%(asctime)s - %(name)s...
StarcoderdataPython
1776180
''' A newly designed keypad was tested, where a tester pressed a sequence of n keys, one at a time. You are given a string keysPressed of length n, where keysPressed[i] was the ith key pressed in the testing sequence, and a sorted list releaseTimes, where releaseTimes[i] was the time the ith key was released. Both a...
StarcoderdataPython
3288215
#!/usr/bin/env python3 # Copyright 2020, <NAME> # Licensed under the terms of the MIT license. See LICENSE file in project root for terms. # Ensure the device is at the "Guess for dice roll (1-6)?" prompt import binascii import serial import sys import struct if len(sys.argv) < 2: print("Usage: {} serport".form...
StarcoderdataPython
85406
# -*-coding:utf-8 -*- import numpy as np from bs4 import BeautifulSoup import random def scrapePage(retX, retY, inFile, yr, numPce, origPrc): """ 函数说明:从页面读取数据,生成retX和retY列表 Parameters: retX - 数据X retY - 数据Y inFile - HTML文件 yr - 年份 numPce - 乐高部件数目 origPrc - 原价 Returns: 无 Website: http://www.cuijiah...
StarcoderdataPython
9754809
from nms.non_maximum_suppression import non_maximum_suppression
StarcoderdataPython
3462302
<gh_stars>100-1000 """ Test that weather options can be configured both from scenario and programmatically """ import pytest from _pytest.fixtures import FixtureRequest from holodeck import HolodeckException from holodeck.environments import HolodeckEnvironment from tests.utils.captures import ( compare_rgb_senso...
StarcoderdataPython
11353834
import django.contrib.auth.views from otp_agents.forms import OTPAuthenticationForm from lemoncurry import breadcrumbs breadcrumbs.add(route='lemonauth:login', label='log in', parent='home:index') login = django.contrib.auth.views.LoginView.as_view( authentication_form=OTPAuthenticationForm, extra_context={'t...
StarcoderdataPython
1992850
<filename>applications/cdr/test2.py<gh_stars>0 from __future__ import print_function import sys, os, shutil from argparse import ArgumentParser sys.path.append("@simfempythonpath@") sys.path.append("@libpythonpath@") import mesh.geometry import tools.plot import numpy as np import simfempy import simfemcdr import tim...
StarcoderdataPython