id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
5052679
import sqlite3 import sys, os THIS_PATH = os.path.realpath( os.path.join(os.getcwd(), os.path.dirname(__file__))) sys.path.append(THIS_PATH) conn = sqlite3.connect(THIS_PATH + '/syncat.db') c = conn.cursor() import methods_lexicon def findallwords(string_in): """Returns a list of tuples (word, rest) where ...
StarcoderdataPython
1704121
import unittest from Frame import Frame from Game import Game class FrameTest(unittest.TestCase): def test_frame_init(self): frame = Frame() self.assertFalse(frame.is_full()) def test_invalid_pins(self): frame = Frame() self.assertRaises(Exception, frame.add_ball, 11) def ...
StarcoderdataPython
8146521
<gh_stars>10-100 from tracker.models import * for c in Contatto.objects.all(): if len( c.nota_set.all() ) > 1: print 'maggiore ', c continue try: nota = c.nota_set.all()[0] print nota.testo.encode('latin-1') if nota.testo == 'Fascia 1': c.priorita = 1 c.save() nota.testo = '...
StarcoderdataPython
8108618
<reponame>Pzzzzz5142/animal-forest-QQ-group-bot from nonebot import on_command, CommandSession, on_startup from nonebot.message import unescape import asyncio import asyncpg from datetime import datetime import nonebot import pytz from aiocqhttp.exceptions import Error as CQHttpError import yaml import os from nonebot....
StarcoderdataPython
254063
from random import random from Actuation.IVehicleActuator import IVehicleActuator from Decision.IDecisionMaker import IDecisionMaker from Vision.ICamera import ICamera class RandomMovement(IDecisionMaker): def __init__(self, vehicle_actuator: IVehicleActuator, camera: ICamera): self._vehicle_actuator = ...
StarcoderdataPython
6669052
""".""" from time import sleep from queue import Queue from threading import Thread from dearpygui import core from adheya import DPGObject from adheya.layout import Group class Label(DPGObject): def __init__(self, parent, **kw): super().__init__(parent, **kw) kw['parent'] = self.parent.guid label = kw.pop('la...
StarcoderdataPython
158826
VERSION = (0, 4, 2) def get_version(): return '%s.%s.%s' % VERSION version = get_version()
StarcoderdataPython
1715404
<filename>utils/xterm.py ANSI_RESET = "\x1b[0m" def rgb(r, g, b): """Returns a xterm256 color index that represents the specified RGB color. Each argument should be an integer in the range [0, 5].""" if r < 0 or r > 5 or g < 0 or g > 5 or b < 0 or b > 5: raise ValueError("Value out of range") ...
StarcoderdataPython
6611846
<reponame>kalekundert/autosnapgene #!/usr/bin/env python3 import pytest import autosnapgene as snap from pathlib import Path def test_getters(parse_and_write): for dna in parse_and_write('puc19_bsai_abc.dna'): assert dna.count_traces() == count_seq_blocks(dna) == 3 assert dna.trace_names == [ ...
StarcoderdataPython
4835297
# Copyright (c) 2020 Institution of Parallel and Distributed System, Shanghai Jiao Tong University # ServerlessBench is licensed under the Mulan PSL v1. # You can use this software according to the terms and conditions of the Mulan PSL v1. # You may obtain a copy of Mulan PSL v1 at: # http://license.coscl.org.cn/M...
StarcoderdataPython
371276
import types class Logger: def __init__(self, filepath=None, is_stdout=True): self._filepath = filepath self._logfile = None self._callbacks = {} self._is_stdout = is_stdout def start(self, text=''): if self._filepath != None: self._logfile = open(self._fi...
StarcoderdataPython
6523472
<reponame>LieonShelly/iOS-RelateServer<gh_stars>0 from App.Log import log_api from flask import send_from_directory, current_app @log_api.route('/get', methods=['GET']) def get_log(): file_response = send_from_directory(directory=current_app.config['BASE_DIR'], filename="output.log", as_attachment=True) return...
StarcoderdataPython
1831494
"""These calculations are for the Critical Natural Capital paper.""" #cd C:\Users\Becky\Documents\raster_calculations #conda activate py38_gdal312 import glob import sys import os import logging import multiprocessing import datetime import subprocess import raster_calculations_core from osgeo import gdal ...
StarcoderdataPython
9373
import random from otp.ai.AIBase import * from direct.distributed.ClockDelta import * from toontown.battle.BattleBase import * from toontown.battle.BattleCalculatorAI import * from toontown.toonbase.ToontownBattleGlobals import * from toontown.battle.SuitBattleGlobals import * from pandac.PandaModules import * from too...
StarcoderdataPython
287098
#!/usr/bin/env python import random class C(object): def __setattr__(self, name, value): pass def __getattr__(self, name): return random.randint(100, 200) # START OMIT c = C() c.foo = 42 print c.foo # END OMIT
StarcoderdataPython
9706357
<gh_stars>1-10 #!/usr/bin/python3 # SPDX-License-Identifier: BSD-3-Clause # # Copyright 2015 Raritan Inc. All rights reserved. import sys, time sys.path.append("pdu-python-api") from raritan.rpc import Agent, pdumodel, firmware ip = "10.0.42.2" user = "admin" pw = "<PASSWORD>" try: ip = sys.argv[1] user = s...
StarcoderdataPython
6464573
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as manimation from scipy.stats import gaussian_kde from pprint import pprint import sys import os from astropy.io import ascii from astropy.table import vstack # THIS FILE: UTILITY FUNCTIONS FOR PLOTTING! def loadChainFolder(chainfolder):...
StarcoderdataPython
4805681
# GENERATED BY KOMAND SDK - DO NOT EDIT import insightconnect_plugin_runtime import json class Component: DESCRIPTION = "Retrieve a list of software updates" class Input: MACHINE = "machine" class Output: UPDATES = "updates" class GetMissingSoftwareUpdatesInput(insightconnect_plugin_runtime....
StarcoderdataPython
11251399
<gh_stars>1-10 import os import keras.backend as K from keras.layers import Input from keras.utils import multi_gpu_model from yolov3.model import yolo_eval, yolo_body from yolov3.utils import letterbox_image, wh2xy, draw_box, nms, segmentation from timeit import default_timer as timer import numpy as np ...
StarcoderdataPython
58655
<reponame>Niveshpai/University_Login_System class Student: # Using a global base for all the available courses numReg = [] # We will initalise the student class def __init__(self, number, name, family, courses=None): if courses is None: courses = [] self.number = num...
StarcoderdataPython
3522492
__author__ = '<NAME>, <EMAIL>' from memetic import MemeticSearch class InverseMemeticSearch(MemeticSearch): """ Interleaving local search with topology search (inverse of memetic search) """ def _learnStep(self): self.switchMutations() MemeticSearch._learnStep(self) self.switchMutati...
StarcoderdataPython
6565820
<reponame>ram-nad/wildfirepy<gh_stars>0 from wildfirepy.net.util import URLOpenerWithRedirect, USGSHtmlParser from wildfirepy.coordinates.util import SinusoidalCoordinate from pathlib import Path from urllib.error import HTTPError __all__ = ['AbstractUSGSDownloader', 'ModisBurntAreaDownloader'] class AbstractUSGSDo...
StarcoderdataPython
6618393
<filename>libscampi/contrib/cms/communism/storage.py from django.core.files.storage import Storage class URLStorage(Storage): def delete(self, name): raise NotImplementedError() def exists(self, name): return True def listdir(self, path): raise NotImplementedError() def size(...
StarcoderdataPython
11273948
<filename>tests/test_httpkit.py # -*- coding: UTF-8 -*- # Copyright (C) 2012-2016 <NAME> <<EMAIL>> and contributors. # Licensed under the MIT license: http://opensource.org/licenses/mit-license from ganggu import httpkit as http from ganggu.resolvecache import smart_url import requests import json import pytest # 有时...
StarcoderdataPython
9678618
from graphics import * from sprite import Sprite import numpy as np import time win = GraphWin(width = 1024, height = 512) win.setCoords(0, 0, 1024, 512) win.setBackground("cyan3") #mySquare = Rectangle(Point(200, 200), Point(400, 400)) #mySquare.draw(win) sprit = Sprite([(200,200), (400,200), (400,400), (200, 400)],...
StarcoderdataPython
11212159
''' Code for synthesizing built-in functions. ''' from ..... import inspect from .. import ir, statics from ...runtime.currylib.prelude.math import apply_unboxed import operator as op from six.moves import range __all__ = ['synthesize_function'] def synthesize_function(*args, **kwds): ''' Synthesize a special fu...
StarcoderdataPython
6462878
""" """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import os, sys def __relative_imports(number_of_descent): file = __file__ for _ in range(number_of_descent): file = os.path.dirname(file) sys.path.append(file) sys.path.appe...
StarcoderdataPython
4969933
from tests.utils.runtest import makesuite, run from tests.utils.testcase import TestCase from tools.utils.dllreader import DllReader class DllReaderTest(TestCase): def testInit(self): sm = DllReader('tests/data/exportsymbols.dll') self.assertEquals(sm.functions, ['Func', 'Funk', 'Jazz']) ...
StarcoderdataPython
1742885
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys sys.path.append('utils') import json import numpy as np from .utils.box import * from .utils.draw import * from .utils.infrastructure import * from .utils.detbox import * def save_results(re...
StarcoderdataPython
310242
from django.db import models from django.contrib.auth.models import User class SampleModel(models.Model): ''' a model with usual fields used as a typical workflow object. ''' date = models.DateField(auto_now_add=True) text = models.CharField(max_length = 100) number = models.IntegerF...
StarcoderdataPython
6500121
from pyspark import SparkContext from pyspark.sql.types import StructType from pyspark.sql.functions import col, udf import json def requests_to_spark(p): return { "requestLine": { "method": p.method, "uri": p.url}, "headers": [{"name": name, "value": value} for name, value...
StarcoderdataPython
1945894
n, k = map(int, input().split()) b = list(map(int, bin(n)[2:])) s = sum(b) if k>n or k<s : print("NO") else : ind = 0 excess = k - s l = len(b) for i in range(l-1) : if excess >= b[i] : b[i+1] += b[i]*2 excess -= b[i] b[i] = 0 else : b...
StarcoderdataPython
5190567
from datetime import timedelta import re from math import floor from ebu_tt_live.strings import ERR_TIME_NEGATIVE, \ ERR_TIME_FRAMES_OUT_OF_RANGE, \ ERR_TIME_FRAME_IS_DROPPED from ebu_tt_live.errors import TimeNegativeError, TimeFormatError class ISMPTEtoTimedeltaConverter(object): def __init__(self): ...
StarcoderdataPython
5091242
<gh_stars>1-10 # Generated by Django 2.2.5 on 2019-10-04 11:27 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('data_process', '0011_auto_20191004_1125'), ] operations = [ migrations.AlterModelOptions( name='firstcatage', ...
StarcoderdataPython
6545848
#!/usr/bin/env python #-*- encoding: utf8 -*- import sys reload(sys) sys.setdefaultencoding('utf-8') import modules.util_kor as util class Data(): def __init__(self, entity_tracker, action_tracker): self.action_templates = action_tracker.get_action_templates() self.et = entity_tracker s...
StarcoderdataPython
6609017
<reponame>TobiaMarcucci/sos4hjb import unittest from sos4hjb.polynomials import (Variable, MonomialVector, ChebyshevVector, Polynomial) class TestChebyshevVector(unittest.TestCase): def test_call(self): x = Variable('x') y = Variable('y') z = Variable('z'...
StarcoderdataPython
3567319
<filename>algos/GLASSO/pISTA.py import numpy as np from numpy import linalg from algos.GLASSO.base import base from utils.common import np_soft_threshold from utils.GLASSO.glasso import objective_F_cholesky class pISTA(base): def __init__(self, T, N, lam, ls_iter, step_lim, init_step): super(pISTA, self)._...
StarcoderdataPython
3337995
<reponame>warrd18-meet/meet201617YL1cs-mod4 #FIX THE LINE BELOW class MyStr(str): #<-----Replace xyz-make a new class, MyStr, that inherits from str """ Build a subclass of str with some new, fun methods. """ #The first method is done for you; you must complete the second (replace). def exclaim...
StarcoderdataPython
4998749
<reponame>whtngus/chatbot_copy from utils.Preprocess import Preprocess from models.ner.NerModel import NerModel p = Preprocess(word2index_dic='../train_tools/dict/chatbot_dict.bin', userdic='../utils/user_dic.tsv') ner = NerModel(model_name='../models/ner/ner_model.h5', proprocess=p) query = '오늘 오전 13...
StarcoderdataPython
1674277
""" Test cases for codeop.py <NAME> """ import sys import unittest import warnings from test import support from test.support import warnings_helper from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT import io if support.is_jython: def unify_callables(d): for n,v in d.items(): i...
StarcoderdataPython
274393
# # 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 agreed to in writing, software # ...
StarcoderdataPython
6517779
# coding: utf-8 from zaglushka_tests import ZaglushkaAsyncHTTPTestCase class DefaultResponseTestCase(ZaglushkaAsyncHTTPTestCase): def get_zaglushka_config(self): return {} def test_default_response(self): self.assertIsDefaultResponse(self.fetch('/path')) class DefaultResponseBodyTestCase(Z...
StarcoderdataPython
5060103
# # Copyright (c) 2020 Bitdefender # SPDX-License-Identifier: Apache-2.0 # import os import sys from pybddisasm.bddisasm import * try: from termcolor import colored except: colored = None _SPACES = [ '', ' ', ' ', ' ', ' ', ' ', ' ', ' ...
StarcoderdataPython
5056077
# jsb/plugs/socket/jira.py """ jira.py - jsonbot module for performing lookups on a jira server Copyright 2011, <NAME> Special thanks to <NAME> for his phenny module; many of the ideas for this were adapted from that plugin http://inamidst.com/phenny/ """ ## jsb imports from jsb.lib.callbacks import callbacks from...
StarcoderdataPython
6646100
#REVERSE A STRING ///////////////////////////////////////////////////////////////////////// # string = '<NAME>' [::-1] # print(string) #other solutions ////////////////// #Make a function # def this_function(backwards): # return backwards[::-1] # theOtherSting = this_function('This is what the string looks like ...
StarcoderdataPython
11280159
import random import pytest from etcd3 import Client from tests.docker_cli import docker_run_etcd_main from .envs import protocol, host from .etcd_go_cli import etcdctl, NO_ETCD_SERVICE @pytest.fixture(scope='module') def client(): """ init Etcd3Client, close its connection-pool when teardown """ _,...
StarcoderdataPython
4896838
from anytree import NodeMixin, PostOrderIter, RenderTree, ContStyle __all__ = ["ScheduleTree", "NodeSection", "NodeIteration", "NodeConditional", "NodeExprs", "NodeHalo"] class ScheduleTree(NodeMixin): is_Section = False is_Iteration = False is_Conditional = False is_Exprs = False is_...
StarcoderdataPython
3282763
<reponame>toelen/beam<gh_stars>1-10 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2...
StarcoderdataPython
8171862
""" Constant variables shared among packages that constitute bedbase project """ import os SCHEMA_DIRNAME = "schemas" SCHEMAS_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), SCHEMA_DIRNAME) BED_TABLE_SCHEMA = os.path.join(SCHEMAS_PATH, "bedfiles_schema.yaml") BEDSET_TABLE_SCHEMA = os.path.join(SCHEMAS...
StarcoderdataPython
1939780
<reponame>xudongmit/Statistics-Computation import pandas as pd import numpy as np from scipy import stats from numpy.linalg import inv import matplotlib.pylab as plt import os os.chdir('e:/MIT4/6.439/pset1') # 1.2 df_gamma = pd.read_csv('data/gamma-ray.csv') df_gamma.head() lam = np.sum(df_gamma['count'])/np.sum(df_ga...
StarcoderdataPython
1777277
<gh_stars>0 import os import time from core.worker import worker, box from ppadb.client import Client from cv2 import cv2 import json import sys from tqdm import tqdm import argparse __author__ = "Paver(Zhen_Bo)" os.system('cls') def app_path(): """Returns the base application path.""" if hasattr(sys, 'froze...
StarcoderdataPython
3552173
<gh_stars>1-10 from rx.core import ObservableBase, AnonymousObservable from rx.internal.basic import identity, default_comparer def distinct_until_changed(self, key_mapper=None, comparer=None) -> ObservableBase: """Returns an observable sequence that contains only distinct contiguous elements according to the...
StarcoderdataPython
290019
""" HelpMaker: Builds help message from comments in the code. """ """ There are two types of help messages: the general help, and the specific helps to corresponding functions/commands. The general help message is the first comment in the .py file, wrapped by the triple-double-quotes. T...
StarcoderdataPython
8005128
<reponame>buildbuddy-io/rules_xcodeproj """Constants for fixture declarations.""" _FIXTURE_BASENAMES = [ "cc", "command_line", "generator", "tvos_app", ] _FIXTURE_SUFFIXES = ["bwx", "bwb"] _FIXTURE_PACKAGES = ["//test/fixtures/{}".format(b) for b in _FIXTURE_BASENAMES] FIXTURE_TARGETS = [ "{}:xc...
StarcoderdataPython
148591
<gh_stars>0 import unittest import sys sys.path.insert(1, "..") from aws_api_mock.RDS_Data_Generator import RDS_Data_Generator class test_RDS_Data_Generator(unittest.TestCase): def setUp(self): self.rds_data_generator = RDS_Data_Generator() def test_generate_return_type(self): return_dict = s...
StarcoderdataPython
6402736
import datetime import enum import pydantic import schemas.financing_statement import schemas.payment class SearchType(enum.Enum): AIRCRAFT_DOT = 'AIRCRAFT_DOT' BUSINESS_DEBTOR = 'BUSINESS_DEBTOR' INDIVIDUAL_DEBTOR = 'INDIVIDUAL_DEBTOR' MHR_NUMBER = 'MHR_NUMBER' REGISTRATION_NUMBER = 'REGISTRATI...
StarcoderdataPython
1635740
# Generated by Django 3.1.3 on 2021-08-27 05:25 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("track_history", "0002_auto_20200524_1009"), ] operations = [ migrations.AlterField( model_name="trackhistoryfullsnapshot", ...
StarcoderdataPython
5139236
<reponame>usc-isi-i2/datamart-upload from abc import ABC, abstractmethod import typing from etk.document import Document from typing import TypeVar DatasetID = TypeVar('DatasetID') # a string indicate the dataset id class PreParsedResult(object): def __init__(self, content: list, metadata: typing.List[dict] = No...
StarcoderdataPython
5084130
<filename>house-finder.py #!/usr/bin/python3 # Author: <NAME>, <NAME> from lxml import html import argparse import csv import datetime import json import requests import os import sys import unicodedata import webbrowser estate_status = {'n': 'new', 'a': 'available', 'd': 'discarded', 't': 'tainted', 'r': 'removed'} ...
StarcoderdataPython
1893879
<gh_stars>10-100 import argparse import os import re import sys from sqf.parser import parse import sqf.analyzer from sqf.exceptions import SQFParserError, SQFWarning class Writer: def __init__(self): self.strings = [] def write(self, message): self.strings.append(message) def analyze(code...
StarcoderdataPython
5074182
<filename>ChemTopicModel/topicModelGUI.py<gh_stars>10-100 # # Copyright (c) 2016, Novartis Institutes for BioMedical Research Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * R...
StarcoderdataPython
11383340
<filename>i2c.py from smbus import SMBus import time bus = SMBus(1) #address = 0x60 address = 0x40 data = [1,2,3,4,5,6,7,8] #bus.write_i2c_block_data(address, 0, data) def fun_data(): data1 = bus.write_byte_data(address, 1, 1) return data1 def bearing3599(): bear1 = bus.read_byte_data(addres...
StarcoderdataPython
9765353
<filename>.archived/snakecode/0091.py class Solution: def numDecodings(self, s: str) -> int: pw, w, pd = 0, 1, '' for d in s: pw, w, pd = w, int(int(d) > 0) * w + int(9 < int(pd + d) < 27) * pw, d return w
StarcoderdataPython
3310752
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'my_db', } } TEMPLATE_LOADERS = ( 'django.template.loaders.app_directories.Loader', 'django.template.loaders.filesystem.Loader', 'django.template.loaders.eggs.Loader', ) INSTALLED_APPS = ['softdelet...
StarcoderdataPython
6532050
<gh_stars>0 from datetime import datetime from functools import wraps try: from IPython import get_ipython except: pass import numpy as np import os import sys import traceback import time import types from warnings import warn import PyQt5.QtCore as QtCore from PyQt5.QtCore import Qt from PyQt5.QtGui import QKeySeq...
StarcoderdataPython
1702237
phone_number = { '0': [''], '1': [''], '2': ['a','b','c'], '3': ['d','e','f'], '4': ['g','h','i'], '5': ['j','k','l'], '6': ['m','n','o'], '7': ['p','q','r','s'], '8': ['t','u','v'], '9': ['w','x','y','z'] } def generate_all_possible_words(number): words = [] for c in nu...
StarcoderdataPython
77746
<reponame>lmbaeza/Crypto from os import environ from sys import stdin, stdout from math import gcd import numpy as np from sympy import Matrix class Hill: def __init__(self): self.N = 2 self.M = 2 self.MOD = 26 def pair_to_matrix(self, txt): assert len(txt) == 2 mtx = ...
StarcoderdataPython
4947156
import numpy as np import pandas as pd from sklearn.metrics import confusion_matrix, precision_recall_fscore_support from .evaluator import Evaluator class MulticlassEvaluator(Evaluator): """ Evaluator for multiclass classification. The confusion matrix may be replaced by the PyCM version (https://git...
StarcoderdataPython
283194
# -*- coding: utf-8 -*- # Copyright (c) 2015, Myme and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document from frappe import msgprint import frappe.utils from frappe.utils import cstr, flt, getdate, comma_and...
StarcoderdataPython
130833
<filename>setup.py from setuptools import setup install_requires = [ 'numpy', 'scipy' 'scikit-learn', 'pandas', 'matplotlib' ] setup( name='DeepInsight', version='0.1.0', packages=['pyDeepInsight'], url='https://github.com/alok-ai-lab/deepinsight', license='MIT', author='<N...
StarcoderdataPython
6582757
<gh_stars>0 import re from typing import List from collections import defaultdict from autobridge.Opt.Slot import Slot class DeviceBase: NAME = 'Base' CR_AREA = None CR_NUM_VERTICAL = None FPGA_PART_NAME = None def __init__(self, ddr_list=[], is_vitis_enabled=True): self.ddr_list = ddr_list self...
StarcoderdataPython
207343
# -*- coding: utf-8 -*- """ fixtures.py This module is for storing all of the relavant fixtures used in testing. """ from .fixtures_data import ( JSON15min2day, two_sites_two_params_iv, nothing_avail, mult_flags, diff_freq, startDST, endDST, ) from .fixtures_daily_dupe import daily_dupe, d...
StarcoderdataPython
1601282
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from re import sub import sublime_plugin from ..api import deviot from ..libraries.messages import Messages from ..libraries.thread_progress import ThreadProgress class DeviotCheckPioUpdatesCommand(sublime_plugin.WindowCommand): ...
StarcoderdataPython
6682468
<filename>polling_stations/apps/data_collection/management/commands/import_malvern_hills.py from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter class Command(BaseXpressDemocracyClubCsvImporter): council_id = 'E07000235' addresses_name = 'parl.2017-06-08/Version 1/Malvern Hi...
StarcoderdataPython
265987
# coding=UTF-8 from __future__ import print_function, absolute_import, division import datetime import falcon import logging import six import time from falcon import testing from freezegun import freeze_time from falconratelimit import rate_limit logger = logging.getLogger(__name__) class NoRedisResource(object):...
StarcoderdataPython
11253432
<filename>models/wide_resnet.py # network definition import math import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable # wildcard import for legacy reasons from .blocks import * def parse_options(convtype, blocktype): # legacy cmdline argument parsing if isins...
StarcoderdataPython
5003071
<filename>tests/correctness/targets/SampleBuildFile/Input/root.xpybuild.py from xpybuild.propertysupport import * from xpybuild.buildcommon import * from xpybuild.pathsets import * from xpybuild.targets.java import * from xpybuild.targets.copy import * from xpybuild.targets.archive import * # xpybuild properties are ...
StarcoderdataPython
9718010
<reponame>haideraltahan/datasets # coding=utf-8 # Copyright 2019 The TensorFlow Datasets 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/licenses/LICENS...
StarcoderdataPython
9711462
_base_ = "base.py" root = '' data = dict( samples_per_gpu=2, workers_per_gpu=2, train=dict( sup=dict( type="CocoDataset", ann_file=root + "../data/kaggle/annotations/semi_supervised/instances_train2021.${fold}@${percent}.json", img_prefix="/home/ace19/dl_data/sa...
StarcoderdataPython
379820
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module handles :ref:`catalog spectra <stsynphot-spec-atlas>`.""" # STDLIB import numbers # THIRD-PARTY import numpy as np # ASTROPY from astropy import units as u from astropy.io import fits # SYNPHOT from synphot import exceptions as synexcept...
StarcoderdataPython
1798251
def filter_list(l): 'return a new list with the strings filtered out' return [x for x in l if type(x) == type(1)]
StarcoderdataPython
5185076
<reponame>vanvibig/chatbotAL<filename>utils/conf.py __author__ = 'liuyuemaicha' import os class disc_config(object): # batch_size = 256 batch_size = 16 lr = 0.001 lr_decay = 0.9 embed_dim = 512 steps_per_checkpoint = 1 #hidden_neural_size = 128 num_layers = 2 train_dir = './disc_da...
StarcoderdataPython
4865452
# Copyright (c) 2021 zfit import tensorflow_probability as tfp import zfit_interface.variables import zfit.util.container @tfp.experimental.auto_composite_tensor() class VarSupports(tfp.experimental.AutoCompositeTensor): def __init__(self, var, *, full=None, space=None, scalar=None, vectorspace=None, binned=No...
StarcoderdataPython
3584457
<filename>abcgraph.py<gh_stars>10-100 # Copyright (c) 2015 The MITRE Corporation. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyrigh...
StarcoderdataPython
4896567
<gh_stars>1-10 from scipy.signal import butter, lfilter def butter_bandpass(lowcut, highcut, fs, order=5): """Returns a butterworth bandpass filter of the specified order and f range Source: https://stackoverflow.com/questions/30659579/calculate-energy-for-each-frequency-band-around-frequency-f-of-interest-in...
StarcoderdataPython
8175947
<reponame>eahrold/Crypt #-*- coding: utf-8 -*- # # Filevault_ServerAppDelegate.py # Filevault Server # # Created by <NAME> on 04/11/2012. # # Copyright 2012 <NAME>. # # 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 ...
StarcoderdataPython
274892
# # MLDB-1359_procedure_latest_run.py # Mich, 2016-02-05 # This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved. # import time from dateutil import parser as date_parser from mldb import mldb, MldbUnitTest, ResponseException class ProcedureLatestRunTest(MldbUnitTest): # noqa @classmethod ...
StarcoderdataPython
5157624
<filename>common/wienerseries.py import numpy as np from scipy import signal import math from .utils import nexpow2 ## TODO: Complete this class and unify all calculation in this class ## TODO: Add plotting functions to this class class Wiener_class(object): def __init__(self, gw_array, fs = None, nfft = None, np...
StarcoderdataPython
3492920
[ { 'date': '2011-01-01', 'description': 'Újév', 'locale': 'hu-HU', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2011-03-15', 'description': 'Az 1848-as forradalom ünnepe', 'locale': 'hu-HU', 'notes': '', 'regio...
StarcoderdataPython
6507490
import pytest import numpy as np import pandas as pd from study_lib.read_data import SML2010Data def test_data_01_exists(): # BUILD # OPERATE data = SML2010Data.new_data_1() # CHECK assert(data is not None) def test_data_01_table(): # BUILD # OPERATE data = SML2010Data.new_data_1() ...
StarcoderdataPython
364217
#!/usr/bin/env python def gini(list): numerator = 0 denominator = 0 N = len(list) for i in range(N): for j in range(N): numerator += abs(list[i] - list[j]) denominator += 2 * list[i] return float(numerator) / denominator debate = [31+5/60.0, 28+5/60.0, 17+56/60.0, 1...
StarcoderdataPython
4918269
<filename>Exercises/ex36_my_text_adventure.py # Designing and debugging - coding up my own game """ To-Do: - Make nope() exit back to previous method """ from sys import exit global looked_left looked_left = 0 global looked_right looked_right = 0 global inquisitive inquisitive = 0 def look_right(): print "You look...
StarcoderdataPython
11376337
<gh_stars>10-100 import json import os from datetime import datetime from ocd_backend.items.saenredam import SaenredamItem from . import ItemTestCase class SaenredamItemTestCase(ItemTestCase): def setUp(self): super(SaenredamItemTestCase, self).setUp() self.PWD = os.path.dirname(__file__) ...
StarcoderdataPython
3510646
import Pro_crescendi2 print "f1 0 4096 10 1" Pro_crescendi2.accelerando(0.5,3.7,0.4,0.01, 550) Pro_crescendi2.accelerando(5.2,11.7,1.2,0.5, 1312)
StarcoderdataPython
3300878
<reponame>sintefneodroid/vision #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "<NAME>" __doc__ = r""" Created on 07/03/2020 """ import numpy import torchvision from torchvision.models.detection.faster_rcnn import FastRCNNPredictor from torchvision.models.detection.mask_rcnn import...
StarcoderdataPython
11214708
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2018-11-27 15:23 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('wdapp', '0004_auto_20181127_0500'), ] operations = [ migrations.AddField( ...
StarcoderdataPython
271426
import asyncio import logging import sys import traceback from asyncio import AbstractEventLoop from typing import Optional, List, Dict from dacite import from_dict from TikTokLive.client.http import TikTokHTTPClient from TikTokLive.client.proxy import ProxyContainer from TikTokLive.types import AlreadyConnecting, Al...
StarcoderdataPython
3292546
""" Filename: plot_interhemispheric_heat_difference.py Author: <NAME>, <EMAIL> Description: Plot ensemble interhemispheric heat difference timeseries for OHC, hfds and rndt """ # Import general Python modules import sys, os, pdb import argparse import numpy import pandas import iris import matplotlib.pypl...
StarcoderdataPython
11203423
import torch.utils.data as data from PIL import Image import os import os.path import numpy as np import glob IMG_EXTENSIONS = [ '.jpg', '.JPG', '.jpeg', '.JPEG', '.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP', ] def is_image_file(filename): return any(filename.endswith(extension) for extension in IMG_E...
StarcoderdataPython
9751572
<filename>src/utils/boneyard/sim_score_v2.py import os import pickle import yaml import json import pandas as pd from difflib import SequenceMatcher import numpy as np from numpy import dot from numpy.linalg import norm base_dir = os.getcwd().replace('src','') cfg = yaml.full_load(open(base_dir + "/config.yml", 'r')...
StarcoderdataPython