id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3373357
<reponame>Retraces/UkraineBot /home/runner/.cache/pip/pool/dc/44/72/482de660ef3e35f01f4c398c39dd327cfb98b3c91c7aac535ca15ba590
StarcoderdataPython
96206
<gh_stars>10-100 ''' Copyright 2019 Trustees of the University of Pennsylvania 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 a...
StarcoderdataPython
3347643
<gh_stars>0 # Copyright 2014 PerfKitBenchmarker Authors. 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 requi...
StarcoderdataPython
149527
<gh_stars>0 # -*- coding: utf-8 -*- __author__ = '<NAME>' __email__ = '<EMAIL>' __version__ = '0.1.0'
StarcoderdataPython
3294077
<reponame>jdpdev/birbcam from .adjust import Adjust import numpy as np import logging class AdjustUp(Adjust): def setup(self): logging.info(f"[AdjustUp] take_over") def do_adjust(self, camera): if self._shutterFlipper.is_at_end: self.finish() return camera.shut...
StarcoderdataPython
1772849
<reponame>ashleyjsands/fishpic import requests import re import json import os from bs4 import BeautifulSoup from scrap_urls import download_image from os.path import join protocol_and_domain = "http://www.fish.gov.au" def scrape_urls(urls): species_urls = get_species_urls(urls) print("Number of species", le...
StarcoderdataPython
3371491
<filename>yocto/poky/meta/lib/oe/packagedata.py import codecs import os def packaged(pkg, d): return os.access(get_subpkgedata_fn(pkg, d) + '.packaged', os.R_OK) def read_pkgdatafile(fn): pkgdata = {} def decode(str): c = codecs.getdecoder("string_escape") return c(str)[0] if os.acce...
StarcoderdataPython
1782885
from should_be.core import BaseMixin try: from collections.abc import Container, Iterable except ImportError: # python < 3.3 from collections import Container, Iterable class ContainerMixin(BaseMixin): target_class = Container def should_include(self, target): if isinstance(target, Iterab...
StarcoderdataPython
1760058
<filename>clearml_agent/version.py<gh_stars>0 __version__ = '1.2.0rc3'
StarcoderdataPython
53660
from datasets.__local__ import implemented_datasets from datasets.mnist import MNIST_DataLoader from datasets.cifar10 import CIFAR_10_DataLoader from datasets.bedroom import Bedroom_DataLoader from datasets.toy import ToySeq_DataLoader from datasets.normal import Normal_DataLoader from datasets.adult import Adult_DataL...
StarcoderdataPython
3354352
<reponame>anbo225/docklet from intra.system import system_manager from intra.billing import billing_manager from intra.cgroup import cgroup_manager from policy.quota import * from intra.smart import smart_controller class case_handler: # [Order-by] lexicographic order # curl -L -X POST -F uuid=docklet-1-0 http://0...
StarcoderdataPython
1771390
<filename>ACM-Solution/SPCQ.py from sys import stdin,stdout def digit(n): s=0 while n: n,r=divmod(n,10);s+=r return s a,*b=map(int,stdin.buffer.readlines()) out=[] for i in b: while(i%digit(i)!=0):i+=1 out.append("%d"%i) print("\n".join(out))
StarcoderdataPython
1777740
<gh_stars>0 import json import yaml import os def json_to_yaml(file_path: str): with open(file_path,) as f: output_file_content = {} output_file = open(os.path.basename(file_path).replace(".json","")+'.yaml','w') output_file_content = json.load(f) yaml.dump(output_file_content, outp...
StarcoderdataPython
137540
import os import re import traceback from typing import List import pytz import tweepy from django.core.management.base import BaseCommand from django.db import transaction from slacker import Slacker from tweepy.cursor import ItemIterator from apps.cultivar.apple import Apple from apps.tweets.models import Tweets, L...
StarcoderdataPython
73365
<reponame>Alexhuszagh/XLDiscoverer ''' XlPy/Tools/Xic_Picking/weighting ________________________________ Tools to weight peak-picking algorithms by biophysical properties, such as correlations between different isotope patterns. :copyright: (c) 2015 The Regents of the University of California. ...
StarcoderdataPython
3399713
<filename>scripts/word2vec.py import sys from gensim.models import Word2Vec from gensim.models import KeyedVectors print("Loading model...") model = KeyedVectors.load_word2vec_format(sys.argv[1], binary=True) print("Model loaded.") k = 3 input = sys.stdin.read().splitlines() for line in input: words = line.spl...
StarcoderdataPython
3346735
from office365.runtime.client_value import ClientValue class FileCreationInformation(ClientValue): """Represents properties that can be set when creating a file by using the FileCollection.Add method.""" def __init__(self, url=None, overwrite=False, content=None): """ :type url: str ...
StarcoderdataPython
1615662
import logging import traceback from unittest import mock from .common import BuiltinTest from bfg9000.builtins import core # noqa from bfg9000 import exceptions from bfg9000.path import Path, Root from bfg9000.safe_str import safe_str, safe_format class TestCore(BuiltinTest): def test_warning(self): wi...
StarcoderdataPython
13895
# Copyright (c) 2018, NVIDIA 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: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
StarcoderdataPython
3343809
import mysql.connector import pandas as pd import pyodbc; mydb = pyodbc.connect(driver='{SQL Server}', host='rods-data-server-01.database.windows.net', database='Data-Rod-Input', user='admin-rods', password='<PASSWORD>') mycursor1 = mydb.cursor() mycursor1.execute("TRUNCATE TABLE `data_input_test`") mydb.commit() prin...
StarcoderdataPython
1680726
<gh_stars>1-10 """ compat ====== Cross-compatible functions for Python 2 and 3. Key items to import for 2/3 compatible code: * iterators: range(), map(), zip(), filter(), reduce() * lists: lrange(), lmap(), lzip(), lfilter() * unicode: u() [u"" is a syntax error in Python 3.0-3.2] * longs: long (int in Python 3) * ca...
StarcoderdataPython
3208469
<reponame>ajdillhoff/3dhpe-udd<gh_stars>1-10 import torch import torch.nn.functional as F from utils.quaternion import qmul class HandModel(torch.nn.Module): """ Layer that converts model parameters into transformation matrices and 3D joint locations.""" def __init__(self, positions, rotations, skeleton,...
StarcoderdataPython
1698692
#!/usr/bin/env python r''' https://www.hackerrank.com/challenges/two-strings/problem ''' import math import os import random import re import sys # Complete the twoStrings function below. def twoStrings_v1(s1, s2): if len(s1) == 0 or len(s2) == 0: return 'NO' cset= set() for c in s1: cset...
StarcoderdataPython
1754273
<filename>trmmlib/products.py # -*- coding: utf-8 -*- #------------------------------------------------------------------------------- # Name: products # Purpose: # # Authors: <NAME> # # Created: 2015-11-6 # Copyright: (c) <NAME> # Licence: The MIT License #------------------------------------...
StarcoderdataPython
1664899
<filename>locuspocus/locus/attrs.py class LocusAttrs: # a restricted dict interface to attributes def __init__(self, attrs=None): self._attrs = attrs def __len__(self): if self.empty: return 0 else: return len(self._attrs) def __eq__(self, other): ...
StarcoderdataPython
3277406
# -*- coding: utf-8 -*- from __future__ import division, unicode_literals import collections from . import config from . import lexers from .messages import * from .htmlhelpers import * from .widlparser.widlparser import parser ColoredText = collections.namedtuple('ColoredText', ['text', 'color']) class IDLUI(object)...
StarcoderdataPython
47333
<filename>clone_scanner.py<gh_stars>0 # -*- coding: utf-8 -*- # # Clone Scanner, version 1.3 for WeeChat version 0.3 # Latest development version: https://github.com/FiXato/weechat_scripts # # A Clone Scanner that can manually scan channels and # automatically scans joins for users on the channel # with multipl...
StarcoderdataPython
172321
<reponame>cheery/lever<filename>runtime/space/interface.py import re from rpython.rlib.objectmodel import compute_hash, specialize, always_inline from rpython.rlib import jit, rgc import space, weakref class Object: _immutable_fields_ = ['interface', 'custom_interface', 'flag', 'number', 'value', 'contents', 'data...
StarcoderdataPython
157215
import lists, multiples print "The LCM of all numbers below 10 is:\n" + str(1 * 2 * 2 * 2 * 3 * 3 * 5 * 7) print "The LCM of all the numbers below 20 is:\n" + str(1 * 2 * 2 * 2 * 2 * 3 * 3 * 5 * 7 * 11 * 13 * 17 * 19)
StarcoderdataPython
25340
# build.py import os import platform import sys from distutils.core import setup from torch.utils.ffi import create_extension extra_compile_args = ['-std=c++11', '-fPIC'] warp_ctc_path = "../build" if platform.system() == 'Darwin': lib_ext = ".dylib" else: lib_ext = ".so" if "WARP_CTC_PATH" in os.environ: ...
StarcoderdataPython
1648660
import json from util.utils import get_recursively from sizer.regression_sizer import RegressionSizer from sizer.workflow_sizer import WorkflowSizer class State: def __init__(self, name, arn, state_dict, start, end): self.name = name self.arn = arn self.state_dict = state_dict self...
StarcoderdataPython
4835498
# Generated by Django 2.0.3 on 2018-05-16 13:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0010_auto_20180509_2126'), ] operations = [ migrations.CreateModel( name='Mail', fields=[ ('i...
StarcoderdataPython
4826050
# -*- coding: utf-8 -*- # Coded in Python 3.8.7 64-Bit import random import math import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl mpl.style.use('seaborn') POPULATION_SIZE = 10 GENERATIONS = 300 CROSSOVER_RATE = 0.8 MUTATION_RATE = 0.6 NO_OF_GENES = 10 # This var is overwritten for FITNE...
StarcoderdataPython
1620764
import logging import re log = logging.getLogger('AppArgumentsParser') log.setLevel(logging.DEBUG) class AppArgumentsParser: def get_apps_list(self, input: str): return_list = [] apps_list = input.split(",") for app_range in apps_list: if "-" in app_range: if ...
StarcoderdataPython
4836275
<filename>install_scripts/images.py from __future__ import print_function def get_images(): file = open("Manifest", "r") images = {} for line in file: values = line.split() if len(values) < 2: continue key = values[0].lower() images[key] = { 'name': ...
StarcoderdataPython
3226232
from commando.conf import AutoProp, ConfigDict class TestClass(AutoProp): @AutoProp.default def source(self): return 'source' def test_auto(): t = TestClass() assert t.source == 'source' def test_override(): t = TestClass() t.source = 'source1' assert t.source == 'source1' ...
StarcoderdataPython
1726828
<filename>timingByPERank/TimingByPERank.py<gh_stars>100-1000 import datetime import numpy as np import pandas as pd import matplotlib.pyplot as plt def get_drawdown(p): """ 计算净值回撤 """ T = len(p) hmax = [p[0]] for t in range(1, T): hmax.append(np.nanmax([p[t], hmax[t - 1]])) dd = [p...
StarcoderdataPython
157292
<filename>001-100/10/10-sieve.py #!/usr/bin/env python # -*- coding: utf-8 -*- from math import sqrt, ceil num = 2000000 sevie = [True] * num # 0, 1, 2, 3, ..., 1999999 sevie[0] = False sevie[1] = False for i in range(3, num): if i & 1 == 0: sevie[i] = False # a number has at most one factor than its squ...
StarcoderdataPython
198027
<filename>fastreid/data/transforms/__init__.py<gh_stars>0 # encoding: utf-8 """ @author: sherlock @contact: <EMAIL> """ from .autoaugment import AutoAugment from .build import build_transforms from .transforms import * from .mosaic import * __all__ = [k for k in globals().keys() if not k.startswith("_")]
StarcoderdataPython
3255741
<filename>superset_patchup/version.py """Version goes here - to avoid cyclic dependencies :-(""" VERSION = (0, 2, 1) __version__ = ".".join(str(v) for v in VERSION)
StarcoderdataPython
5336
<reponame>LaudateCorpus1/oci-ansible-collection #!/usr/bin/python # Copyright (c) 2020, 2022 Oracle and/or its affiliates. # This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.tx...
StarcoderdataPython
85152
<reponame>hackerwins/polyaxon import workers from db.redis.ttl import RedisTTL from events import event_subjects from events.registry import job from events.registry.job import JOB_FAILED, JOB_SUCCEEDED from executor.handlers.base import BaseHandler from polyaxon.settings import SchedulerCeleryTasks class JobHandler...
StarcoderdataPython
123571
<reponame>JMU-CIME/CPR-Music-Backend<gh_stars>1-10 import pytest from django.test import RequestFactory from teleband.assignments.api.views import AssignmentViewSet from teleband.courses.models import Enrollment pytestmark = pytest.mark.django_db class TestAssignmentViewSet: def test_get_queryset_student(self, ...
StarcoderdataPython
4842454
import numpy as np from scipy.signal import argrelextrema import matplotlib.pyplot as plt from scipy import mean import scikits.bootstrap as bootstrap def moving_average(x, win=10): w = np.blackman(win) s = np.r_[2 * x[0] - x[win:1:-1], x, 2 * x[-1] - x[-1:-win:-1]] return np.convolve(w / w.sum(...
StarcoderdataPython
73268
<filename>problem_repair/tests.py from django.test import TestCase #!/usr/bin/env python ''' clara CLI interface ''' # Python imports import json import os import pprint import sys import traceback from ast import literal_eval # clara imports from claraa.common import parseargs, debug from claraa.feedback import F...
StarcoderdataPython
162334
# calculating the intragroup average distance, showing that is is significantly increases with age, # TRF is lower than 24-month-old AL. Make a figure # note about scaling - the metabolom matrix has the metabolites in rows (animals col), # and scaling normalizes the columns, so we need to scale the transpose o...
StarcoderdataPython
3302345
<reponame>utkarshayachit/seacas<gh_stars>0 # Copyright(C) 1999-2020 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # # Redistribution and use in source and binary forms, with or wi...
StarcoderdataPython
3246383
from engine.metric_artifact import Metric as MetricArtifact from aim.web.api.utils import unsupported_float_type def separate_select_statement(select: list) -> tuple: aim_select = [] tf_select = [] for s in select: if s.startswith('tf:'): adapter, _, name = s.partition(':') ...
StarcoderdataPython
1702682
#!/usr/bin/env python3 """This python starts the Hillview service on the machines specified in the configuration file.""" # pylint: disable=invalid-name from argparse import ArgumentParser from hillviewCommon import RemoteHost, RemoteAggregator, ClusterConfiguration, get_config def start_webserver(config): ""...
StarcoderdataPython
1733388
# Import to make requests to get the news from website import requests # Import to parse the HTML from bs4 import BeautifulSoup # Import to interact with database from database_connector import DBManager # Define a function to parse the news page website and get title and description def get_title_and_description_tup...
StarcoderdataPython
3219128
# -*- coding: utf-8 -*- # (c) 2009-2021 <NAME> and contributors; see WsgiDAV https://github.com/mar10/wsgidav # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php """ Implement the FileLikeQueue helper class. This helper class is intended to handle use cases where an incoming PUT reques...
StarcoderdataPython
152664
#!/usr/local/bin/python import re import os refsbib = open('refs.bib', 'r').read() p = re.compile('@.+{(.*),') g = p.findall(refsbib) for f in g: name = f + '.pdf' if os.path.isfile(os.path.join('./live/files/', name)): print("[OK] %s ready" % f) else: print("[--] %s not found" % f)
StarcoderdataPython
8801
<filename>read_delphin_data.py # -*- coding: utf-8 -*- """ Created on Mon Dec 6 14:51:24 2021 @author: laukkara This script is run first to fetch results data from university's network drive """ import os import pickle input_folder_for_Delphin_data = r'S:\91202_Rakfys_Mallinnus\RAMI\simulations' output_folder = ...
StarcoderdataPython
1764469
""" Here are a VAE and GAN """ from pl_bolts.models.autoencoders.basic_ae.basic_ae_module import AE from pl_bolts.models.autoencoders.basic_vae.basic_vae_module import VAE from pl_bolts.models.autoencoders.components import resnet18_encoder, resnet18_decoder from pl_bolts.models.autoencoders.components import resnet5...
StarcoderdataPython
1706633
import time import logging import fire import numpy as np from tqdm import tqdm from torch.utils.data import DataLoader import models import utils from dataset import ImageDataset logging.getLogger().setLevel(logging.INFO) def run(model_name, output_dir, dataname, data_dir='./data', batch_size=16, test_run=-1): ...
StarcoderdataPython
2990
<gh_stars>1-10 import numpy as np import random from time import time, sleep import h5py import torch import torch.nn as nn import torch.optim as optimizer import glob import os #from scipy.stats import rankdata from lstm import Model, initialize from Optim import ScheduledOptim # import _pickle as cPickle # np.set...
StarcoderdataPython
3303357
<reponame>He-Ze/Distributed-System-SYSU #! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file import os,sys,imp,types,re from waflib import Utils,Configure,Options,Logs,Errors from waflib.Tools import fc fc_compiler={'win32':['gfortran','ifort'],'darwin...
StarcoderdataPython
1693742
<gh_stars>0 import random, string def otp(): temp = [] for _ in range(6): temp.append(str(random.choice(string.digits))) return ''.join(temp)
StarcoderdataPython
22254
<reponame>zhou3968322/pytorch-CycleGAN-and-pix2pix<filename>generator/constant_aug.py # 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 # -*- c...
StarcoderdataPython
56196
"""Integration tests for the sync CLI command.""" import os.path import fixture class SyncTests(fixture.IntegrationFixture): def _assert_exists(self, output_path, exists=True, i=1): if exists: self.assertTrue(os.path.exists(os.path.join(self.output_dir, output_path)), "%s do...
StarcoderdataPython
3382677
# elements_constraints_discovery.py from __future__ import print_function import pandas as pd from tdda.constraints.pd.constraints import discover_df df = pd.read_csv('testdata/elements92.csv') constraints = discover_df(df) with open('elements92.tdda', 'w') as f: f.write(constraints.to_json()) print('Written ele...
StarcoderdataPython
49268
<filename>design.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'design.ui' # # Created by: PyQt5 UI code generator 5.14.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(s...
StarcoderdataPython
3293905
from typing import List from talon import actions, Module, speech_system mod = Module() macro = [] recording = False @mod.action_class class Actions: def macro_record(): """Begin recording a new voice command macro.""" global macro global recording macro = [] recording =...
StarcoderdataPython
1746240
from setuptools import setup version = "0.1.1" url = "https://github.com/JIC-CSB/dserve" readme = open('README.rst').read() setup( name='dserve', packages=['dserve'], version=version, description="Tool to serve a dataset over HTTP", long_description=readme, include_package_data=True, autho...
StarcoderdataPython
4827011
<filename>compyle/cuda.py """Common CUDA related functionality. """ from __future__ import print_function from pytools import Record, RecordWithoutPickling import logging from pytools.persistent_dict import KeyBuilder as KeyBuilderBase from pytools.persistent_dict import WriteOncePersistentDict from pycuda._cluda impo...
StarcoderdataPython
3382835
# # Copyright (C) 2019 <NAME> (<EMAIL>) # # 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 ...
StarcoderdataPython
83320
<reponame>kashewnuts/pipenv<filename>pipenv/vendor/vistir/compat.py # -*- coding=utf-8 -*- from __future__ import absolute_import, unicode_literals import errno import os import sys import warnings from tempfile import mkdtemp import six __all__ = [ "Path", "get_terminal_size", "finalize", "partial...
StarcoderdataPython
126109
<filename>lib/parse.py # # This module holds our parsing code for DNS messages. # import binascii import logging import struct import lib.parse_answer logger = logging.getLogger() def parseHeaderText(header): """ parseHeaderText(): Go through our parsed headers, and create text descriptions based on them. """ ...
StarcoderdataPython
86569
<reponame>amaork/raspi-peri<filename>raspi_peri/version.py version = '0.01'
StarcoderdataPython
1736432
<reponame>fujy/ROS-Project<filename>src/rbx2/rbx2_ar_tags/nodes/ar_follower.py<gh_stars>1-10 #!/usr/bin/env python """ ar_follower.py - Version 1.0 2013-08-25 Follow an AR tag published on the /ar_pose_marker topic. The /ar_pose_marker topic is published by the ar_track_alvar package Created...
StarcoderdataPython
147387
import pandas as pd import os import re import numpy as np from datetime import datetime from sklearn.decomposition import PCA # Plotting Packages import matplotlib.pyplot as plt import matplotlib.dates as mdates import matplotlib.cbook as cbook import numpy as np from mpl_toolkits.axes_grid1.inset_locator import inse...
StarcoderdataPython
4830149
<reponame>juforg/cookiecutter-flask-restful # -*- coding: utf-8 -*- # @author: songjie # @email: <EMAIL> # @date: 2020/08/25 # SJ编程规范 # 命名: # 1. 见名思意,变量的名字必须准确反映它的含义和内容 # 2. 遵循当前语言的变量命名规则 # 3. 不要对不同使用目的的变量使用同一个变量名 # 4. 同个项目不要使用不同名称表述同个东西 # 5. 函数/方法 使用动词+名词组合,其它使用名词组合 # 设计原则: # 1. KISS原则: Keep it ...
StarcoderdataPython
3343898
<reponame>robertblincoe/repo_test<gh_stars>1-10 """card_full_width""" from dash import html def card_full_width(children): """ Apply CSS classes and styles to create a card with a grey background that fits the full width of its parent container using CSS flexbox. See https://developer.mozilla.org/en-...
StarcoderdataPython
156049
<filename>setup.py #!/usr/bin/env python """SRE regex tools.""" """ Copyright 2020 <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 a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless requ...
StarcoderdataPython
1602409
<gh_stars>0 import pyowm owm = pyowm.OWM('797153f746aae22307499da4ad723468') observation = owm.weather_at_place('Almere,nl') w = observation.get_weather() print(w) wind = w.get_wind() temp = w.get_temperature('celsius') print(wind) print(temp) observation_list = owm.weather_around_coords(52.371353, 5.222124)
StarcoderdataPython
1607744
ouput = [] with open('input.txt') as file: bank = {} for line in file.readlines(): operations = list(line.split()) if len(operations) == 2: procedure, percent = operations if procedure == "INCOME": for client in bank: if bank[client] >...
StarcoderdataPython
1741912
<gh_stars>0 import pdb import time import os import subprocess import re import random import json import numpy as np import glob from tensorboard.backend.event_processing.event_accumulator import EventAccumulator import socket import argparse import threading import _thread import signal from datetime import datetime ...
StarcoderdataPython
1609588
""" Basic building blocks for generic class based views. We don't bind behaviour to http method handlers yet, which allows mixin classes to be composed in interesting ways. """ from __future__ import unicode_literals from rest_framework import status from rest_framework.response import Response from rest_framework.se...
StarcoderdataPython
1724240
<reponame>Bluenix2/easyrpc from easyrpc.proxy import EasyRpcProxy class EasyRpcProxyLogger(EasyRpcProxy): def __init__(self, *args, **kwargs): args = list(args) # override - default expects_results=True -> False - # logs do not expect return values args[8] = False super()....
StarcoderdataPython
3202351
<gh_stars>1-10 broker_url = 'amqp://guest@localhost//' timezone = 'Europe/Moscow' worker_max_tasks_per_child = 1
StarcoderdataPython
5042
import pygame import random pygame.init() clock = pygame.time.Clock() fps = 60 #game window bottom_panel = 150 screen_width = 800 screen_height = 400 + bottom_panel screen = pygame.display.set_mode((screen_width, screen_height)) pygame.display.set_caption('Battle') #define game variables current_fighter = 1 total...
StarcoderdataPython
87696
import bpy import addon_utils import importlib import sys from . utils import current_addon_exists, get_addon_name class RunAddon(bpy.types.Operator): bl_idname = "code_autocomplete.run_addon" bl_label = "Run Addon" bl_description = "Unregister, reload and register it again." bl_options = {"REGISTER"} ...
StarcoderdataPython
4834775
<filename>build/dev/zero_conf_print_service_info.py #!/usr/bin/env python3 """ Example of resolving a service with a known name """ import logging import sys from zeroconf import Zeroconf TYPE = '_http._tcp.local.' NAME = '_activity_assist' if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG) ...
StarcoderdataPython
128835
<gh_stars>1-10 #1st method sq1 = [] for x in range(10): sq1.append(x**2) print("sq1 = ", sq1) # 2nd method sq2 = [x**2 for x in range(10)] print("sq2 = ", sq2) sq3 = [(x,y) for x in [1,2,3] for y in [3,1,4] if x!=y] print("sq3 = ", sq3) vec = [-4, -2, 0, 2, 4] print("x*2", [x*2 for x in vec]) print("x if x>0",...
StarcoderdataPython
1637495
import copy class Prototype: def __init__(self): self._objects = {} def register_object(self, name, obj): self._objects[name] = obj def unregister_object(self, name): del self._objects[name] def clone(self, name, **attr): obj = copy.deepcopy(self._objects.get(name)) ...
StarcoderdataPython
141304
import os import json import time import threading import logging import torch import glob import shutil from .trial_local import TrialConnector from .thread_manager import ThreadManager from dataloop_services.plugin_utils import get_dataset_obj import dtlpy as dl from logging_utils import logginger from copy import de...
StarcoderdataPython
1768324
import turtle def draw_square(some_turtle): for i in range(1,5): some_turtle.forward(100) some_turtle.right(90) def draw_art(): window = turtle.Screen() window.bgcolor("red") #Create the turtle Brad - Draws a square brad = turtle.Turtle() brad.shape("turtle") brad.color("ye...
StarcoderdataPython
113510
import argparse import os import sys from PyQt5 import QtWidgets from .rama_analyzer import RamaAnalyzerMain def run(): p = argparse.ArgumentParser(description='Analyze Ramachandran plots of Gromacs trajectories') p.add_argument('-f', action='store', dest='XVGFILE', type=str, help='.xvg file produced by gmx...
StarcoderdataPython
1692142
<filename>multitest_transport/api/build_channel_api_test.py # Copyright 2019 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 # #...
StarcoderdataPython
164632
<gh_stars>0 # uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] # Embedded file name: T:\InGame\Gameplay\Scripts\Server\conditional_layers\conditional_layer_handlers.py # Compiled at: 2018-05-11 22:46:41 # Si...
StarcoderdataPython
150417
<reponame>LSanselme/kerod import tensorflow as tf from kerod.model.backbone.fpn import FPN def test_build_fpn(): shapes = [160, 80, 40, 20] features = [tf.zeros((1, shape, shape, 3)) for shape in shapes] pyramid = FPN()(features) assert len(pyramid) == len(shapes) + 1 for p, shape in zip(pyramid[...
StarcoderdataPython
73674
<reponame>davemus/flake8-custom-trailing-commas<gh_stars>1-10 yield (a, b) yield a, b
StarcoderdataPython
3315667
<reponame>mtasic85/routingtable __all__ = ['ProtocolCommand'] class ProtocolCommand(object): # protocol version 1.0 DEFAULT_PROTOCOL_VERSION_MAJOR = 1 DEFAULT_PROTOCOL_VERSION_MINOR = 0 # protocol message types PROTOCOL_REQ = 0 PROTOCOL_RES = 1 def __init__(self, node, protocol_major_vers...
StarcoderdataPython
67065
#!/usr/env python class Queue: def __init__(self, size=16): self.queue = [] self.size = size self.front = 0 self.rear = 0 def is_empty(self): return self.rear == 0 def is_full(self): if (self.front - self.rear + 1) == self.size: return ...
StarcoderdataPython
4818383
from logger import LogConfig from dim_endpoints import register_with_controller from server import flask_thread, enq from config import Config import signal class ProgramStop: stop = False def __init__(self): signal.signal(signal.SIGINT, self.exit_gracefully) signal.signal(signal.SIGTERM, sel...
StarcoderdataPython
1680717
import time from django.core.management.base import BaseCommand, CommandError from app.management import mail, tweet from app.models import Account from multiprocessing import Pool class Command(BaseCommand): help = 'Starts a process to get messages and route them to twitter.' def handle(self, *args, **opt...
StarcoderdataPython
173317
<filename>tests/conftest.py from pytest import fixture from datetime import datetime from dateutil.tz import tzutc @fixture() def fake_profile(): return "[test]\n" + "aws_access_key_id = AKEXAMPLE\n" + "aws_secret_access_key = SKEXAMPLE" @fixture() def fake_config(): return {"test": {"aws_access...
StarcoderdataPython
1740855
import os from shutil import rmtree from PIL import Image from .functions_web import download_image def convert_to_pdf(img_list, download_path): if len(img_list) > 0: image = img_list.pop(0) image.save(download_path, save_all=True, append_images=img_list) def download_and_convert_to_pdf(s...
StarcoderdataPython
3383316
<filename>krogon/load_cli_modules.py import sys import pkgutil def load_krogon_plugin_click_commands(root_click_group): for (_, name, _) in pkgutil.iter_modules(sys.path): if not name.startswith('krogon_'): continue plugin_name = name.replace('krogon_', '') cli_module_name = na...
StarcoderdataPython
3281349
<gh_stars>0 #!/usr/bin/env python3 """ SteamCMD API global configuration. """ # allowed HTTP methods ALLOWED_METHODS = ["GET", "HEAD", "OPTIONS"] # allowed api version ALLOWED_VERSIONS = ["v1"] # available endpoints AVAILABLE_ENDPOINTS = ["info", "version"] # file containing version VERSION_FILE = ".version"
StarcoderdataPython