id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1757158
<reponame>hemprakash1994hp/detox from __future__ import with_statement, print_function import sys import time import eventlet import py import pytest from eventlet.green.subprocess import Popen from textwrap import dedent as d from detox.proc import Detox from detox.cli import main as detox_main, tox_prepare pytest...
StarcoderdataPython
1751543
<filename>clashroyalecampsite_sever/settings.py """ Django settings for clashroyalecampsite_sever project. Generated by 'django-admin startproject' using Django 3.0.5. For more information on this file, see https://docs.djangoproject.com/en/3.0/topics/settings/ For the full list of settings and their values, see htt...
StarcoderdataPython
3218122
<reponame>CDL-Week2/CohortProject_2020 import tequila as tq from utility import * from tqdm.auto import tqdm # pip install tqdm from MeasurementUnitaryGenerator import MeasurementUnitaryGenerator # # Molecules to process # class quantumPES: def __init__(self): self.molecules = [] self.molecules.a...
StarcoderdataPython
1725308
import sys cmds = {} args = {} def ArrayIterator(arr): for i in arr: yield i def Cmd(cmd): def CmdDecorator(func): cmds[cmd] = func return func return CmdDecorator def run(): cmds[next(args)]() def getArg(): return next(args) args = ArrayIterator(sys.argv) next(args)
StarcoderdataPython
1657006
<filename>resolwe/flow/serializers/data.py """Resolwe data serializer.""" from rest_framework import serializers from resolwe.flow.models import Collection, Data, DescriptorSchema, Entity, Process from resolwe.rest.fields import ProjectableJSONField from .base import ResolweBaseSerializer from .collection import Coll...
StarcoderdataPython
3212470
# -*- coding: utf-8 -*- #------------------------------------------------------------------------------- # Name: test_myTGSW.py # Purpose: # # Author: <NAME> # # Created: 2022 Mar. 29 # Copyright: (c) sakamoto 2022 # Licence: <your licence> #--------------------------------------------------------...
StarcoderdataPython
4838513
<filename>Cryptogram.py import os import colorama from termcolor import colored # Replaces letters in cryptogram and records if they should be considered changed or not def replacer(old, new, changed=False, red=False): print() for i in range(len(cryptogram)): # Ensures letters of only one cat...
StarcoderdataPython
6179
from .trim import trim from .sample import sample from .sort import sort function_map = { 'trim': trim, 'sample': sample, 'sort': sort }
StarcoderdataPython
105428
__all__ = ("Command",) import json from django.apps import apps from django.core.management.base import BaseCommand class Command(BaseCommand): help = ( "fix json fields in string format" ) def fix_instance(self, instance, field): if isinstance(getattr(instance, field), str): ...
StarcoderdataPython
3255459
import dane, subprocess, time, random import _thread tab = [100,150,200,250,300,350,400,450,500,550] tab2 = [5,6,7,8,9,10,11,12,13,14,15] results_files = ['wynik_euler.txt','wynik_hamilton.txt'] results = 'wynik_part2.txt' data_files = ['dane_euler_'+str(i)+'_'+j+'.txt' for j in ['30','70'] for i in tab ] data_2 = ['d...
StarcoderdataPython
3271922
<gh_stars>0 # DROP TABLES songplay_table_drop = "DROP table IF EXISTS songplays" user_table_drop = "DROP table IF EXISTS users" song_table_drop = "DROP table IF EXISTS songs" artist_table_drop = "DROP table IF EXISTS artists" time_table_drop = "DROP table IF EXISTS time" # CREATE TABLES songplay_table_create = (""" ...
StarcoderdataPython
3214840
<reponame>KeDengMS/CNTK<gh_stars>1-10 # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== from .. import cntk_py def map_if_possible(obj...
StarcoderdataPython
3351469
<reponame>tbescherer/dbt from test.integration.base import DBTIntegrationTest, use_profile import dbt.exceptions class TestSimpleArchiveFiles(DBTIntegrationTest): NUM_ARCHIVE_MODELS = 1 @property def schema(self): return "simple_archive_004" @property def models(self): return "te...
StarcoderdataPython
3200687
<filename>dash_app/pages/vis.py import json import os import sqlite3 import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_cytoscape as cyto import dash_html_components as html import dash_table import networkx as nx import pandas as pd from OmicsIntegrator import Graph from dash.dash ...
StarcoderdataPython
3249155
<reponame>the-zebulan/CodeWars<filename>katas/incomplete/fill_in_the_gaps_in_my_timesheet.py def fill_gaps(lst): none_cnt = 0 prev = None result = [] for i, a in enumerate(lst): print 'i: {}\tprev: {}\t\ta: {}'.format(i, prev, a) if a is None: none_cnt += 1 contin...
StarcoderdataPython
3237352
def intersecting_lines(p, q): intersections = 0 for i in range(len(p)): for j in range(len(p) - i - 1): if (q[j + 1] < q[i]): intersections = intersections + 1 return intersections print(intersecting_lines([1, 2, 3], [1, 2, 3]))
StarcoderdataPython
197392
print('mixed CASE module')
StarcoderdataPython
71881
#!/usr/bin/env python3 from broker.config import env from broker.eudat.submit import submit_eudat def main(): job_yaml = env.HOME / "ebloc-broker" / "broker" / "_test" / "eudat" / "job.yaml" # job_yaml_temp = job_yaml.replace(".yaml", "_temp.yaml") # copyfile(job_yaml, job_yaml_temp) submit_eudat(jo...
StarcoderdataPython
1748102
<filename>backend/apps/dev_tools/routes.py<gh_stars>0 # ALL ROUTES BELOW ARE FOR DEVELOPMENT ONLY # THESE FUNCTIONS WILL NOT BE IN FINAL RELEASE # function to make clearing test users easier from fastapi import APIRouter, Request, Depends from apps.users.routes import credentials, token_cookie_name router = APIRouter...
StarcoderdataPython
1719884
<filename>services/web/server/src/simcore_service_webserver/remote_debug.py """ Setup remote debugger with Python Tools for Visual Studio (PTVSD) """ import logging from aiohttp import web from models_library.basic_types import BootModeEnum from servicelib.aiohttp.application_setup import ModuleCategory, app_module_s...
StarcoderdataPython
1783834
<gh_stars>1-10 import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * generator = cms.EDFilter("Pythia8GeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), ...
StarcoderdataPython
1715258
<filename>convertible_bond_news_yearly_scraper.py import os import re import sys import requests from bs4 import BeautifulSoup import pandas as pd from datetime import datetime import time today_datetime = datetime.today() TWSE_URL = 'https://mops.twse.com.tw' INDEX_URL = TWSE_URL + '/mops/web/ajax_t108sb08_1' headers...
StarcoderdataPython
148917
from collections import OrderedDict from ConvRNN import CLSTM_cell # build model # in_channels=v[0], out_channels=v[1], kernel_size=v[2], stride=v[3], padding=v[4] convlstm_encoder_params_large = [ [ OrderedDict({'conv1_leaky_1': [5, 64, 3, 1, 1]}), OrderedDict({'conv2_leaky_1': [128, 128, 3, 2, 1...
StarcoderdataPython
152967
from brainflow.board_shim import * from brainflow.exit_codes import * from brainflow.data_filter import * from brainflow.ml_model import * from brainflow.utils import *
StarcoderdataPython
1652352
<gh_stars>1-10 from django.views.generic import ListView from sortable_list.models import FavoriteColor class SortableColorListView(ListView): model = FavoriteColor paginate_by = 10 def get_template_names(self): if self.request.POST: return ['sortable_list/frags/color_list.html'] ...
StarcoderdataPython
3351915
<filename>anaconda-script.py<gh_stars>0 if __name__ == '__main__': import sys import binstar_client.scripts.cli sys.exit(binstar_client.scripts.cli.main())
StarcoderdataPython
181451
import numpy as np from numba import jit import tensorflow as tf cB = np.array((0, 0, 0), dtype=np.float32) # --------- BOUNDARY c0 = np.array((255, 255, 255), dtype=np.float32) # --- STREET c1 = np.array((0, 0, 255), dtype=np.float32) # ------- HOUSE c2 = np.array((0, 255, 255), dtype=np.float32) # ----- LOW VEGE...
StarcoderdataPython
1667502
<filename>example/persistence/fao.py from multirunnable.persistence.file.layer import BaseFao class TestFao(BaseFao): pass
StarcoderdataPython
3306001
from autograd import numpy as np class InversePower_(): def __init__(self): self.name = 'InversePower' self.phi_param_map = {'a' : 0, 'n' : 1} self.phi_bounds = ((0, None), (None, None),) def phi(self, X, *params): return 1./(params[0] * X**params[1]) def phi_init(self, li...
StarcoderdataPython
148716
<gh_stars>1-10 import taichi as ti import numpy as np ti.init(arch=ti.gpu) n = 100 celsiz = 4 res = n * celsiz x = ti.var(ti.i32, shape=(n, n)) c = ti.var(ti.i32, shape=(n, n)) img = ti.var(ti.i32, shape=(res, res)) @ti.func def count(i, j): return (x[i - 1, j] + x[i + 1, j] + x[i, j - 1] + x[i, j + 1] + ...
StarcoderdataPython
1707407
import numpy as np import pandas as pd from scipy.optimize import curve_fit import warnings import sys import matplotlib.pyplot as plt from tqdm import tqdm asteroid = sys.argv[1] d2r = np.pi / 180. r2d = 180. / np.pi def _p1(x): return np.exp(-90.56*np.square(np.tan(x/2)))*(1 - (0.986*np.sin(x))/(0.119 + 1.341*...
StarcoderdataPython
4820084
"""Engine class for running a matchup game. Handles player input and manages game state. """ import random class GameEngine(): """Game Engine. Runs the game using the game model for data and interacts with the player through the game console. Attributes: model: Data model for the game. console:...
StarcoderdataPython
1645937
import numpy as np class DualTask: def __init__(self, A: list, b: list, c: list, d_lo: list, d_hi: list): self.A: np.array = np.array(A) self.b: list = b self.c: list = c self.d_lo: np.array = np.array(d_lo) self.d_hi: np.array = np.array(d_hi) self.m, self.n = self...
StarcoderdataPython
1756883
import copy import math from dataclasses import dataclass, fields from typing import Optional, Tuple, List, NamedTuple, Union, Iterable, Dict from pathlib import Path import pickle from enum import Enum import functools from collections import Counter import logging import pandas as pd import numpy as np from .physio...
StarcoderdataPython
70232
# coding: utf-8 """ IdCheck.IO API Check identity documents OpenAPI spec version: 0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may...
StarcoderdataPython
68206
from __future__ import absolute_import import sys try: import threading except ImportError: threading = None import time from django.db import (connection, transaction, DatabaseError, Error, IntegrityError, OperationalError) from django.test import TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature...
StarcoderdataPython
77431
<filename>pic/pic_oc/itemSelect.py<gh_stars>0 import os itemlst = [] def itemSelect(lst): for i in lst: # print(i) if _extension(i) == ".JPG": itemlst.append(i) return itemlst def _extension(filepath): lst = os.path.splitext(filepath) # print(lst[-1]) return lst[-1...
StarcoderdataPython
3272972
<reponame>azadoks/aiida-core # -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
StarcoderdataPython
3376285
<reponame>ChaseKnowlden/airflow # # 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
18336
"""This algorithm implements the Wang Generalization algotithm with constraint checking This algorithm simplifies lines. It detects for each line the bends. It analyze the bend and remove the bends that are below a certain diameter. The point and lines that do not need to be simplified are still used to...
StarcoderdataPython
89705
# -------------- import pandas as pd import scipy.stats as stats import math import numpy as np import warnings warnings.filterwarnings('ignore') #Sample_Size sample_size=2000 #Z_Critical Score z_critical = stats.norm.ppf(q = 0.95) # path [File location variable] data=pd.read_csv(path) #Cod...
StarcoderdataPython
1616559
<reponame>shamanDevel/DiffDVR import sys import os sys.path.insert(0, os.getcwd()) import numpy as np import torch import os import matplotlib.pyplot as plt from matplotlib import gridspec from matplotlib.patches import Polygon import tqdm import imageio from diffdvr import Renderer, CameraOnASphere, Settings, setup...
StarcoderdataPython
77039
<gh_stars>1-10 __version__ = "0.0.0.3"
StarcoderdataPython
3244746
# Pythono3 code to rename multiple # files in a directory or folder # importing os module import os import csv # data rows of csv file fields = ['NFT Name'] rows = [] # Function to rename multiple files def main(): dirName = "/Users/ryanlazzareschi 1/Desktop/NFTs/Collection Filtered/" files = os.l...
StarcoderdataPython
3301152
from django.contrib import admin # Register your models here. from .models import tag_store, stat_store admin.site.register(tag_store) admin.site.register(stat_store)
StarcoderdataPython
3246471
<reponame>sainjusajan/django-oscar """Auto-generated file, do not edit by hand. TR metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_TR = PhoneMetadata(id='TR', country_code=None, international_prefix=None, general_desc=PhoneNumberDesc(national_number_pattern='...
StarcoderdataPython
12509
# Copyright 2018 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
StarcoderdataPython
4809349
# Copyright 2021 <NAME>. MIT licensed. from hashlib import sha3_224 from pathlib import Path import requests class WebImage: """Offers cached access to images from the web.""" def __init__(self, url, fname='shapes.jpg', temp=Path('/tmp')): self.url = url pfx = 'img' + sha3_224(url.encode())...
StarcoderdataPython
1624628
<filename>tools/run-benchmark.py import os import json import argparse import subprocess def git_revision(): return subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("utf-8").split("\n")[0] def get_branch(): return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).decode("utf-...
StarcoderdataPython
1610352
from datetime import timedelta import sys import pytest try: import shapely import shapely.geometry SHAPELY_TYPES = ( shapely.geometry.GeometryCollection, shapely.geometry.LineString, shapely.geometry.LinearRing, shapely.geometry.MultiPolygon, shapely.geometry.Poin...
StarcoderdataPython
3385488
<filename>main_gas_pipeline/formulas/natural_gas.py def density_standard(components): """ Natural gas density at standard temperature, kg/m3 :param components: (list) List of gas components. Each item is an object of class GasComponent :return: (float) The density of natural gas an standard parameters,...
StarcoderdataPython
3341400
from django.conf.urls import patterns, include, url from django.contrib import admin from rest_framework import routers from red_squirrel_api import views router = routers.DefaultRouter() router.register(r'categories', views.CategoryViewSet) urlpatterns =[ url(r'^admin/', include(admin.site.urls)), url(r'^', ...
StarcoderdataPython
3257450
"""Generate tables for operation xi on the rep 196884x of the monster Operators xi and xi**2 (with xi**3 == 1) operate on unit vectors with tags B, C, T, X as defined in mm_aux.py. We divide the 759 octads occuring as indices for tag T into three groups: TG: octad 0 ... 15, 15 grey even octads T0: octad 1...
StarcoderdataPython
98542
<reponame>ControlNet/tensorneko<filename>src/tensorneko/callback/display_metrics_callback.py from pytorch_lightning import Callback, Trainer, LightningModule class DisplayMetricsCallback(Callback): """A test callback to display the callback metrics.""" def on_validation_epoch_end(self, trainer: Trainer, pl_m...
StarcoderdataPython
129915
<filename>onnx_jax/handlers/backend/add.py import inspect from functools import partial import jax.numpy as jnp from jax import jit from onnx_jax.handlers.backend_handler import BackendHandler from onnx_jax.handlers.handler import onnx_op from onnx_jax.pb_wrapper import OnnxNode @onnx_op("Add") class Add(BackendHan...
StarcoderdataPython
1608595
<filename>setup.py from distutils.core import setup from setuptools import find_packages import os # get project description from README.md (if it exists) current_directory = os.path.dirname(os.path.abspath(__file__)) try: with open(os.path.join(current_directory, "README.md"), encoding="utf-8") as f: lon...
StarcoderdataPython
3291603
<reponame>bikramtuladhar/covid-19-procurement-explorer-admin # Generated by Django 3.1.2 on 2021-01-19 08:14 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("content", "0019_auto_20210115_1135"), ] operations = [ migrations.AlterField( ...
StarcoderdataPython
1767092
<reponame>jfennick/workflow_inference_compiler import argparse import copy from pathlib import Path from typing import Any, Dict, List, Tuple import graphviz import yaml from . import auto_gen_header from .wic_types import (GraphData, GraphReps, Json, Namespaces, NodeData, RoseTree, Tool, Tool...
StarcoderdataPython
1655854
<gh_stars>0 import unittest import win32pipe import win32file import pywintypes import winerror import threading class CurrentUserTestCase(unittest.TestCase): pipename = "\\\\.\\pipe\\python_test_pipe" def _workerThread(self, e): data = win32pipe.CallNamedPipe(self.pipename,"foo\0bar", 10...
StarcoderdataPython
49013
<filename>events/contrib/plugins/form_handlers/db_store/views.py from django.contrib.auth.decorators import login_required from events.decorators import permissions_required, SATISFY_ALL, SATISFY_ANY from .....base import ( get_form_handler_plugin_widget, # get_form_wizard_handler_plugin_widget, ) from . imp...
StarcoderdataPython
3281584
''' Rule Based Integration(RUBI) module in SymPy uses set of transformation rules to integrate an expression. All the transformation rules are compiled as a discrimination-net which helps in matching expression with the rule efficiently. Due to large number of rules, the module would normally take lot of time to load....
StarcoderdataPython
1696431
<reponame>tamslo/koala<gh_stars>0 import docker import yaml import time import datetime import threading import modules.file_utils as file_utils class Docker: def __init__(self, data_directory): self.docker_client = docker.from_env() with open("config.yml", "r") as config_file: config =...
StarcoderdataPython
3370408
<reponame>RohanMiraje/DSAwithPython class Node: def __init__(self, key): self.data = key self.left = None self.right = None def is_tree_follows_children_sum_property(root): if not root: return True if not root.left and not root.right: return True sum_ = 0 if...
StarcoderdataPython
3221869
<filename>src/prepare_refseq.py # IMPORTS import os import sys import pandas as pd import yaml # sys.path.append("/home/weber/PycharmProjects/EXOTIC/src") sys.path.append("/home/weber/PycharmProjects/EXOTIC/clean/src") pd.options.mode.chained_assignment = None # default='warn' tqdm.pandas() # YAML FILES CONFIG y...
StarcoderdataPython
3276610
<reponame>interrogator/drum<filename>drum/chambers/forms.py from django.forms.models import modelform_factory from django.forms import ValidationError from django import forms from django.conf import settings from drum.chambers.models import Chamber AUTOMOD_CHOICES = [(None, 'None')] AUTOMOD_CHOICES += [(k, v) for k, ...
StarcoderdataPython
45414
""" Root PlotPlayer Package contains all the data structures, modules and classes used by the PlotPlayer project. Public Modules: * plotplayer - Contains the PlotPlayer interface and functionality; this is the most common entry point for most usages Subpackages: * helpers - Contains various modules containi...
StarcoderdataPython
3372006
<reponame>FernandoCamousseigt/POOte from te import * from instancias import * print("Los sabores disponibles son: 1.negro , 2.verde , 3.infusión de hierbas") sabor_elegido = int(input("Elige un sabor (1 o 2 o 3): ")) print("Los formatos disponibles son: 1. 300 g, 2. 500g") formato_elegido = int(input("elig...
StarcoderdataPython
3223615
# Memorable uid import random vowel_chars = list("aeiou") consonat_chars = list("bcdfghjklmnpqrstvwxyz") def get_char(char_type, separator="-"): if char_type == "v": return random.choice(vowel_chars) if char_type == "c": return random.choice(consonat_chars) if char_type == "-": re...
StarcoderdataPython
1775415
<reponame>BAFurtado/PolicySpace2<filename>auxiliary/read_meta_json.py import os import json def read_meta(path1, path2): new_path = os.path.join(path1, path2, 'meta.json') if os.path.exists(new_path): with open(new_path, 'r') as h: out = json.load(h) a = out[0]['path'].split('\...
StarcoderdataPython
94017
<filename>stock_activities/migrations/0008_auto_20210524_0215.py # Generated by Django 3.2.3 on 2021-05-24 02:15 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('stock_activities', '0007_auto_20210522_1833'), ] operations = [ migrations....
StarcoderdataPython
3398121
''' 2017年6月1日22:53:56 “我行我素”竞赛刷票插件 主要是用于给自己队伍刷票用的 ''' import requests import json import time import re # 请求头信息 headers = { 'Accept': '*/*', 'Accept-Encoding': 'gzip', 'Accept-Language': 'zh-CN', 'Connection': 'keep-alive', 'Content-Length': '16', 'Content-Type': 'a...
StarcoderdataPython
77808
#!/usr/bin/env python3 # coding: utf-8 # File: chatbot_graph.py from question_classifier import * from question_parser import * from answer_search import * '''问答类''' class ChatBotGraph: def __init__(self): self.classifier = QuestionClassifier() self.parser = QuestionPaser() self.searche...
StarcoderdataPython
1721680
from treadmill.infra import connection connection.Connection.context.region_name = 'foobar'
StarcoderdataPython
3306292
<filename>harbor/db/models.py from datetime import datetime from typing import List, Optional, Union import sqlalchemy as sa from sqlalchemy.orm import relationship from harbor.db.base import Base from harbor.utils import trim_content class DbApartment(Base): __tablename__ = 'apartments' row_id = sa.Column...
StarcoderdataPython
1728263
<reponame>ram8647/gcb-mobilecsp # Copyright 2016 Mobile CSP Project. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
StarcoderdataPython
3300548
#!/usr/bin/env python import matplotlib.pyplot as plt from matplotlib.dates import DateFormatter, WeekdayLocator,\ DayLocator, MONDAY from matplotlib.finance import quotes_historical_yahoo_ohlc, candlestick_ohlc from matplotlib.dates import date2num import toolz.curried as tz import numpy as np def ohlc_collapse(o...
StarcoderdataPython
1717833
<gh_stars>10-100 # just ensures the source-only module built correctly, nothing fancy import rpytest.srconly def test_srconly_fn(): assert rpytest.srconly.srconly_fn(3) == 3 - 0x42
StarcoderdataPython
62703
<filename>src/config/deprecated/tos-tossim/tester.py<gh_stars>10-100 import sys from TOSSIM import * t = Tossim([]) t.runNextEvent() m = t.getNode(32) m.turnOn() t.addChannel("DEBUG", sys.stdout) while (m.isOn()==1): t.runNextEvent()
StarcoderdataPython
66413
# 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.0 (the # "License"); you may not u...
StarcoderdataPython
121575
<gh_stars>0 import numpy import lightoy.color from lightoy.effects import Effect import lightoy.params class Wavy(Effect): def init_params(self): return {'periods': lightoy.params.RandomArray(self.n_leds)} @classmethod def render(cls, x, t, t_diff, inputs, param, state): # TODO: break ou...
StarcoderdataPython
3276021
#!/usr/bin/env python # -*- coding: utf-8 -*- import gzip import pysam import logging import itertools import random as rnd from Bio import SeqIO from capture import bam def is_gzip(file): """ test if the file is gzip using the 4 first byte of the file who are characteristic of the type of file """ ...
StarcoderdataPython
1716977
<filename>mayan/apps/reviews/apps.py from django.apps import apps from django.utils.translation import ugettext_lazy as _ from mayan.apps.acls.classes import ModelPermission from mayan.apps.acls.permissions import permission_acl_edit, permission_acl_view from mayan.apps.common.apps import MayanAppConfig from mayan.app...
StarcoderdataPython
3316829
from __future__ import unicode_literals import logging from apscheduler.schedulers.background import BackgroundScheduler from datetime import datetime, timedelta from django.apps import AppConfig from django.conf import settings from monitor import check_channel def deferred_task(func): def inner_function(*a...
StarcoderdataPython
3303715
<gh_stars>0 import pyfixedwidths import pytest @pytest.fixture(scope='function', autouse=False) def sample_text1(): text = ( "1,2,3,4\n" "11,,33,44\n" ) yield text @pytest.fixture(scope='function', autouse=False) def sample_text2(): text = ( "1\t2\t3\t4\n" "11\t\t33\t...
StarcoderdataPython
1751156
# 1 πόδι = 12 ίντσες def ektelesi(): foot_number = arithmos_podion() calculation = ypologismos(foot_number) ektyposi(calculation) def arithmos_podion(): podia = int(input('Δώσε τον αριθμό ποδιών που θέλεις να υπολογίσεις σε ίντσες: ')) print() return podia def ypologismos(foot...
StarcoderdataPython
1610723
<filename>functions.py # -*- coding: utf-8 -*- """ Created on Sun Feb 17 17:52:23 2019 @author: asus """ import numpy as np import matplotlib.pylab as plt def AND(x1,x2): w1,w2,theta= 0.5,0.5,0.7 if x1*w1+x2*w2 <= theta: return 0 elif x1*w1+x2*w2 > theta: return 1 def sigmoid(x...
StarcoderdataPython
1743700
"""Random event config player.""" from mpf.core.config_player import ConfigPlayer from mpf.core.randomizer import Randomizer from mpf.core.utility_functions import Util class RandomEventPlayer(ConfigPlayer): """Plays a random event based on config.""" config_file_section = 'random_event_player' show_sec...
StarcoderdataPython
4836260
# ---------------------------------------------------------------------------- # cocos2d # Copyright (c) 2008 <NAME>, <NAME>, <NAME>, <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # *...
StarcoderdataPython
145842
<reponame>blinkace/pxp from lxml import etree from .linkbase import Linkbase from xbrl.qname import parseQName import logging from .document import Loc from urllib.parse import urldefrag from xbrl.xml import qname class LinkbaseParser: def parse(self, tree, url): linkbase = Linkbase(url) logging.i...
StarcoderdataPython
170440
<gh_stars>10-100 from decimal import Decimal import logging import logging.config from pprint import pformat import time from sqlalchemy.exc import OperationalError import config from trader.exchange.api_wrapper.exchange_api import ExchangeApi from trader.exchange.api_wrapper.noop_trader import NoopApi from trader.ex...
StarcoderdataPython
3398062
<reponame>maxcohen31/Snake<filename>my_snake.py ### SNAKE GAME MADE USING PYGAME LIBRARY ### # Inspired by: cyysu # Modified by: maxcohen31 (Emanuele) import pygame import sys import time from copy import deepcopy import random from math import sqrt from pygame import mixer class Apple: def __init__(self): ...
StarcoderdataPython
72880
import os import json import sys from tqdm import tqdm img_folder = '/opt/tiger/minist/datasets/groot_voc/JPEGImages' exist_img = os.listdir(img_folder) print('exist_img nums {}'.format(len(exist_img))) exist_img = [img[:-4] for img in exist_img] # print(exist_img[:5]) new_img_path = '/opt/tiger/minist/data_process/...
StarcoderdataPython
1714030
import numpy as np import gym import time from matplotlib import pyplot as plt import sys, os sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../../')) from fetch_cam import FetchDiscreteCamEnv import cv2 from PIL import Image import os, shutil from matplotlib.colors import hsv_to_rgb, rgb_to_h...
StarcoderdataPython
76259
<gh_stars>1-10 #!/usr/bin/python3 # coding: utf-8 import os import sys from setuptools import setup from setuptools.command.install import install VERSION = "5.0.0" with open("README.md", "r") as fh: long_description = fh.read() class VerifyVersionCommand(install): description = "verify that the git tag ma...
StarcoderdataPython
4838213
# Copyright (c) 2014 Mirantis 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 of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
StarcoderdataPython
3247101
from django.core.management.base import BaseCommand from django.utils.translation import gettext as _ from mspray.libs.ona import fetch_form_data from mspray.apps.main.utils import add_directly_observed_spraying_data from mspray.apps.main.models import DirectlyObservedSprayingForm class Command(BaseCommand): hel...
StarcoderdataPython
3269302
from textblob import TextBlob text = input(" Enter any text to translate in english ") en_blob = TextBlob(text) from_language = en_blob.detect_language() print(en_blob.translate(from_lang= from_language ,to="en"))
StarcoderdataPython
3319636
<gh_stars>0 # # Copyright (c) 2017 <NAME>. All rights reserved. # @gem('Quartz.Statement') def gem(): require_gem('Quartz.Core') @share class PoundSignComment(Object): __slots__ = (( 'comment', # Comment 'newline', # String )...
StarcoderdataPython
1616895
from django.conf.urls import url from django.contrib import messages from django.contrib.admin import ModelAdmin from django.db.models import Q from django.template.response import TemplateResponse from django.templatetags.static import static from django.urls import reverse from django.utils.translation import ugettex...
StarcoderdataPython
1603067
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from vinesF.models import video from vinesF.models import viewcounter from vinesF.models import users, Hitbck2bck, MostViewed, minihit, emails # Register your models here. admin.site.register(video) admin.site.register(v...
StarcoderdataPython