id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
31173
import pytest from unittest.mock import Mock from datacrunch.http_client.http_client import HTTPClient BASE_URL = "https://api-testing.datacrunch.io/v1" ACCESS_TOKEN = "<PASSWORD>" CLIENT_ID = "0123456789xyz" @pytest.fixture def http_client(): auth_service = Mock() auth_service._access_token = ACCESS_TOKEN ...
StarcoderdataPython
3263218
<reponame>sohinik/common-docker import os import unittest import confluent.docker_utils as utils class BaseImageTest(unittest.TestCase): def setUp(self): self.image = "{0}confluentinc/cp-base-new:{1}".format(os.environ["DOCKER_REGISTRY"], os.environ["DOCKER_TAG"]) def test_image_build(self): ...
StarcoderdataPython
121361
<filename>pytype/__version__.py # pylint: skip-file __version__ = '2020.09.29'
StarcoderdataPython
108457
<reponame>jeli-t/algorithms # binary search tree # author: D1N3SHh # https://github.com/D1N3SHh/algorithms class Red_black_tree(): def __init__(self): self.nil = Node(0, 'black', None, None) self.root = self.nil def __repr__(self): return str(self.root) def left_rotate(self, x)...
StarcoderdataPython
22920
## {{{ http://code.activestate.com/recipes/303396/ (r1) '''equation solver using attributes and introspection''' from __future__ import division class Solver(object): '''takes a function, named arg value (opt.) and returns a Solver object''' def __init__(self,f,**args): self._f=f self._args={} # ...
StarcoderdataPython
27120
<gh_stars>0 from .base import ShowyourworkException class RequestError(ShowyourworkException): def __init__( self, status="", message="An error occurred while accessing a remote server.", ): super().__init__(f"Request error {status}: {message}") class CondaNotFoundError(Showy...
StarcoderdataPython
1659338
<reponame>pavi-ninjaac/HackerRank<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Tue Oct 13 21:45:12 2020 @author: ninjaac """ """ You are given a string and width . Your task is to wrap the string into a paragraph of width . Input Format The first line contains a string, . The second line conta...
StarcoderdataPython
3288670
<filename>or78_6_mountain.py import random import or78_helpers def blizzard(this_vars): print("BLIZZARD IN MOUNTAIN PASS--TIME AND SUPPLIES LOST") this_vars.is_blizzard = True this_vars.amount_spent_on_food -= 25 this_vars.amount_spent_on_miscellaneous -= 10 this_vars.amount_spent_on_bullets -= 30...
StarcoderdataPython
1758702
<filename>Python/Samples/Strategy/DbLogger.py from BaseLogger import BaseLogger class DbLogger(BaseLogger): def debug(self,msg): print("(Database)Debug: " + msg) def warn(self,msg): print("(Database)Warn: " + msg) def error(self,msg): print("(Database)Error: " + msg)
StarcoderdataPython
99419
# Copyright (c) Facebook, Inc. and its affiliates. import unittest from unittest.mock import MagicMock, patch import torch from tests.trainers.test_training_loop import TrainerTrainingLoopMock class TestEvalLoop(unittest.TestCase): @patch( "mmf.common.test_reporter.PathManager", return_value=Mag...
StarcoderdataPython
1631321
from main import init init()
StarcoderdataPython
88593
<gh_stars>0 from django.urls import path from .views import HomePage from .views import AboutPage urlpatterns = [ path('', HomePage.as_view(), name="home"), path('about/', AboutPage.as_view(), name="about"), ]
StarcoderdataPython
111734
import numpy as np import pandas as pd import pathlib from relm.mechanisms import GeometricMechanism EPSILON = 2 ** -3 SENSITIVITY = 1.0 # ======================================================================================== # Read the raw data. filename = "pcr_testing_age_group_2020-03-09.csv" path = pathlib.Pa...
StarcoderdataPython
3351003
import os import sys import signal import functools import inspect import contextlib import logging import time import grpc from grn.utils.utils import is_server_available, find_gpu_master_address from grn.utils.gpu_monitors import SingleGPUProcessMonitor import grn.grpc_resources.master_pb2 as protos import grn.grpc...
StarcoderdataPython
3386744
# validated: 2018-01-14 DV 76dd48fe2e6a libraries/driver/include/ctre/phoenix/Motion/TrajectoryPoint.h from collections import namedtuple from ._impl import TrajectoryDuration __all__ = ['TrajectoryPoint'] #: Motion Profile Trajectory Point. #: This is simply a data transfer object. TrajectoryPoint = namedtuple("Tr...
StarcoderdataPython
1787510
import wypp import sys print(sys.argv)
StarcoderdataPython
3343030
<reponame>ChethanNingaraju/X-space #!/usr/bin/python import SimpleHTTPServer import SocketServer PORT = 8080 Handler = SimpleHTTPServer.SimpleHTTPRequestHandler Handler.extensions_map.update({ '.xhtml': 'application/vnd.hbbtv.xhtml+xml; charset=utf-8', }); httpd = SocketServer.TCPServer(("0.0.0.0", PORT), Handl...
StarcoderdataPython
1711139
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyCekit(PythonPackage): """CEKit is a Container image creation tool. CEKit helps to bu...
StarcoderdataPython
3384114
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Hewlett-Packard Development Company, L.P. # # 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....
StarcoderdataPython
1633985
from django.contrib import admin from vocabulary.models import Vocabulary admin.site.register(Vocabulary)
StarcoderdataPython
120352
<reponame>osomdev/pyshrimp<filename>tests/unit/test_table_parser.py from unittest import TestCase from pyshrimp.utils.table_parser import parse_table table_data = ''' USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 171008 10724 ? Ss lis21 3:28 /sbin/ini...
StarcoderdataPython
30741
from nipype.interfaces import utility as util from nipype.pipeline import engine as pe from .interfaces import dsi_studio as dsi import nipype.interfaces.diffusion_toolkit as dtk from nipype.algorithms.misc import Gunzip import os.path def create_pipeline(name="dsi_track", opt="", ensemble=""): parameters = {'nos...
StarcoderdataPython
1786647
def least_rotation(s): a, n = 0, len(s) s = s + s for b in range(n): for i in range(n): if (a + i == b) or (s[a + i] < s[b + i]): b += max(0, i - 1) break if s[a + i] > s[b + i]: a = b break return s[a:a + ...
StarcoderdataPython
1689384
import os import sys import xesmf as xe import xarray as xr import numpy as np import pandas as pd import math from dask.diagnostics import ProgressBar class color: PURPLE = '\033[35m' CYAN = '\033[36m' BLUE = '\033[34m' LBLUE='\033[94m' GREEN = '\033[32m' LGREEN='\033[92m' YELLOW = '\033[33m' ...
StarcoderdataPython
77125
# @copyright@ # Copyright (c) 2006 - 2019 Teradata # All rights reserved. Stacki(r) v5.x stacki.com # https://github.com/Teradata/stacki/blob/master/LICENSE.txt # @copyright@ import json import signal import zmq import pprint import stack.mq import stack.commands.sync.host class Subscriber(stack.mq.Subscriber): def...
StarcoderdataPython
3241161
<reponame>alreich/qualreas<gh_stars>10-100 # Test format for Temporal Networks # # # https://en.wikipedia.org/wiki/Region_connection_calculus#Examples, net = { "name": "RCC8 Example", "algebra": "RCC8", "nodes": { "h1": { "name": "House1", "class": "Region" },...
StarcoderdataPython
1610855
<reponame>VincentDehaye/recommender-system-liu """ RetrieveTopTrending Class """ from Product.DataManager.TopTrending.RetrieveTopTrending import RetrieveTopTrending class RetrieveTopTrendingTotal(RetrieveTopTrending): """ Author: <NAME> / <NAME> Date: 2017-11-10 Last update: Purpose: Will retr...
StarcoderdataPython
27545
<gh_stars>0 ''' Created on Nov 27, 2011 @author: Nich ''' import uuid from model.base import Base from sqlalchemy import Column, String, ForeignKey from sqlalchemy.orm import relationship class Account(Base): __tablename__ = "account" id = Column(String, primary_key=True) first_name = Column(Strin...
StarcoderdataPython
4812834
<reponame>ZLCao/libpicoquant<gh_stars>1-10 class FakeIniSection(object): """ Wrapper to enable configparser to parse a file without sections. """ def __init__(self, fp): self.fp = fp self.sechead = '[asection]\n' def readline(self): if self.sechead: try: ...
StarcoderdataPython
1737141
# Write a Python script that takes in command line arguments. # The first argument will be a URL. The second will be a file containing stopwords. # Each line in the stopword file will be a new stopword. # Your Python script should return the top 10 words with the number of occurrences # regardless of casing sorted by ...
StarcoderdataPython
1699719
def main(): message = input("Enter an encrypted msg: ") length = len(message) if length % 2 != 0: bam = int(length / 2) first_part = message[:bam] second_part = message[bam + 1:] else: bam = int(length / 2) first_part = message[:bam] second_part = messag...
StarcoderdataPython
3211449
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # # Code generated. DO NOT EDIT! # template file: justice_py_sdk_codegen/__main__.py """Auto-generated package that contains models used b...
StarcoderdataPython
1654615
<filename>flows/__init__.py from typing import Any from .flows import * from .equivariant_flows import * from .toy_resflow import * from .resflow import * from .equivariant_resflow import * from .lie_resflow import * from .mixed_equivariant_resflow import * from .invariant_maps import * import argparse import ipdb kwa...
StarcoderdataPython
3375405
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
StarcoderdataPython
100280
<filename>egs/babel/s5c/myutils/gen_ivec_pairs2.py #!/usr/bin/python import sys import itertools import random import argparse parser = argparse.ArgumentParser(description="Generate pairs.") parser.add_argument('--pairs-per-spk', type=int, default=10, dest='fake_pairs') parser.add_argument('--random-seed', type=int, d...
StarcoderdataPython
1773472
from typing import Tuple, Union import tensorflow.keras as keras import numpy as np from alibi.utils.data import Bunch def fetch_fashion_mnist(return_X_y: bool = False ) -> Union[Bunch, Tuple[np.ndarray, np.ndarray]]: """ Loads the Fashion MNIST dataset. Parameters ---------...
StarcoderdataPython
3265071
<filename>Practice2/decorator.py import time def timer(f): def wrapper(*args, **kwargs): start = time.clock() f(*args, **kwargs) end = time.clock() print ("Elapsed: %f" % (end-start)) return wrapper @timer def gennums(): [x**2 for x in range(2000)] gennums()
StarcoderdataPython
3367238
<filename>util/detector.py from detectron2.data.detection_utils import read_image from detectron2.config import get_cfg from detectron2.engine.defaults import DefaultPredictor import numpy as np import cv2 import os import glob from tqdm import tqdm import pickle class Args(): def __init__(self): self.config_...
StarcoderdataPython
4841804
import networkx as nx from pymnet import * import random import matplotlib import cascade as cas import statistics import math import time import csv matplotlib.use('TkAgg') nodes = 500 layers = 2 t = 0.005823 # 0.002 -> 1, 0.00472 -> 2.36, 0.005 -> 2.5 attack_size = 100 ...
StarcoderdataPython
130843
<gh_stars>0 #!/usr/bin/env python ''' cauta intr-un director dat fisierele ce contin in nume o cheie ''' import os def cauta_fisiere(path, key): ''' cauta intr-un director dat fisierele ce contin in nume o cheie ''' for root, _, files in os.walk(path): for nume_fisier in files: if key in n...
StarcoderdataPython
1668611
"""Inicializaçao do modulo adapters""" from .request_adapter import request_adapter
StarcoderdataPython
4628
<reponame>kernicPanel/richie """ Backend to connect Open edX richie with an LMS """ import logging import re import requests from requests.auth import AuthBase from ..serializers import SyncCourseRunSerializer from .base import BaseLMSBackend logger = logging.getLogger(__name__) def split_course_key(key): """S...
StarcoderdataPython
3282840
#!/usr/bin/env python import argparse import itertools import glob import os import shutil import subprocess class CockroachCluster(object): def __init__(self, namespace, ca_certs_dir=None): self.namespace = namespace self._ca_certs_dir = ca_certs_dir @property def directory(self): ...
StarcoderdataPython
3286738
import os import pathlib from functools import partial from napari.utils.translations import trans from napari_plugin_engine import napari_hook_implementation CELLPOSE_DATA = [ ('rgb_3D.tif', trans._('Cells (3D+2Ch)')), ('rgb_2D.png', trans._('Cells 2D')), ] def _load_cellpose_data(image_name, dname): # ...
StarcoderdataPython
1731220
<reponame>leelige/mindspore<gh_stars>10-100 # Copyright 2021 Huawei Technologies Co., Ltd # # 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 # # Un...
StarcoderdataPython
135422
<reponame>kokosing/hue # -*- coding: utf-8 -*- """ monotonic ~~~~~~~~~ This module provides a ``monotonic()`` function which returns the value (in fractional seconds) of a clock which never goes backwards. On Python 3.3 or newer, ``monotonic`` will be an alias of ``time.monotonic`` from the standard libra...
StarcoderdataPython
3354683
#This program takes two arguments #First argument: directory to input MOD files #First argument: directory to input .dat files #Second argument (optional): total number of events to be processed #The result is stored in event_list #import modules import csv import time import lumi from analyze_MOD import analyze_MOD i...
StarcoderdataPython
48312
<gh_stars>0 # -*- coding: utf-8 -*- import itertools import pathlib import numpy as np import numpy.linalg as LA from PIL import Image def tovector(image, k=None): # image -> vector data = np.asarray(image, dtype=np.float64) if k: return data[:,:, k].flatten() else: r...
StarcoderdataPython
3268866
<filename>services/dscore-master/validate_rttm.py #!/usr/bin/env python """Validate RTTM files. To validate a RTTM files ``f1.rttm``, ``f2.rttm``, ... python validate_rttm.py f1.rttm f2.rttm ... which will for each file report the following: - the number of unique file ids found - the number of speake...
StarcoderdataPython
1771480
def address_parser(soup, i): home_dict = dict() home_address_MLS = soup.title.string add_list = home_address_MLS.split(sep=' |') zip_code = re.search('\d+$', add_list[0]) home_add = re.search('(.+?),', home_address_MLS) home_city = re.search(',(.+?),', home_address_MLS) home_state = re.se...
StarcoderdataPython
62662
""" project.settings """
StarcoderdataPython
3214795
##Write code to remove duplicates from an unsorted linked list class Node(object): def __init__(self,data, next=None): self.data= data self.next = next class LinkedList(object): def __init__(self): self.head = None self.size = 0 def extend(self,seq): """exte...
StarcoderdataPython
1704232
<reponame>fossabot/OpenPython from uos import * # import ocpath as path from ocpath import curdir, pardir, sep, extsep, altsep, pathsep, linesep, defpath, devnull __all__ = [ # uos.* "chdir", "getcwd", "ilistdir", "listdir", "mkdir", "remove", "rmdir", "rename", "stat", "statvfs", "sync", "urandom", "dupt...
StarcoderdataPython
3217112
# Activate fake sensors FAKE_IMU = True FAKE_GPS = True # Hardcoded magnetic declination # Not implemented in the code yet ########################## MAGNETIC_DECLINATION = -10 #MAGNETIC_DECLINATION = 14.46 # ETS gps coordonates #default_lat = 45.494620 #default_lon = -73.562725 #default_rel_alt = 1 # Le Trou coc...
StarcoderdataPython
163601
<reponame>AhmedElshaarany/qso_lya_detection_pipeline<filename>papers/I/Analysis/py/run_mix.py """ Module for running analysis on Mix test """ from __future__ import print_function, absolute_import, division, unicode_literals import numpy as np import sys import os import io, json import pdb from pkg_resources import ...
StarcoderdataPython
158739
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Aug 9 17:02:59 2018 @author: bruce compared with version 1.6.4 the update is from correlation coefficient """ import pandas as pd import numpy as np from scipy import fftpack from scipy import signal import matplotlib.pyplot as plt from matplotlib.co...
StarcoderdataPython
74257
from abc import ABCMeta from enum import Enum class KindleNotes(metaclass=ABCMeta): def __init__(self): self.title = '' self.author = '' self.notes = list() def parse(self): raise NotImplementedError class NoteElement(object): def __init__(self): self.section = '' ...
StarcoderdataPython
3272261
<filename>Python_Projects/Python_Web_Scraping/census_scraping/census_scraping.py from selenium import webdriver from pyvirtualdisplay import Display from bs4 import BeautifulSoup import json url = 'http://www.census.gov/mycd/application/' results = [] # initialize virtual display display = Display(visible=0, size=(800...
StarcoderdataPython
3323442
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from torch.nn import functional as F from torch import nn from maskrcnn_benchmark.layers import smooth_l1_loss from maskrcnn_benchmark.modeling.matcher import Matcher from maskrcnn_benchmark.structures.boxlist_ops import boxlist_iou f...
StarcoderdataPython
3344735
<gh_stars>1-10 from __future__ import division import getData as gd import pandas as pd from sklearn.linear_model import LogisticRegression def getCongestion(loc_data, day, hour, threshold): loc_data = loc_data.reset_index(drop=True) for index,row in loc_data.iterrows(): if row['Weekday'] == 'Monday'...
StarcoderdataPython
3234899
<reponame>ujtakk/dotfiles<filename>.vim/templates/plot_template.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import matplotlib as mpl # mpl.use('Agg') import matplotlib.pyplot as plt import pandas as pd import seaborn as sns # sns.set( # style="whitegrid", # context="poster", # fon...
StarcoderdataPython
3305442
import numpy as np from functools import reduce from functools import partial import matplotlib.pyplot as plt class CoinTossEMEstimator: def __init__(self, num_coins, coin_priors): """Initialize the estimator Parameters ------------- num_coins : int number of coins, i...
StarcoderdataPython
119913
from django.db import models # Create your models here. class Article(models.Model): title = models.CharField(max_length=100) image = models.ImageField(default='null') content = models.TextField() public = models.BooleanField() created_at = models.DateTimeField(auto_now_add=True) updated_at = ...
StarcoderdataPython
3261911
from flask import Flask, redirect, render_template, url_for, request from flask_login import ( LoginManager, UserMixin, login_user, logout_user, current_user ) app = Flask(__name__) app.secret_key = 'secret' login_manage...
StarcoderdataPython
3391931
from helper_sql import * def insert(t): sqlExecute('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t)
StarcoderdataPython
1710409
<reponame>simphide/Kaggle-2020-Alaska2 import argparse import sys import numpy as np import os import pickle import jpegio as jio from oct2py import octave from tqdm import tqdm octave.addpath('rich_models/') #sys.path.insert(1,'./') def main(): DATA_ROOT_PATH = os.environ.get('DATA_ROOT_PATH') parser = ...
StarcoderdataPython
1641168
<reponame>Bakterija/term_app from ._base import PluginBase class Plugin(PluginBase): name = 'properties' doc = 'Returns all properties of TerminalWidgetSystem' methods_subclass = {} def handle_input(self, term_system, term_globals, exec_locals, text): fname, method, args = self.get_method_args...
StarcoderdataPython
3205905
<filename>ui/element.py from interfaces import UIElement, UIBox import util.enums as enums class Heart(UIElement): FULL = "full" HALF = "half" EMPTY = "empty" def __init__(self, loc, state="full"): self.state = state file = enums.RES + "icons/heart.png" if state == Heart.HALF...
StarcoderdataPython
78838
<reponame>osaaso1/python_actr import python_actr from collections import UserDict class Chunk(UserDict): def __init__(self,contents,bound=None): UserDict.__init__(self) if isinstance(contents,Chunk): self.update(contents) elif isinstance(contents,str): for i,x in enumerate(contents.split()):...
StarcoderdataPython
3358229
#!/usr/bin/env python #-*- coding:utf-8 -*- ## ## pb.py ## ## Created on: Mar 13, 2019 ## Author: <NAME> ## E-mail: <EMAIL> ## """ =============== List of classes =============== .. autosummary:: :nosignatures: EncType PBEnc ================== Module descri...
StarcoderdataPython
2289
import urllib.request import json from .models import News # Getting api key api_key = None # Getting the movie base url base_url = None def configure_request(app): global api_key,base_url api_key = app.config['NEWS_API_KEY'] base_url = app.config['NEWS_API_BASE_URL'] def get_news_source(country,category)...
StarcoderdataPython
3387822
# --------------------------------------------------------------------- # # Copyright (c) 2012 University of Oxford # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, incl...
StarcoderdataPython
3375366
# -*- coding: utf-8 -*- """ Microsoft-Windows-EFS GUID : 3663a992-84be-40ea-bba9-90c7ed544222 """ from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct from etl.utils import WString, CString, SystemTime, Guid from etl.dtyp import Sid from etl.parsers...
StarcoderdataPython
3356984
<gh_stars>0 # -*- coding:utf-8 -*- from wtforms import StringField, IntegerField, BooleanField,DateTimeField from wtforms import ValidationError from wtforms.validators import DataRequired, length, Email, Regexp from app.validators.base import BaseFrom as Form from app.validators.page_form import PageSearchForm from ...
StarcoderdataPython
1659532
<gh_stars>1-10 async def remind_users(chan, role: str, work: str, date: str, time: str) -> str: await chan.send(f"<@&{role}> Don't forget the {work} due {date} {time}.") return 'Reminder sent.'
StarcoderdataPython
3346150
"""The file component."""
StarcoderdataPython
3380163
from vit_pytorch.vit_pytorch import ViT from vit_pytorch.vit_pytorch import ViTV2
StarcoderdataPython
1606653
<filename>production_tests/conftest.py from .util import ProductionTestCase def pytest_addoption(parser): parser.addoption('--origin', dest='origin', default='https://calc.gsa.gov', help='origin of production server') def pytest_configure(config): ProductionTestCase...
StarcoderdataPython
72439
<reponame>pierluigi-failla/pipesnake # -*- coding: utf-8 -*- import logging import numpy from pipesnake.base import Transformer from pipesnake.base.utils import _check_cols __all__ = [ 'MinMaxScaler', 'StdScaler', 'MadScaler', 'UnitLenghtScaler', ] class MinMaxScaler(Transformer): """Min max s...
StarcoderdataPython
3644
import os import sys import pandas as pd from datetime import datetime from settings import RAW_DATA_DIR, DataV3, DATA_V3_SUBVERSION from src.features.helpers.processing import add_missing_timestamp_values from src.features.helpers.processing_v3 import get_closest_players, get_players_and_ball_indices, calculate_distan...
StarcoderdataPython
4827005
<gh_stars>0 from __future__ import print_function import numpy as np from Florence.Utils import insensitive from warnings import warn # BASE CLASS FOR ALL MATERIAL MODELS - SHOULD NOT BE USED DIRECTLY class Material(object): """Base class for all material models""" def __init__(self, mtype, ndim, energy_type=...
StarcoderdataPython
121616
<filename>A/A 584 Olesya and Rodion.py # https://codeforces.com/problemset/problem/584/A n, t = map(int, input().split()) if n == 1: if t < 10: print(t) else: print(-1) else: if t < 10: print(str(t)+'0'*(n-1)) else: print('1'+'0'*(n-1))
StarcoderdataPython
26896
<gh_stars>0 class Bank(): def __init__(self): pass def reduce(self, source, to): return source.reduce(to)
StarcoderdataPython
1640878
<reponame>prashant0598/CoffeeApp """ PyPrint provides Printer objects for Python so people can easily print stuff to different medias - in color - platform independently. """
StarcoderdataPython
3308670
<reponame>chenzibin2019/incremental-network-verification import sys import json import random from verifier.models import OSPF from topo import OSPFTopo import argparse import time def ospf(args): v = OSPF(OSPFTopo(), args.topo, 'load_from_file') v.buildParams().buildSMTConstraint() print('verification') ...
StarcoderdataPython
144895
# coding=utf-8 import random import rdkit.Chem as rkc from rdkit.Chem import AllChem from rdkit.Chem import MolStandardize from rdkit.Chem import SaltRemover from rdkit.Chem import rdmolops def disable_rdkit_logging(): """ Disables RDKit whiny logging. """ import rdkit.RDLogger as rkl logger = r...
StarcoderdataPython
1674639
arr = input().split() for i in range(len(arr)): if(arr[i]=='1'): print(i) break
StarcoderdataPython
166163
''' Test cases for docker container creation. ''' #adding for py3 support from __future__ import absolute_import import logging import os import random import re import shutil import tempfile import unittest import pexpect # Configure logging. Troubleshooting the pexpect interactions in # particular needs a lot o...
StarcoderdataPython
1787884
# -*- coding: utf-8 -*- import sys import io from proxypool.scheduler import Scheduler sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') def main(): try: scheduler = Scheduler() scheduler.run() except Exception as e: print(repr(e.args)) main() if __name__ =...
StarcoderdataPython
3216858
#!/usr/bin/python3 import urllib.request as url import time,sys,os from pathlib import Path from urllib.error import HTTPError if len(sys.argv)<2: raise Exception('Usage: retrieve.py match_id [match_id ...]') OPENDOTA='https://api.opendota.com/api/' MATCHES=sys.argv[1:] OUTPUT='matches' def get(call,prefix=OPEND...
StarcoderdataPython
69037
import abc import numpy as np import copy import csv import os from beluga.liepack import * # The following math import statements appear to be unused, but they are required on import of the specific # methods since an eval() is called from math import sqrt class Method(object): """ Class containing informati...
StarcoderdataPython
3213433
<reponame>tmdiep/python-pubsublite<gh_stars>0 # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
StarcoderdataPython
1627326
title = 'Pmw.ScrolledListBox demonstration' # Import Pmw from this directory tree. import sys sys.path[:0] = ['../../..'] import tkinter import Pmw class Demo: def __init__(self, parent): # Create the ScrolledListBox. self.box = Pmw.ScrolledListBox(parent, items=('Sydney', 'Melbou...
StarcoderdataPython
4808365
<filename>GCRCatalogs/user_config.py from argparse import ArgumentParser, RawTextHelpFormatter from .user_config_mgr import UserConfigManager if __name__ == "__main__": description = """Directly manipulate items in user config""" parser = ArgumentParser(description=description, pro...
StarcoderdataPython
3330562
# Copyright (c) 2013 Tencent Inc. # All rights reserved. # # Author: <NAME> <<EMAIL>> """ Manage symbols can be used in BUILD files. """ class Native(object): """ A built-in object to support native rules and other helper functions. make native rules such as `cc_library` can always be accessed in the f...
StarcoderdataPython
3248530
<filename>src/georgstage/interface2.py import datetime import random import tkinter as tk from tkinter import messagebox, filedialog, Menu WIDTH = 10 def to_datestr(date): return f'{date.year}/{str(date.month).zfill(2)}/{str(date.day).zfill(2)}' def from_datestr(datestr): return datetime.datetime.strptime(da...
StarcoderdataPython
100067
<filename>kickstarter/kickstarter.py import pandas as pd import numpy as np from sklearn.feature_extraction.text import CountVectorizer from sklearn.preprocessing import StandardScaler from sklearn import preprocessing from sklearn.ensemble import RandomForestClassifier class KickStarterModel(object): def _...
StarcoderdataPython
1654597
<reponame>gaofubin/ccu_and_eccu_publish<gh_stars>1-10 #! /usr/bin/env python #ccu flush import requests, logging, json, sys from http_calls import EdgeGridHttpCaller from random import randint from akamai.edgegrid import EdgeGridAuth from config import EdgeGridConfig import urllib import sys session = requests.Session(...
StarcoderdataPython
138854
<filename>xfields/fieldmaps/interpolated.py import numpy as np import xobjects as xo import xpart as xp import xtrack as xt from ..solvers.fftsolvers import FFTSolver3D, FFTSolver2p5D from ..general import _pkg_root class TriLinearInterpolatedFieldMapData(xo.Struct): x_min = xo.Float64 y_min = xo.Float64 ...
StarcoderdataPython
156685
<reponame>gdetrez/fscons-ticketshop import re from django.test import TestCase from django.core import mail from ticketapp.models import TicketPurchase, TicketType # #class ConfirmationEmailTest(TestCase): # # def setUp(self): # """ # Create a purchase object and mark it as paid, # which shou...
StarcoderdataPython