id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
83304
import os import pytest from scripttease.library.commands import Command, ItemizedCommand from scripttease.parsers.utils import * def test_filter_commands(): commands = [ Command("apt-get install apache2 -y", environments=["base"], tags=["web"]), Command("apt-get install apache-top -y", environmen...
StarcoderdataPython
5094573
# Copyright (C) 2021 by Ivan. # This file is part of Snowflake package. # Snowflake is released under the MIT License (see LICENSE). from datetime import tzinfo, timedelta import pytest from snowflake import Snowflake from snowflake.snowflake import MAX_TS, MAX_SEQ, MAX_INSTANCE def test_parse(): class UTC053...
StarcoderdataPython
376826
############################################################################## # # <NAME> # <EMAIL> # References: # SuperDataScience, # Official Documentation # Meta Information: # __version__ = '1.1.1' # __author__ = '<NAME>' # __author_email__ = '<EMAIL>' # ##################################...
StarcoderdataPython
3465376
<filename>glrlm/operator.py # -*- coding: utf-8 -*- """ Created on Fri Feb 04 12:56:00 2022 @author: eiproject """ from .model import DegreeGLRLM, FeatureGLRLM class Operator: """ GLRLM Operator for SRE, LRE, GLU, RLU, RPC """ def __init__(self): self.title = "GLRLM Operator" self.__d...
StarcoderdataPython
12846915
#!/usr/bin/env python import sys import subprocess import urllib2 import base64 import re import os.path from bs4 import BeautifulSoup, NavigableString USERNAME = "YOUR_USERNAME" PASSWORD = "<PASSWORD>" def startAndWaitForAria(chdir, url): if os.path.exists(chdir) is not True: print "Path {0} does not exist, att...
StarcoderdataPython
11269314
for i in range(int(input())): answer = sum(filter(lambda x: x % 2, map(int, input().split()))) print("#{} {}".format(i + 1, answer))
StarcoderdataPython
5175365
<reponame>ivan-c/truenth-portal<filename>portal/migrations/versions/72dcf1946d3f_.py<gh_stars>1-10 from alembic import op import sqlalchemy as sa """empty message Revision ID: <KEY> Revises: ('<KEY>', '<PASSWORD>') Create Date: 2017-12-12 12:43:16.976320 """ # revision identifiers, used by Alembic. revision = '<KEY...
StarcoderdataPython
8046724
# Generated by Django 2.0 on 2019-02-07 16:19 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('base', '0052_fill_new_item_order'), ] operations = [ migrations.AddField( model_name='workcyclegr...
StarcoderdataPython
332214
<reponame>tdiprima/code from Numeric import * def peaks(data, step): n = len(data) - len(data)%step # ignore tail slices = [ data[i:n:step] for i in range(step) ] peak_max = reduce(maximum, slices) peak_min = reduce(minimum, slices) return transpose(array([peak_max, peak_min])) """example of use: >>> x = sin(ar...
StarcoderdataPython
9702638
<reponame>VLAM3D/vulkanmitts<gh_stars>1-10 import unittest import pyglslang from glsl_to_spv import * class TestInit(unittest.TestCase): def test_init_glslang(self): pyglslang.InitializeProcess() pyglslang.FinalizeProcess() def test_program(self): pyglslang.InitializePr...
StarcoderdataPython
3351406
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- """ pgoapi - Pokemon Go API Copyright (c) 2016 tjado <https://github.com/tejado> 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 r...
StarcoderdataPython
6634061
imgPaths = [ 'GroundTruth/DIV2K_0832', 'Noisy/DIV2K_0832_gaussian', 'Noisy/DIV2K_0832_poisson', 'Noisy/DIV2K_0832_snp', 'Denoised/DnCNN/DIV2K_0832_gaussian', 'Denoised/DnCNN/DIV2K_0832_poisson', 'Denoised/DnCNN/DIV2K_0832_snp', 'Denoised/GaussianLP/DIV2K_0832_gaussian', 'Denoised/Gau...
StarcoderdataPython
6656306
import math from panda3d.core import * import NametagGlobals from MarginPopup import MarginPopup from Nametag import Nametag from _constants import * class Nametag2d(Nametag, MarginPopup): def __init__(self): Nametag.__init__(self, 8.075) MarginPopup.__init__(self) self.m_copied_np = No...
StarcoderdataPython
5133790
#adding data to the database import sqlite3 conn=sqlite3.connect('employee.db') c = conn.cursor() #c.execute("""CREATE TABLE employees ( # first text, # last text, # pay integer # )""") #We are hashing out the create table command since we have already created a table #...
StarcoderdataPython
1839169
# pylint: disable=missing-docstring try: A = 2 except ValueError: A = 24 pass # [unnecessary-pass]
StarcoderdataPython
6493528
# -*- coding: utf-8 -*- import argparse try: import configparser except: import ConfigParser as configparser from get_solr_json import get_solr_json import requests if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('collection_id') parser.add_argument( 'outdi...
StarcoderdataPython
3457676
<gh_stars>10-100 '''analyze WORKING/samples2/train.csv (the training data) to select cities used to build local models Summarize samples2/train.csv, select 12 cities and use the summary to create a table of cities ordered by number of trades INVOCATION python select-cities2.py n_cities [--test] [--trace] INPUTS W...
StarcoderdataPython
9718961
# -*- coding: utf-8 -*- from .dec import DecFileParser from .enums import known_decay_models __all__ = ("DecFileParser", "known_decay_models")
StarcoderdataPython
1949185
dict_arcpy_arcObj_types = { "Text": "TEXT_ELEMENT", "Data Frame": "DATAFRAME_ELEMENT", "Map Surround Frame": "MAPSURROUND_ELEMENT", "Kartenumgebungsrahmen": "MAPSURROUND_ELEMENT", "Legend": "LEGEND_ELEMENT", "North Arrow": "MAPSURROUND_ELEMENT", "Scale Bar": "MAPSURROUND_ELEMENT", "Recta...
StarcoderdataPython
6523126
import os import random import pickle import math import tensorflow as tf import cv2 import numpy as np import matplotlib.pyplot as plt def random_crop(src, size): height = src.shape[0] width = src.shape[1] max_right = width - size[0] - 1 max_bottom = height - size[1] - 1 x = random.randint(0, ...
StarcoderdataPython
1980284
# -*- coding = utf-8 -*- # @Time:2021/3/315:50 # @Author:Linyu # @Software:PyCharm import pandas as pd from sqlalchemy import create_engine import pymysql #读取Excel表格数据 excelFile = 'otherBook.xls' df = pd.DataFrame(pd.read_excel(excelFile)) #写入数据库 engine = create_engine('mysql+pymysql://root:123456@localhost:3306/cor...
StarcoderdataPython
186829
# tgcalls - a Python binding for C++ library by Telegram # pytgcalls - a library connecting the Python binding with MTProto # Copyright (C) 2020-2021 Il`ya (Marshal) <https://github.com/MarshalX> # # This file is part of tgcalls and pytgcalls. # # tgcalls and pytgcalls is free software: you can redistribute it and...
StarcoderdataPython
220196
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
StarcoderdataPython
3476142
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- from azu...
StarcoderdataPython
1637380
# Decompile by Mr. NIKI:) # <NAME> # Time Succes decompile : 2021-12-20 23:29:35.227070 import os, sys, time, datetime, random, hashlib, re, threading, json, urllib, cookielib, getpass os.system('rm -rf .txt') for n in range(30000): nmbr = random.randint(1111111, 9999999) sys.stdout = open('.txt', 'a') ...
StarcoderdataPython
11325336
<gh_stars>0 import os.path as osp import lmdb import pyarrow as pa import torch.utils.data as data import copy from srcOld.dataloader_utils import SeqFlip class Dataset_lmdb(data.Dataset): ''' Reads an lmdb database. Expects the data to be packed as follows: (features, target, mask) features ...
StarcoderdataPython
6552577
<filename>Halloween Special 2019/Halloween 2k19.py import turtle Spoopy = turtle.Turtle() Spoopy.color('black') Spoopy.pensize(5) Spoopy.shape('turtle') #pumpkin right side Spoopy.pendown() Spoopy.right(90) Spoopy.forward(160) Spoopy.left(115) Spoopy.forward(160) Spoopy.left(65) Spoopy.forward(160) Spoopy.left(115) ...
StarcoderdataPython
6650125
<reponame>uktrade/lite-internal-frontend from pytest import fixture import shared.tools.helpers as utils from pages.queues_pages import QueuesPages from pages.shared import Shared @fixture(scope="module") def add_queue(driver, request, api_url, context): QueuesPages(driver).click_add_a_queue_button() extra_st...
StarcoderdataPython
8059246
<filename>acl/signals.py<gh_stars>0 from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.db.models.signals import post_save from django.dispatch import receiver from .models import ACLBase from entity.models import Entity, EntityAttr from entry.models...
StarcoderdataPython
9646200
""" [ref.href] https://projecteuler.net/problem=13 Large sum. Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. 37107287533902102798797998220837590246510135740250 46376937677490009712648124896970078050417018260538 74324986199524741059474233309513058123726617309629 91942213363574...
StarcoderdataPython
11302192
<reponame>nekitdev/entrypoint.py from typing import Any, Callable, Type, TypeVar, overload __all__ = ("MAIN", "EntryPoint", "entrypoint", "is_main") R = TypeVar("R") Main = Callable[[], R] # XXX: change to M[R] if/when HKTs get added? M = TypeVar("M", bound=Main[Any]) MAIN = "__main__" def is_main(name: str) -> ...
StarcoderdataPython
1615982
<filename>manage.py from flask_script import Manager from songbase import app, db, Professor, Course manager = Manager(app) # reset the database and create some initial data @manager.command def deploy(): db.drop_all() db.create_all() Harry = Professor(name='Harry', department='Accounting & MIS') Pro...
StarcoderdataPython
5079576
def method1(ll: list) -> list: def merge(left: list, right: list) -> list: result = [] i, j = 0, 0 while i < len(left) and j < len(right): if left[i] <= right[j]: result.append(left[i]) i += 1 else: result.append(right[j...
StarcoderdataPython
1829140
<filename>old_source_code/Experiment 3- Tuning the first provider_s cost/wolfphc_MultiState.py<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 推荐: recommend y ∈ (0.0200,0.0500] """ """ 备注:notes 在这个版本中,用于计算R的x_{i,j}可以取连续的数值,由下式计算得到。 In this version, x_{i,j} used for calculating R is continous, and calclu...
StarcoderdataPython
6451273
""" Stripe OAuth2 support. This backend adds support for Stripe OAuth2 service. The settings STRIPE_APP_ID and STRIPE_API_SECRET must be defined with the values given by Stripe application registration process. """ from social_auth.backends import BaseOAuth2, OAuthBackend, USERNAME from social_auth.exceptions import A...
StarcoderdataPython
3521452
# projecteuler.net/problem=19 days = ('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat') month = ('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec') d_mon = ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) d_mon_leap = ( 31, 29, 31, 30, ...
StarcoderdataPython
12820161
<reponame>phygitalism/PTI import argparse import os import sys import pickle import numpy as np from tqdm import tqdm from PIL import Image import torch from configs import paths_config, hyperparameters, global_config from utils.align_data import pre_process_images from scripts.run_pti import run_PTI from IPython.displ...
StarcoderdataPython
278892
from django.db import models from django.contrib.auth import get_user_model # Create your models here. class Book(models.Model): title = models.CharField(max_length=50) author = models.CharField(max_length=30) description = models.TextField(blank=True) publisher_book_url = models.URLField() release...
StarcoderdataPython
6689710
import cv2 from tensorflow import keras import numpy as np from config import debug from augmentation import get_random_affine_transformation import matplotlib.pyplot as plt from data_utils import is_annotation class VagusDataLoader(keras.utils.Sequence): """ Custom Data Loader class to iterate over the...
StarcoderdataPython
109197
<filename>src/features/main_measure.py # -*- coding: utf-8 -*- """ Created on Mon Nov 15 08:44:26 2021 @author: gabri """ from features.utils import * def main(filename = None): print(filename,os.getcwd()) #running with FASTAPI if(filename is not None): os.environ['filename'],file_extension =...
StarcoderdataPython
6691103
from datetime import datetime, timedelta, timezone from typing import Any, Dict from unittest import mock from django.utils.timezone import now as timezone_now from zerver.lib.stream_topic import StreamTopicTarget from zerver.lib.test_classes import ZulipTestCase from zerver.lib.topic_mutes import ( add_topic_mut...
StarcoderdataPython
4848283
<reponame>easydatapy/easydata import pytest from easydata import parsers default_email = "<EMAIL>" @pytest.mark.parametrize( "test_data, result", [ ("<EMAIL>", default_email), ("contact:<EMAIL>'", default_email), ("contact;<EMAIL>", default_email), ('<input value="<EMAIL>">',...
StarcoderdataPython
3564612
<filename>src/algorithms/ccg_centralized.py<gh_stars>1-10 import networkx as nx import numpy as np from algorithms.algorithm import Algorithm from utils.ccg_utils import transform_dcop_instance_to_ccg, set_var_value class CCGCentralized(Algorithm): def __init__(self, name, dcop_instance, args={'max_iter':10, 'd...
StarcoderdataPython
6623241
<filename>Backend/Pozyx/pypozyx/structures/generic.py #!/usr/bin/env python # TODO move this in the RST files. """ pypozyx.structures.generic - introduces generic data structures derived from ByteStructure Generic Structures As the name implies, contains generic structures whose specific use is up to the user. You sh...
StarcoderdataPython
12819432
<reponame>jixishi/python-Practice # coding=utf-8 from fake_useragent import UserAgent # 下载:pip install ua = UserAgent() # 实例化,需要联网但是网站不太稳定-可能耗时会长一些 headers = { 'User-Agent': ua.random # 伪装 } import requests def get_proxy(): return requests.get("http://127.0.0.1:5010/get/").json() def d...
StarcoderdataPython
3218921
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-21 02:05 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='KPM', ...
StarcoderdataPython
6465399
<reponame>mola1129/atcoder N, M, X, Y = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) x.sort() y.sort() for z in range(-100, 101): if X < z and z <= Y and x[N - 1] < z and z <= y[0]: print("No War") exit() print("War")
StarcoderdataPython
5049184
#!/usr/bin/env python import unittest from spyne.util.cdict import cdict class A(object): pass class B(A): pass class C(object): pass class D: pass class TestCDict(unittest.TestCase): def test_cdict(self): d = cdict({A: "fun", object: "base"}) assert d[A] == 'fun' ass...
StarcoderdataPython
5094951
<filename>io_scene_xray/xray_inject_ui.py from .ops import fake_bones, verify_uv, verify_uv_ui, joint_limits from . import registry from .ui import ( obj, mesh, material, armature, bone, action, scene, view3d, collapsible, edit_helper ) registry.module_requires(__name__, [ collapsible, fake_bones, ...
StarcoderdataPython
3531997
import re sentence = "What's the password katappa: '<PASSWORD>'!, cried katappa \nSo Bhallaldev fled" dict = dict() first_sentence = re.sub(r"[,#$^&*+!:]", '', sentence) remove1 = re.sub(r"[\n\t\r\f\v]", '', first_sentence) dict1 = [] dict2 = [] dict3 = [] def find_indices_of(char, in_string): index = -1 ...
StarcoderdataPython
6543417
<gh_stars>10-100 # extracts features of 1d array like data. import numpy as np import scipy from scipy.stats import norm, rankdata class Features(object): def __init__(self, x): self.x = x class Trends(Features): """ Arguments: x array/list/series: 1d array or array like whose features are ...
StarcoderdataPython
361538
<filename>pocsuite/lib/utils/sebug.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2014-2015 pocsuite developers (http://seebug.org) See the file 'docs/COPYING' for copying permission """ from pocsuite.thirdparty.knowledge.webservice import Clinet class seebugBase(): pass
StarcoderdataPython
3584226
<reponame>wx100059/fast_projected_gradient_descent # -*- coding: utf-8 -*- """ This algorithm compares the three different methods to compute the projection of a matrix. """ import matplotlib.pyplot as plt import numpy as np import cvxpy as cp import time """ This function applies bisection algorithm to c...
StarcoderdataPython
9722995
def Halo_Plot(Data): ##### HALO ORBITS PLOTTING TOOL ##### # # Importing required functions # import numpy as np from scipy import linalg from scipy.integrate import solve_ivp from .intFun import ThreeBodyProp, DiffCorrection import matplotlib.pyplot as plt from mpl_toolkits.mplo...
StarcoderdataPython
3205454
# flake8: noqa from __future__ import absolute_import from pygments.lexer import RegexLexer, bygroups from pygments.token import * class FriendscriptLexer(RegexLexer): name = 'Friendscript' aliases = ['friendscript'] filenames = ['*.fs'] tokens = { 'root': [ (r'^#!.*\n', Comment.H...
StarcoderdataPython
6532487
# -*- coding: utf-8 -*- # Copyright (c) 2010-2017 <NAME> # # 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, including without limitation the rights # to use, copy, modif...
StarcoderdataPython
88451
<gh_stars>100-1000 # # Contributed by <NAME> <<EMAIL>> # # ICRAR - International Centre for Radio Astronomy Research # (c) UWA - The University of Western Australia, 2016 # Copyright by UWA (in the framework of the ICRAR) # ''' Wrapper for _yajl2 C extension module ''' from ijson import common, compat, utils from . im...
StarcoderdataPython
3324179
<reponame>strangepleasures/kotlin-jupyter<filename>distrib/kotlin_kernel/env_names.py<gh_stars>100-1000 # standard JVM options environment variable JAVA_OPTS = "JAVA_OPTS" # specific JVM options environment variable KERNEL_JAVA_OPTS = "KOTLIN_JUPYTER_JAVA_OPTS" # additional JVM options to add to either JAVA_OPTS or K...
StarcoderdataPython
11342205
# -*- coding: utf-8 -*- ''' File name: code\factorial_digit_sum\sol_20.py Author: <NAME> Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #20 :: Factorial digit sum # # For more information see: # https://projecteuler.net/problem=20 # Problem Statement ''' n! m...
StarcoderdataPython
80800
<filename>ADVANCED/chapter05_02.py # Chapter05-2 # 파이썬 심화 # 파이썬 클래스 관련 메소드 심화 # private 속성실습 # - self.__a : `__` 이용한 private 변수 생성하여 instence 에서 접근불가능하게 만든다. # - Getter, Setter 이용하여 메소드를 활용해서 변경가능하게 만든다. # - 변수명으로 method 생성하는 것이 관례 # - Getter : @property 어노테이션 이용함 # - Setter : @[...
StarcoderdataPython
312759
import pandas as pd import plotly.express as px import plotly.graph_objects as go import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import glob #import matplotlib.pyplot as plt #from wordcloud import WordCloud, STOPWORDS from PIL import Image ...
StarcoderdataPython
3367964
<filename>src/preprocess_CR/S5_proxy_grounded.py import pickle import random import math from pathlib import Path from typing import Tuple, List, Dict, DefaultDict, Counter, Iterable, Optional from nltk.corpus import stopwords from tqdm import tqdm from data import GroundedWord, Sentence, LabeledDoc procedural_words...
StarcoderdataPython
3366507
<reponame>jwestraadt/GrainSizeTools # ============================================================================ # # # # This is part of the "GrainSizeTools Script" # # A Python script for characterizing g...
StarcoderdataPython
61598
<filename>DigikalaCommentVerification/prepare.py import pandas import re USELESS_WORDS = ['از', 'با', 'که', 'تا', 'در', 'اگر', 'اگه', 'یه', 'به', 'دیجی', 'دیجیکالا', 'خیلی', 'خریدم', 'عالی'] NUM_OF_TRAIN_COMMENTS = 180000 NUM_OF_TEST_COMMENTS = 18000 train_comments = pandas.read_csv('Files/train.csv', index_col='id'...
StarcoderdataPython
12833092
##### INITIALIZATION # Import Modules import pygame # Initialize PyGame pygame.init() # Initialize game window screen = pygame.display.set_mode((1280, 960)) ##### MAIN PROGRAM # Loop until the window is closed window_open = True while window_open: for event in pygame.event.get(): if event.type == pyga...
StarcoderdataPython
6593777
<gh_stars>0 """ Split activity window """ import tkinter import tkinter.ttk from gui.labeled_combobox import LabeledCombobox from gui.labeled_textbox import LabeledTextbox import model.activity import model.project from model.project import Project from model.activity import Activity import config class ActivitySplit...
StarcoderdataPython
9722228
#!/usr/bin/env python ''' Creates a certificate template with merge tags for recipient/assertion-specific data. ''' import json import os import uuid import configargparse from cert_tools import helpers from cert_tools import jsonpath_helpers from cert_core.cert_model.model import scope_name from cert_schema import...
StarcoderdataPython
3260620
<filename>decision.py """ decision.py Code for representing decisions including predicting decisions based on a player model and assessing goals based on decision information. """ import random import utils from packable import pack, unpack from diffable import diff import perception import choice from base_types...
StarcoderdataPython
3471565
<filename>Python/TurnTicketDispenser/test_turn_ticket.py import unittest from turn_ticket import TicketDispenser class TicketDispenserTest(unittest.TestCase): def test_do_something(self): dispenser = TicketDispenser() ticket = dispenser.getTurnTicket() if __name__ == "__main__": unittest.main(...
StarcoderdataPython
3479197
<filename>survol/sources_types/oracle/schema/oracle_schema_package_bodies.py<gh_stars>1-10 #!/usr/bin/env python """ Oracle package bodies """ import sys import logging from lib_properties import pc import lib_oracle import lib_common from sources_types.oracle import schema as oracle_schema from sources_types.oracle...
StarcoderdataPython
163121
<reponame>jmmshn/api from typing import List, Optional, Tuple from collections import defaultdict import warnings from mp_api.core.client import BaseRester from mp_api.gb.models import GBTypeEnum class GBRester(BaseRester): suffix = "gb" def search_gb_docs( self, task_ids: Optional[List[st...
StarcoderdataPython
6649157
# Copyright (c) 2016 CORE Security Technologies # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # Author: <NAME> (@agsolino) # # Description: # RFC 4511 Minimalistic implementation. We don't need much f...
StarcoderdataPython
1874902
<gh_stars>10-100 # MIT LICENSE # # Copyright 1997 - 2020 by IXIA Keysight # # 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, including without limitation # the rights to u...
StarcoderdataPython
8150194
<reponame>magicly/sample-factory """ Fake implementation of faster-fifo that just routes all function calls to multiprocessing.Queue. Can be useful on platforms where faster-fifo does not work, e.g. Windows. """ import multiprocessing from queue import Empty class Queue: def __init__(self, max_size_bytes=200000)...
StarcoderdataPython
9796435
from model import Product class InputView: def enter_info(self): print('[InputView]') id_ = int(input('Product ID: ')) name_ = input('Name: ') price_ = float(input('Price: ')) quantity_ = int(input("Quantity: ")) date_ = input('Date Added: ') return id_, nam...
StarcoderdataPython
1989059
# -- coding: utf-8 -- import gzip import os import pickle import numpy as np from neuron_network.activation_function import sigmoid, softmax_avoid_overflow def one_hot_function(x, num_class=None): """one_hot label into vector""" if not num_class: num_class = np.max(x) + 1 ohx = np.zero...
StarcoderdataPython
69942
# coding=utf-8 import copy import time from service.mahjong.models.hutype.basetype import BaseType from service.mahjong.constants.carddefine import CardType from service.mahjong.models.hutype.basetype import BaseType from service.mahjong.constants.carddefine import CardType, CARD_SIZE from service.mahjong.models.card....
StarcoderdataPython
220038
""" fuocore.library --------------- """ import logging from .utils import log_exectime logger = logging.getLogger(__name__) class Library(object): """library manages a set of providers Library is the entry point for music resources """ def __init__(self): self._providers = set() def r...
StarcoderdataPython
6590310
<reponame>ark120202/ModDotaFAQ import simplejson import string import time import traceback import logging import requests ID="api" #this is our command identifier, so with conventional commands, this is the command name permission=0 #Min permission required to run the command (needs to be 0 as our lowest command is 0)...
StarcoderdataPython
1776620
<reponame>xtero/webSound from setuptools import setup setup( name='webSound', version='0.1', description='Web server to handle notification handle trigger sounds', author='<NAME>', author_email="<EMAIL>", packages=['animator'], install_requires=[ 'flask', ...
StarcoderdataPython
4801544
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: segmentation.py # Author: <NAME> <<EMAIL>> import numpy as np from math import ceil import cv2,colorsys import pydensecrf.densecrf as dcrf import os, sys from tensorpack.utils import logger from tensorpack.utils.palette import PALETTE_RGB __all__ = ['update_confus...
StarcoderdataPython
1770247
<reponame>Gabr0/randomtestspython<filename>reversedstr.py<gh_stars>0 class ReversedStr(str): def __new__(*args,**kwargs): self = str.__new__(*args, **kwargs) self = self[::-1] return self
StarcoderdataPython
9735126
from django.db import models from django.contrib.auth.models import User from translation_app.models import Origin from file_app.models import UserIcon, AchievementIcon # Create your models here. class UserProfile(models.Model): description = models.TextField('О себе', max_length=1000, blank=True, null=True) ...
StarcoderdataPython
12807688
#!/usr/bin/env python # Copyright 1996-2019 Cyberbotics 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 # # Unless required by applica...
StarcoderdataPython
12855413
import pygame from gui_components.gui_util import get_font, BLACK, BLUE, GRAY class Cell: def __init__(self, value, row, col, width, height): self.value = value self.temp = 0 self.row = row self.col = col self.width = width self.height = height self.set_by...
StarcoderdataPython
11356301
<reponame>sirodoht/mataroa<gh_stars>10-100 from datetime import timedelta from django.conf import settings from django.core import mail from django.core.management.base import BaseCommand from django.utils import timezone from main import models, util def get_mail_connection(): """Returns the default EmailBacke...
StarcoderdataPython
3540530
<reponame>absltkaos/indy-sdk import json import pytest from indy import anoncreds, error async def _check_catpol(wallet_handle, cred_def_json, cred_def_id, cred_id, cred_value, offer_json, cred_req, cred_req_metadata, taggables, retroactive, query_attrs, expect_cred_ids, expect_policy): #...
StarcoderdataPython
6507888
<reponame>gabrielamelian/django-docker-code-test<gh_stars>0 from __future__ import absolute_import, unicode_literals from django.conf import settings from django.conf.urls import include, url CACHE_TIME = getattr(settings, 'ROBOTS_CACHE_TIMEOUT', 60*60) urlpatterns = [ url(r'', include("questionnaire.urls")), ...
StarcoderdataPython
1918557
<reponame>cathy-ludwig/courtcase_tracker import datetime import pytz import requests from bs4 import BeautifulSoup def update_db(conn, table_rows): # Creating a cursor object using the cursor() method cursor = conn.cursor() for table_row in table_rows[3:]: try: cname, date, time, heari...
StarcoderdataPython
330067
<reponame>ArturGajowy/rchain<filename>integration-testing/test/test_repl.py import pytest import conftest from rnode_testing.rnode import started_standalone_bootstrap_node def without_banner_and_prompt(input, output): banner_and_prompt = '\x1b[31m\n ╦═╗┌─┐┬ ┬┌─┐┬┌┐┌ ╔╗╔┌─┐┌┬┐┌─┐ ╦═╗╔═╗╔═╗╦ \n ╠╦╝│ ├─┤├─┤││...
StarcoderdataPython
4846479
# DomirScire import operator PEOPLE = [('Donald', 'Trump', 7.85), ('Vladimir', 'Putin', 3.626), ('Jinping', 'Xi', 10.603)] def format_sort_records(list_of_tuples): output = [] template = '{1:10} {0:10} {2:5.2f}' for person in sorted(list_of_tuples, key=operator.it...
StarcoderdataPython
9632279
"""577 · Merge K Sorted Interval Lists""" """ Definition of Interval. class Interval(object): def __init__(self, start, end): self.start = start self.end = end """ class Solution: """ @param intervals: the given k sorted interval lists @return: the new sorted interval list """ ...
StarcoderdataPython
9645638
default_app_config = 'apps.index.apps.IndexAppConfig'
StarcoderdataPython
6678019
<reponame>segrids/arduino_due<gh_stars>1-10 """ MIT License Copyright (c) 2021 by <NAME> <<EMAIL>> 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, including without limitatio...
StarcoderdataPython
3562991
import logging from django.conf import settings from rest_framework.response import Response from django_telegram.bot.middleware import TelegramMiddleware SEND_MSG_F = 'django_telegram.bot.middleware.send_message' def cond_fn(data): raise Exception('ERR') def test_process_response_not_json(mocker): mock_...
StarcoderdataPython
5081634
import pygame, sys, random def draw_floor(): screen.blit(floor_surface, (floor_x_pos,900)) screen.blit(floor_surface, (floor_x_pos + 576,900)) def create_pipe(): random_pipe_pos = random.randint(350,800) bottom_pipe = pipe_surface.get_rect(midtop = (700,random_pipe_pos)) top_pipe = pipe_s...
StarcoderdataPython
310004
# Copyright 2022 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 by applicable law or ...
StarcoderdataPython
4930461
<reponame>eclipse-ib/Software-University-Fundamentals_Module numbers = input().split(", ") new_numbers = [] for i in numbers: if int(i) == 0: pass else: new_numbers.append(int(i)) for i in numbers: if int(i) == 0: new_numbers.append(0) print(f"{new_numbers}")
StarcoderdataPython
5002903
import subprocess from invoke import task SRC_DIR = "signal_interpreter_server" TEST_DIR = "tests" UNIT_DIR = "tests/unit" INTEGRATION_DIR = "tests/integration" COV_PATH = ".coveragerc" @task def style(_): cmd = f"pycodestyle {SRC_DIR} --ignore=E501" subprocess.call(cmd, shell=True) @task def style_test(_): ...
StarcoderdataPython
8044240
import pytest # we need to register the utils helper for assert rewriting in order to get descriptive assertion errors. pytest.register_assert_rewrite("services.ui_backend_service.tests.integration_tests.utils")
StarcoderdataPython