id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
15024
#!/usr/bin/env python # # This program shows how to use MPI_Alltoall. Each processor # send/rec a different random number to/from other processors. # # numpy is required import numpy from numpy import * # mpi4py module from mpi4py import MPI import sys def myquit(mes): MPI.Finalize() print(mes) ...
StarcoderdataPython
4822096
<gh_stars>10-100 """Tests for kraus_to_choi.""" import numpy as np from toqito.channels import dephasing, depolarizing from toqito.channel_ops import kraus_to_choi def test_kraus_to_choi_swap_operator(): """Choi matrix of the transpose map is the swap operator.""" kraus_1 = np.array([[1, 0], [0, 0]]) kra...
StarcoderdataPython
1667382
<filename>romeo/main.py ############################################################################### # Author: <NAME> # Contact: <EMAIL> # Summer Internship - 2016 ############################################################################### # Title: main.py # Project: Romeo Robot # Description: # - Instantiates...
StarcoderdataPython
4827228
<reponame>shiftsayan/nemo from watson_developer_cloud import NaturalLanguageUnderstandingV1 from watson_developer_cloud.natural_language_understanding_v1 import Features, EntitiesOptions, KeywordsOptions, ConceptsOptions, CategoriesOptions, EmotionOptions, MetadataOptions, RelationsOptions, SemanticRolesOptions, Sentim...
StarcoderdataPython
3366365
""" Faca uma funcao que receba a altura e o raio de um cilindro circular e retorne o volume do cilindro. O volume de um cilindro circular e calculado por meio da seguinte formula: v = pi * raio2 * altura, onde pi = 3.141592 """ from random import randint r = randint(0, 10) h = randint(0, 100) def volume(raio, altura=...
StarcoderdataPython
170302
import xdsl pfizer = xdsl.Model("Pf_March_GeNie_01-03-22.xdsl") # n1_Pfizer_dose # n2_Age_group # n3_Sex # n4_Community_transmission # n5_Vaccine_associated_myocarditis # n6_Myocarditis_background # n7_Vaccine_effectiveness_against_infection # n8_Vaccine_effectiveness_against_death # n9_Risk_of_infection_by_aget_and_...
StarcoderdataPython
4827950
<filename>ohwhale/apps.py<gh_stars>0 from django.apps import AppConfig class OhwhaleConfig(AppConfig): name = 'ohwhale'
StarcoderdataPython
1761570
<gh_stars>0 import numpy as np SIZE = 10 # Create Python's lists l1 = list(range(SIZE)) print(l1[-5:]) print(l1[-5]) a1 = np.arange(1,10) a2 = a1.reshape(3,3) print(a2) print(a2[:,1])
StarcoderdataPython
186648
factor = int(input()) count = int(input()) list = [] counter = factor for _ in range(count): list.append(counter) counter += factor print(list)
StarcoderdataPython
3284686
#! /usr/bin/env python # $Id: test_writer_aux.py 5174 2007-05-31 00:01:52Z wiemann $ # Author: <NAME> <<EMAIL>> # Copyright: This module has been placed in the public domain. """ Test module for writer_aux transforms. """ from __init__ import DocutilsTestSupport # must be imported before docutils from docutils.trans...
StarcoderdataPython
3375513
<gh_stars>1-10 #!/usr/bin/env import math import bisect import curves import pyomo.environ as p import pandas as pd import scipy as sp from ropo import ROPO class Deterministic(): """ Drill-scheduling model. Args: geology: Geology object drillstring: DrillString object cost_maint:...
StarcoderdataPython
130984
from core import Core class Tx: def __init__(self): self.core = Core() tx = Tx()
StarcoderdataPython
109673
"""All Lena exceptions are subclasses of :exc:`LenaException` and corresponding Python exceptions (if they exist). """ # pylint: disable=missing-docstring # Most Exceptions here are familiar to Python programmers # and are self-explanatory. class LenaException(Exception): """Base class for all Lena exceptions.""...
StarcoderdataPython
1656883
<gh_stars>1-10 # encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Page' db.create_table('pages_page', ( ('id', self.gf('django.db...
StarcoderdataPython
1772949
import os def create_file(): path = os.getcwd() + "/16" file_name = "pythontrap.txt" #creating and write file. with open(os.path.join(path, file_name), "w") as fl: fl.write("16 tips python trap") fl.close() # print before rename print(os.listdir(path)) #rename file ...
StarcoderdataPython
3242195
<filename>configuration.py<gh_stars>0 config = { "department": "PPD", # Capitalisation matters # SHE spreadsheet columns we are interested in to select and identify staff "she_numColumns" : 30, # Minimum number of visible columns to be a valid row "she_forename" : 4, "she_lastname" : 3, "she_d...
StarcoderdataPython
42881
<filename>crystal_toolkit/apps/main.py import logging import os from ast import literal_eval from random import choice from time import time from typing import Optional from urllib import parse from uuid import uuid4 import dash import sentry_sdk from dash.dependencies import Input, Output, State from dash.exceptions ...
StarcoderdataPython
42904
## # # File: testCcdcSearch.py # Author: <NAME> # Date: 13-Dec-2020 # Version: 0.001 # # Updated: # ## """ Test cases for chemical component search against the CCDC local Python API - """ __docformat__ = "restructuredtext en" __author__ = "<NAME>" __email__ = "<EMAIL>" __license__ = "Apache 2.0" import glob im...
StarcoderdataPython
3238804
<gh_stars>1-10 from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^logout/$', "account.views.logout" , {}, 'bundestagger-account-logout'), (r'^username/$', "account.views.change_username" , {}, 'bundestagger-account-change_username'), )
StarcoderdataPython
3305757
from .parser import LogParser # noqa
StarcoderdataPython
52589
<gh_stars>0 # 04. Forum Topics line = input() forum_dict = {} # def unique(sequence): # seen = set() # return [x for x in sequence if not(x in seen or seen.add(x))] while not line == "filter": words = line.split(" -> ") topic = words[0] hashtags = words[1].split(", ") if topic not in forum_di...
StarcoderdataPython
4834013
# Copyright 2016-2021, Optimizely # 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, s...
StarcoderdataPython
1642075
def insertion_sort(a): print "Insertion Sort" for i in range (1,len(a)): c=a[i] k=i-1 while (k>=0) and (c<=a[k]) : a[k+1] = a[k] k=k-1 a[k+1] = c print a def selection_sort(b): print "Selection SOrt" for i in range(0,len(...
StarcoderdataPython
1686085
<reponame>kecorbin/genielibs<gh_stars>0 # # DeviceAttributes +---------+ VrfAttributes +--------+ NeighborAttributes # + # + # +---------+ InterfaceAttributes # # from abc import ABC import warnings import re from genie.conf.base.attributes import UnsupportedAttribut...
StarcoderdataPython
3224077
<filename>happi/utils.py """ Basic module utilities """ import keyword import logging logger = logging.getLogger(__name__) def create_alias(name): """ Clean an alias to be an acceptable Python variable """ return name.replace(' ', '_').replace('.', '_').lower() def get_happi_entry_value(entry, key,...
StarcoderdataPython
3278356
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model from swagger_server import util class ExactMatchResponse(Model): """NOTE: This class is auto generated by the ...
StarcoderdataPython
1796446
from unittest import TestCase from .max_profit import Solution class TestMaxProfit(TestCase): def test_with_input_max_profit_exists(self): result = Solution().max_profit([7,1,5,3,6,4]) self.assertEqual(result, 5) def test_with_another_input(self): result = Solution().max_profit([2, 4,...
StarcoderdataPython
4807707
import time import torch import numpy as np import pandas as pd import os import joblib from torch.utils.data import DataLoader from importlib import import_module from src.utils import config from src.utils.tools import create_logger from src.utils.dictionary import Dictionary from train_helper import train, init_netw...
StarcoderdataPython
1613155
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from .. import _utilities, _tables from ...
StarcoderdataPython
186422
"""Tests for rhasspyhermes.dialogue""" from rhasspyhermes.dialogue import ( DialogueContinueSession, DialogueEndSession, DialogueIntentNotRecognized, DialogueSessionEnded, DialogueSessionQueued, DialogueSessionStarted, DialogueStartSession, ) def test_dialogue_continue_session(): """Te...
StarcoderdataPython
171272
import pytest from tests.utils import make_fresh_testbed @pytest.fixture def testbed(): return make_fresh_testbed()
StarcoderdataPython
1789300
<reponame>USGS-WiM/FlowDirectionTraceServices #------------------------------------------------------------------------------ #----- FlowDirectionTrace.py -------------------------------------------------- #------------------------------------------------------------------------------ # # copyright: 2017 WiM - USGS #...
StarcoderdataPython
1646443
<filename>paper-code/tensorflow_src/tools/en_text_to_phoneme.py def text_to_sequence(texts, max_len: int): """ 专用于phoneme的text转序列的方法 :param texts: 文本序列列表 :param max_len: 文本序列最大长度 :return: 转换后的id序列 """ dict_set, _ = get_phoneme_dict_symbols() sequences = [] for text in texts: ...
StarcoderdataPython
66820
#!/usr/bin/env python2 # # Copyright 2015 Google Inc. 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 required...
StarcoderdataPython
61521
<filename>ignis/entities/vent.py<gh_stars>0 """Manage vent entities""" from dataclasses import dataclass from .common import Entity, EntityStore class Vent(Entity): """Entity for all flair vents""" def __init__(self, token): entity_type = "vents" self.vents: list[VentStore] = [] supe...
StarcoderdataPython
4804285
# http://ajax.googleapis.com/ajax/services/search/web?vv=1.0&q= import urllib import json exampleSearch = 'geographic sentimetn analysis!@#$' encoded = urllib.quote(exampleSearch) #print encoded rawData = urllib.urlopen('http://ajax.googleapis.com/ajax/services/search/web?vv=1.0&q='+ encoded).read() jsonData = jso...
StarcoderdataPython
3250431
<reponame>auho/python-ETL class SplitToWordsRule: def __init__(self, sep): self._sep = sep def main(self): pass def split(self, content): """ :param content: :return: [,...] """ all_tag_list = [] if not content: return all_tag_li...
StarcoderdataPython
1688442
<filename>epi_judge_python/graph_clone.py<gh_stars>0 import collections from typing import List from test_framework import generic_test from test_framework.test_failure import TestFailure class GraphVertex: def __init__(self, label: int) -> None: self.label = label self.edges: List['GraphVertex']...
StarcoderdataPython
179453
<filename>edengine/threadRun.py """ Copyright 2019, Institute e-Austria, Timisoara, Romania http://www.ieat.ro/ Developers: * <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: ...
StarcoderdataPython
3376242
<gh_stars>0 #!/usr/bin/env python3 """ Author : treevooor <<EMAIL>> Date : 2021-11-20 Purpose: Bottles of beer song """ import argparse # -------------------------------------------------- def get_args(): """Get command-line arguments""" parser = argparse.ArgumentParser( description='Bottles of be...
StarcoderdataPython
3394210
from datetime import datetime, timezone import re import sys import django from mongo.objectid import ObjectId from mur.commonmark import commonmark, version as cmark_version import requests def test_python3(): assert sys.version_info.major == 3 and sys.version_info.minor >= 6 def test_objectid(): objectid...
StarcoderdataPython
4814384
<reponame>pip-services-infrastructure/pip-clients-logging-python #!/usr/bin/python import pytest pytest.main()
StarcoderdataPython
1606007
<reponame>antonarnaudov/python-tigers-2021-02 # print(type(ll)) # print(len(ll)) # # print(ll) # # result = 0 # ll2 = [1, 2, 3, 4, 5] # # for item in ll2: # result += item # print(item) # # print(result) # ll = [1, 2, 3, 4, 5, 'Baba', 'Dqdo', True, False, 2.23] # List # result = 0 # # for item in ll + ll2:...
StarcoderdataPython
1555
resource ='human ad machime' class DimProcess: def __init__( self, *kwargs, process_key: int, module: str, type: str, step: str, sub_step: str, resource: str = 'human', ): def step(self): return ['qc', 'auto_qc', 'apr_qc', 'ke...
StarcoderdataPython
1777267
<filename>backend/tests/test_api.py import pytest import requests TEST_URL = 'http://localhost:5000' _token = None @pytest.fixture def token(): global _token if _token: return _token ret = requests.post( TEST_URL + '/login', data='{"email":"<EMAIL>","password":"password"}', ...
StarcoderdataPython
3348711
"""Fancy style for fonts with Powerline symbols.""" from prompt_toolkit.token import Token style = { Token.Tabs.Tab: '#bbb', Token.Tabs.Tab.Text: 'bg:#bbb #222', Token.Tabs.Tab.Active: '#0bb', Token.Tabs.Tab.Active.Text: 'bg:#0bb #222', } def _tab_template(tab_style): """...
StarcoderdataPython
1765012
"""7-4. Pizza Toppings: Write a loop that prompts the user to enter a series of pizza toppings until they enter a 'quit' value. As they enter each topping, print a message saying you’ll add that topping to their pizza.""" cadena = "\n¿Que relleno te gustaria en tu pizza?" cadena += "\nPresione enter cuando haya termin...
StarcoderdataPython
1681876
import yaml import argparse import logging from datetime import datetime from os import mkdir from os.path import join, dirname, abspath from src.utils.factory import EnvDict, ModelDict, MemoryDict, AgentDict from src.utils.helpers import plot_lstm_grad_over_steps, plot_max_abs_q, plot_holistic_measure, save_data log...
StarcoderdataPython
3389325
<reponame>robinstauntoncollins/jobs import os from flask import Flask, jsonify, abort, make_response, request, url_for, abort from flask_migrate import Migrate from flask_httpauth import HTTPBasicAuth from .models import db from .errors import InvalidUsage from .auth import auth from api.v1 import api_v1_bp, API_VER...
StarcoderdataPython
3211693
## Fruitloop2 """ Repeat Fruitloop1, but for each fruit name that you display, on the next line display the number of periods that is equal to the number of the index of the array. Example: "Banana" . //one period "Orange" .. //two periods etc. """ """ We'll follow the same structure for this question as the last, bu...
StarcoderdataPython
3368820
import datetime import sqlalchemy import sqlalchemy.orm as orm from pypi_org.data.modelbase import SqlAlchemyBase class Release(SqlAlchemyBase): __tablename__ = 'releases' id: int = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True, autoincrement=True) major_ver: int = sqlalchemy.Column(sqlalchemy....
StarcoderdataPython
3333324
import moderngl import numpy as np import math import sys from PIL import Image start_image = Image.open(sys.argv[1]) start_width, start_height = start_image.size; # Assuming radius in 1 unit # width is equivlaent to 2*PI unit, so height of image is *height * 2 * PI) / width # cylinder_height = (start_height * 2.0...
StarcoderdataPython
3290283
<filename>acceptance_tests/lib/Helm.py<gh_stars>10-100 import os import common class Helm(common.CommandRunner): def set_helm_version(self, version): version = str(version) if version == '2': common.HELM_EXE = 'HELM_HOME=%s helm2' % os.getenv('TEST_V2_HELM_HOME', '') elif versi...
StarcoderdataPython
3236084
<reponame>miserableoracle/Neutro-Blockchain-Prototype<filename>neutro/src/config/config_util.py """this file has some handy methods for working with configuration""" from .config import hosts from neutro.src.p2p.peer import Peer def get_peer_list(): return [Peer(host) for host in hosts]
StarcoderdataPython
3323429
<filename>generators/fm_generator.py<gh_stars>10-100 import numpy as np from synthplayer.oscillators import * from synthplayer.synth import * from generators.generator import * from generators.parameters import freq_range, param_range class SynthplayerGenerator(SoundGenerator): def do_generate( self, ...
StarcoderdataPython
85059
<filename>tests/test_discrete_benchmarks_c.py """ filename : discrete_benchmark_tests.py title : Discrete Benchmark Tests For the LeapFrog Optimizer author : <NAME> email : <EMAIL> about: Contains discrete optimization benchmark tests for the LeapFrog Optimizer. Designed to be u...
StarcoderdataPython
3274280
<gh_stars>0 import argparse class Argparser(): """Argparser class Args: model name Returns: argparser for model corresponding to model name """ def __init__(self, model_name): self.model_name = model_name self.parser = argparse.ArgumentParser() ...
StarcoderdataPython
183936
<filename>ipb_homework_checker/tests/test_tools.py #!/usr/bin/python3 """Test the tools.""" import unittest from os import path from ipb_homework_checker import tools from ipb_homework_checker.schema_tags import OutputTags class TestTools(unittest.TestCase): """Test the checker.""" def test_pkg_name(self):...
StarcoderdataPython
3250357
import argparse import asyncio import getpass import os import socket import boto3 from aiohttp import web from cloudvisor.cleaner import Cleaner from cloudvisor.ec2_manager import EC2Manager from utils import anylogging, heartbeat, ip from cloudvisor.webapp import rest from cloudvisor.ec2_wrapper import EC2Wrapper ...
StarcoderdataPython
197539
<filename>TF_GPT/setup.py from setuptools import setup setup( name='TF2_GPT-2', version='v_1.0', packages=['utils', 'layers'], url='https://github.com/Xhs753/TF2_GPT-2', license='MIT', author='watermelon', description='One NLP AI', install_requires=['click', 'tqdm', 'tensorflow', 'nump...
StarcoderdataPython
4503
import os from mcstasscript.instr_reader.control import InstrumentReader from mcstasscript.interface.instr import McStas_instr class McStas_file: """ Reader of McStas files, can add to an existing McStasScript instrument instance or create a corresponding McStasScript python file. Methods ---...
StarcoderdataPython
114898
from django.urls import include, path, re_path from django.views.generic import RedirectView from django.urls import reverse_lazy from django.http import QueryDict from rest_framework.urlpatterns import format_suffix_patterns from django_cas_ng.views import login as cas_login, logout as cas_logout, callback as cas_cal...
StarcoderdataPython
3357662
#!/usr/bin/env python3 """ Author : chunanliu Date : 2019-02-25 Purpose: Rock the Casbah """ import argparse import sys import os from Bio import SeqIO # -------------------------------------------------- def get_args(): """get command-line arguments""" parser = argparse.ArgumentParser( description=...
StarcoderdataPython
3237608
#!/usr/bin/env python # # From <NAME>, <EMAIL> # RCMRD Nairobi, Kenya # # Here is the link where you can get the original hdfs and the resulting tif files # http://172.16.31.10/frostmaps/ # # We do not have arcpy so we will do this manually (Pat Cappelaere) # import time import datetime import glob,os, fnmatch from ...
StarcoderdataPython
123372
from django.db.models.signals import post_save from .models import Demand, DemandHub from profiles.models import ProfileHub from hubs.models import HubGeolocation from utils.utils import coordinates_calculation, distance_calculation def demand_created_or_updated(sender, update_fields, **kwargs): instance = kwarg...
StarcoderdataPython
3316353
from numpy import allclose from src import Face def test_default_coefficients(): assert Face().coefficients.size == 0 def test_default_scale(): assert allclose(Face().scale, (1, 1, 1)) def test_default_position(): assert allclose(Face().position, (0, 0, 1)) def test_default_position_cartesian(): ...
StarcoderdataPython
4840871
import sys sys.path.insert(0, '../') import numpy as np from jax.nn import softplus from jax.experimental import optimizers import matplotlib.pyplot as plt import time from sde_gp import SDEGP import approximate_inference as approx_inf import priors import likelihoods pi = 3.141592653589793 print('generating some data...
StarcoderdataPython
3207055
<filename>pyflu/setuptools/versioning.py from pyflu.setuptools.base import CommandBase from pyflu.modules import deep_import from pyflu.command import run_script import os from os.path import join import tarfile import tempfile import shutil import re class VersionCommandBase(CommandBase): """ Base class for ...
StarcoderdataPython
3229482
#!/usr/bin/python3 # -*- coding: UTF-8 -*- import os import sys import getopt filter = ['.md'] def show_usages(): usage = ''' Usage: convert markdown file(s) to pdf file. -h, --help print help message -d, --src-dir the directory where markdown file(s) will load -i, --input-files specify inp...
StarcoderdataPython
154440
import argparse import deepspeed import torch.nn as nn import torch.nn.functional as F import torch import torchvision dataset_dir = r"test_frames" parser = argparse.ArgumentParser() parser.add_argument('deepspeed_config') args = parser.parse_args() class Decoder(nn.Module): def __init__(self, dim, depth=6, ...
StarcoderdataPython
1759351
<reponame>mesenev/debatesvl_wiki from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include from tabmaker_wiki import settings urlpatterns = [ path('admin/', admin.site.urls), path('notifications/', include('django_nyt.urls')), path('', include('wiki....
StarcoderdataPython
124105
#!/usr/bin/env python3 ''' Check if FASTQ input file is in valid format ''' import sys, logging, re from common_tools.gzip_opener import * from common_tools.exception_logger import * def description(): ''' Returns top-level docstring. Useful for providing descriptions to sub-parsers after importin...
StarcoderdataPython
1675644
""" Sweep one tone across its filter bank bin. """ import time import numpy as np from kid_readout.roach import instantiate, analog from kid_readout.measurement import acquire from kid_readout.equipment import hardware acquire.show_settings() acquire.show_git_status() logger = acquire.get_script_logger(__file__) # ...
StarcoderdataPython
1748456
#!/usr/bin/env python import sys from overdub.main import main sys.exit(main())
StarcoderdataPython
3314652
<filename>CodeSignal/LinkedLists/ReverseNodesInKGroups.py ''' Note: Your solution should have O(n) time complexity, where n is the number of elements in l, and O(1) additional space complexity, since this is what you would be asked to accomplish in an interview. Given a linked list l, reverse its nodes k at a time and...
StarcoderdataPython
54038
import numpy as np import matplotlib.pyplot as plt #%matplotlib inline import caffe caffe_root= '../' import os,sys os.chdir(caffe_root) sys.path.insert(0,caffe_root+'python') sys.path.append('usr/local/lib/python2.7/site-packages/') im = caffe.io.load_image('examples/images/cat.jpg') print im.shape plt.imshow(im) plt....
StarcoderdataPython
1695331
<reponame>loftwah/Daily-Coding-Problem """This problem was asked by Palantir. The ancient Egyptians used to express fractions as a sum of several terms where each numerator is one. For example, 4 / 13 can be represented as 1 / 4 + 1 / 18 + 1 / 468. Create an algorithm to turn an ordinary fraction a / b, where a < b,...
StarcoderdataPython
1718988
<reponame>ServerCetin/hello_python3<gh_stars>0 ''' pandas is high level data manipulation tool built in numpy dataframe ''' import pandas as pd dict = { "country": ["Brazil", "Russia", "India", "China", "South Africa"], "capital": ["Brasilia", "Moscow", "New Delhi", "Beijing", "Pretoria"], "ar...
StarcoderdataPython
179272
VERSION = '0.0.1' DIR_KIND = { 'cache': {'search': '__pycache__', 'help': 'Delete the pycache folders'}, 'egg': {'search': 'egg-info', 'help': 'Delete the egg folders'}, } FILE_KIND = { 'pyc': {'search': '.pyc', 'help': 'Delete the pyc files'}, }
StarcoderdataPython
3255496
<reponame>jvfe/music_exp<gh_stars>0 var.chords = var([2, 6, 4, (4, 8)], 4) # Lets make some waves n1 >> noise(P(PSine(32), PSine(12), PSine(28), PSine(17)*.7), dur=8, amp=P(.05,.15), delay=P(PRange(5)/5)) z1 >> space(P[-6, -3, -4], amp=0.3, dur=8, delay=0.5) g1 >> gong([2, 4], dur=4, delay=P(PRange(5)...
StarcoderdataPython
3343016
# -*- coding: utf-8 -*- # @Time : 2021/2/26 8:24 # @File : 0226豆瓣爬虫.py # @Software: PyCharm # @Description: 豆瓣250爬虫 # 导入爬虫需要的库 import requests from bs4 import BeautifulSoup # 设置翻页的初始变量 start=0 for n in range(0,10): # 伪装请求头 headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit...
StarcoderdataPython
27747
from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, cast import kubernetes import dagster._check as check from dagster.config.validate import process_config from dagster.core.errors import DagsterInvalidConfigError from dagster.core.storage.pipeline_run import PipelineRun from dagster.core.utils ...
StarcoderdataPython
3309777
<reponame>iten-engineering/python # ============================================================================= # Python examples - data science library scipy # ============================================================================= # Scipy ist eine Sammlung von mathematischen Funktionen und Algorithmen # - ba...
StarcoderdataPython
1694039
from waflib import Utils, Task, Options, Logs, Errors from waflib.TaskGen import before_method, after_method, feature from waflib.Tools import ccroot import os.path ccroot.USELIB_VARS['msbuild'] = set(['CSFLAGS']) def configure(conf): conf.find_program('msbuild') msbuild_fmt = '''<?xml version="1.0" encod...
StarcoderdataPython
1730723
#Imports try: import urllib.request as urllib2 except ImportError: import urllib2 import json from dateutil import parser from datetime import date import time from Classes import Play import pickle class Sports_API(object): """Does the interface with the """ def __init__(self, access, version): ...
StarcoderdataPython
3388679
from unittest import mock import contexts class WhenCatchingAnException: def given_a_function_that_throws_an_exception(self): self.thrown = ValueError("test exception") def throwing_function(a, b, c, d=[]): self.call_args = (a, b, c, d) raise self.thrown self.throw...
StarcoderdataPython
4835269
import pandas as pd fact_app_df = pd.read_csv('app_anlystics_1.csv', encoding='utf-8') dim_app_df = pd.read_csv('dim_app.csv', encoding='cp936') dim_genders_df = pd.read_csv('dim_gender.csv', encoding='cp936') # print(dim_genders_df) dim_province_df = pd.read_csv('dim_province.csv', encoding='cp936', ...
StarcoderdataPython
1676675
import pytest from hysynth.utils.hybrid_system import HybridSystemBase from hysynth.utils.hybrid_system.library import construct_variable_name as get_var @pytest.fixture() def hs_loc_edge_3var(): # initialize hs = HybridSystemBase("Mock-Tester", [get_var(1), get_var(2), get_var(3)]) # add locations ...
StarcoderdataPython
4825506
#!/usr/bin/env python from datetime import datetime from os.path import isdir, basename from os import mkdir import os import subprocess def create_uri_filename_from_options(pipeline_name : str) -> str: return os.path.abspath(os.path.join(os.curdir, pipeline_name + "_uri")) # FIXME huge hack around not being abl...
StarcoderdataPython
3229318
#! /usr/bin/env python # -*- coding: utf-8 -*- """Plotting Module Functions for performing tasks related to matplotlib pyplot library. .. moduleauthor:: <NAME> <<EMAIL>> """ import os.path as osp from typing import Union import matplotlib.pyplot as plt import numpy as np def axis_title(title: str, units: Union[s...
StarcoderdataPython
1634154
<reponame>tpi12jwe/garageofcode import os from collections import Counter, defaultdict, deque import numpy as np import matplotlib.pyplot as plt splitter = " " ref_splitter = "_" alphabet = "abcdefghijklmnopqrstuvwxyzåäö" alphabet = alphabet + alphabet.upper() #enc_alphabet = "abcdefghijklmnopqrstuvwxyz" #enc_alphab...
StarcoderdataPython
3230284
# Arquivo utilizado até a aula 3, quando então passamos a utilizar a classe # ExtratorURL no arquivo extrator_url.py url = "bytebank.com/cambio?quantidade=100&moedaOrigem=real&moedaDestino=dolar" # Sanitização da URL url = url.strip() # Validação da URL if url == "": raise ValueError("A URL está vazia") # Separa...
StarcoderdataPython
4813932
<filename>_converter.py<gh_stars>1-10 import datetime import xml.etree.ElementTree as et from random import randint # _converter.py - this module handles encoding a chord progression into an xml file. OCTAVES = {"A" : (2,3), "B" : (2,3), "C" : (3,4), "D" : (3,4), "E" : (3,...
StarcoderdataPython
39991
<reponame>xuyanbo03/lab # Copyright 2018 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program ...
StarcoderdataPython
3223014
<gh_stars>0 from .models import Cadres, Teacher, Curriculum from django.contrib import admin @admin.register(Cadres) class CadresAdmin(admin.ModelAdmin): def save_model(self, request, obj, form, change): if change: user = request.user.username name = self.model.objects.get(pk=obj....
StarcoderdataPython
1641755
import unittest from equipment.framework.Jobs.AbstractJob import AbstractJob from equipment.framework.tests.TestCase import TestCase from equipment.framework.helpers import app class AbstractJobTest(TestCase): def test_dispatch(self): class TestJob(AbstractJob): pass self.assertIsNone...
StarcoderdataPython
21847
from gym.envs.registration import register register( id='highway-v0', entry_point='highway_env.envs:HighwayEnv', ) register( id='highway-continuous-v0', entry_point='highway_env.envs:HighwayEnvCon', ) register( id='highway-continuous-intrinsic-rew-v0', entry_point='highway_env.envs:HighwayEnv...
StarcoderdataPython
1773257
#!/usr/local/bin python from tinyrsa.utils import rsa_encryption e_arr = [] def encrypt_cipher(message): for i in message: ne = ord(i) e_arr.append(rsa_encryption(ne)) print(chr(rsa_encryption(ne)), end='') print() return e_arr
StarcoderdataPython
3242412
<reponame>GuillermoPuebla/same_different_paper<gh_stars>0 import io import numpy as np import tensorflow as tf from PIL import Image, ImageDraw def translate_question(q): if len(q) != 11: return 'Not a proper question' colors = ['red', 'blue', 'green', 'orange', 'yellow', 'gray'] idx= np.argwhere(q...
StarcoderdataPython
48603
<filename>cli/tests/test_polyflow/test_io.py #!/usr/bin/python # # Copyright 2019 Polyaxon, 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/LICENS...
StarcoderdataPython