id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
6680585
'''Desenvolva um programa que pergunte a distância de uma viagem em Km. Calcule o preço da passagem, cobrando R$0,50 por Km para viagens de até 200Km e R$0,45 parta viagens mais longas.''' dist = float(input('qual a distância da viagem? ')) print(f'você está prestes a fazer uma viagem de {dist:.2f}km.') if dist <= 200...
StarcoderdataPython
3426306
<reponame>corochann/chainerchem # --- Configuration --- # --- Constant definitions --- # The maximum atomic number in rdkit MAX_ATOMIC_NUM = 117
StarcoderdataPython
3366063
<filename>predict.py import random import torch from torch.autograd import Variable from train_util import variable_from_sentence class ModelPredictor(object): def __init__(self, encoder, decoder, input_lang, output_lang, max_length): self.encoder = encoder self.decoder = decoder self.i...
StarcoderdataPython
8187203
<filename>tests/test_dataset_KDD99.py import os import pandas as pd from pandas import Int64Index from tests.abstract.t_roughset import AbstractClasses class TestRoughSet(AbstractClasses.TBase): """ Run tests for dataset: KDD99 """ def setUp(self): self.enabled = True #...
StarcoderdataPython
6631229
<reponame>brnor/dipl from gym_puyopuyo.env import register # noqa: F401
StarcoderdataPython
1616950
# Functions to convert HSV colors to RGB colors lovingly ported from FastLED # # The basically fall into two groups: spectra, and rainbows. # Spectra and rainbows are not the same thing. Wikipedia has a good # illustration here # http://upload.wikimedia.org//wikipedia//commons//f//f6//Prism_compare_rainbow_01.png...
StarcoderdataPython
74161
""" --- Day 21: RPG Simulator 20XX --- <NAME> got a new video game for Christmas. It's an RPG, and he's stuck on a boss. He needs to know what equipment to buy at the shop. He hands you the controller. In this game, the player (you) and the enemy (the boss) take turns attacking. The player always goes first. Each att...
StarcoderdataPython
5169090
<reponame>Ne02ptzero/swift3 # Copyright (c) 2014 OpenStack Foundation. # # 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...
StarcoderdataPython
8005744
#!/usr/bin/env python import os def test_simple(): here = os.path.dirname(os.path.realpath(__file__)) main = os.path.join(here, "main.py") assert os.path.isfile(main) if __name__ == "__main__": test_simple() print("Test passed. main.py file exists.")
StarcoderdataPython
4905096
<gh_stars>100-1000 # Copyright (c) 2021, <NAME> # License: MIT License from pathlib import Path import ezdxf DIR = Path("~/Desktop/Outbox").expanduser() doc = ezdxf.new() # setting the data doc.header["$USERI1"] = 4711 doc.header["$USERR1"] = 3.141592 # reading the data i1 = doc.header["$USERI1"] r1 = doc.header["...
StarcoderdataPython
5041474
import os import jieba import numpy as np from scipy.special import softmax from onnxruntime import GraphOptimizationLevel, InferenceSession, SessionOptions, get_all_providers from gpt2_tokenizer import GPT2Tokenizer def create_model_for_provider(model_path: str, provider: str= 'CPUExecutionProvider') -> InferenceSe...
StarcoderdataPython
3508381
<gh_stars>0 # -*- coding: utf-8 -*- # Import dependencies import uuid import bcrypt # https://github.com/pyca/bcrypt/, https://pypi.python.org/pypi/bcrypt/2.0.0 # Import the database object from the main app module from flask import json from app import login_manager, app # create logger with 'spam_application' fr...
StarcoderdataPython
8078749
from symbl.utils import wrap_keyboard_interrupt, Thread, Log from symbl.utils.Helper import initialize_api_client from symbl.jobs_api.JobStatus import JobStatus from symbl_rest import JobsApi import time class Job(): __INTERVAL_TIME_IN_SECONDS = 5 ## in seconds def __init__(self, job_id: str, conversation_...
StarcoderdataPython
8085245
<gh_stars>0 # Your Token for Telegram Bot, get it on Bot Father TOKEN = "TOKEN" # Start message start_msg = "Benvenuto nel Bot relativo allo stand del MakerSpace di Fabriano! Digita il comando /info per ottenere "\ "maggiori informazioni riguardanti questa realtà o digita il comando /timeline per visu...
StarcoderdataPython
364977
# ---------------------------------------------------------------------------- # Gimel Studio Copyright 2019-2021 by <NAME> and contributors # # 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
369547
<reponame>minhduccao/PomoBot import os import discord from dotenv import load_dotenv from discord.ext import commands import configparser import asyncio from enum import Enum from timer import Timer from timer import TimerStatus DEBUG = True # For debug messages SETTING_OPTIONS = ['...
StarcoderdataPython
9761614
import requests import json import os import re import sys import pickle from googleapiclient.discovery import build from email.mime.text import MIMEText import base64 def config_check(): path = os.getcwd() if os.path.exists(os.path.join(path, 'config.json')): with open('config.json', 'r') as f: ...
StarcoderdataPython
6674338
# unet.py # # <NAME> # 25-10-2019 # # Implementation of the U-net architecture for image segmentation for the # Kaggle cloud classifaction competition. Note that the code is somewhat # specific to the image sizes in this compeitition and would require a # fair bit of tweaking to adapt to other problems. import tenso...
StarcoderdataPython
4988056
<gh_stars>0 ################################################### # Here you'll find the model itself. Tune it, and # # don't forget to take out all hyperparameters to # # config files! # ################################################### from keras.layers import Input, Conv2D, MaxPoo...
StarcoderdataPython
11261560
<filename>homeassistant/components/sense/__init__.py """Support for monitoring a Sense energy sensor.""" import asyncio from datetime import timedelta import logging from sense_energy import ( ASyncSenseable, SenseAPITimeoutException, SenseAuthenticationException, ) import voluptuous as vol from homeassis...
StarcoderdataPython
6415187
<reponame>aliaskar25/instagram_copy from rest_framework import routers from .views import PostView router = routers.DefaultRouter() router.register('', PostView) urlpatterns = router.urls
StarcoderdataPython
4875143
<reponame>ermekaitygulov/STIT ## Pretrained models paths e4e = './pretrained_models/e4e_ffhq_encode.pt' stylegan2_ada_ffhq = 'pretrained_models/ffhq.pkl' ir_se50 = './pretrained_models/model_ir_se50.pth' ## Dirs for output files checkpoints_dir = './checkpoints' ## Keywords pti_results_keyword = 'STIT' ## Edit direc...
StarcoderdataPython
1960021
"""Post utilities""" import re from typing import Union from koabot import koakuma from koabot.utils.base import list_contains def get_name_or_id(url: str, /, *, start: Union[str, list] = [], end: Union[str, list] = ['?'], pattern: str = "") -> str: """Get a name or an id from an url Arguments: url::...
StarcoderdataPython
6435119
import os from ConfigParser import ConfigParser from ingenico.connect.sdk.communicator_configuration import CommunicatorConfiguration from ingenico.connect.sdk.defaultimpl.authorization_type import AuthorizationType from ingenico.connect.sdk.defaultimpl.default_authenticator import DefaultAuthenticator from ingenico.c...
StarcoderdataPython
1985468
""" input """ name = input("Please enter your name:") print("Hello,") print(name)
StarcoderdataPython
1952860
from .material_lib import MaterialLib from .treat_material import TreatMaterial from .libraries import * from . import colors
StarcoderdataPython
8014251
import json import unittest from baseSetUp import Base class EditRides(Base): def setUp(self): super().setUp() self.app.post('/api/v1/users/rides', data=json.dumps(self.ride), content_type='application/json', ...
StarcoderdataPython
11343752
import os import sqlite3 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Hotel_Booking.settings") import django django.setup() from Aconchego.models import Room, Hotel, Fotos hotel = Hotel( name="Kirimizi Hotel", localizacao='Pemba, Mozambique', categoria =4, descricao="Kirimizi Hotel & Restauran...
StarcoderdataPython
3279496
# Generated by Django 3.1.3 on 2020-11-28 05:18 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('bagiapi', '0003_auto_20201128_1209'), ] operations = [ migrations.AlterField( model_name='enrollment', name='reward'...
StarcoderdataPython
4819081
import requests from django.shortcuts import render from django.conf import settings def oauthtest(request): return render(request, 'oauthtest.html', { 'link': '{}o/authorize/?response_type=code&client_id={}&redirect_uri={}{}/oauthdone/'.format( settings.API_URL, settings.OAUTH_CLIE...
StarcoderdataPython
6452357
# Generated by Django 2.2.8 on 2020-04-10 01:40 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('exams', '0007_auto_20200410_0111'), ] operations = [ migrations.AlterField( model_name='questio...
StarcoderdataPython
325765
<gh_stars>10-100 input = """ 8 2 2 3 0 0 8 2 4 5 0 0 8 2 6 7 0 0 6 0 4 0 2 3 4 5 1 1 1 1 0 4 c 3 b 7 f 2 a 6 e 5 d 0 B+ 0 B- 1 0 1 """ output = """ COST 2@1 """
StarcoderdataPython
1824433
<reponame>IntelPython/scikit-ipp # -*- coding: utf-8 -*- """ ============== Edge operators ============== Edge operators are used in image processing within edge detection algorithms. They are discrete differentiation operators, computing an approximation of the gradient of the image intensity function. """ im...
StarcoderdataPython
3357788
""" Defines the tbmodels command-line interface. """ import os from collections.abc import Iterable from functools import singledispatch import click import bands_inspect as bi import symmetry_representation as sr from . import Model @click.group() def cli(): pass def _output_option(**kwargs): return cli...
StarcoderdataPython
6605128
from typing import Callable, Any from py4j.java_gateway import JavaObject from keanu.functional.hash_shortener import shorten_hash class BiConsumer: def __init__(self, lambda_function: Callable[[JavaObject, JavaObject], None]) -> None: self.lambda_function = lambda_function def accept(self, arg1: ...
StarcoderdataPython
1746042
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # # Description: delivering inputs and targets for the dlrm benchmark # The inpts and outputs are used according to the following two option(s)...
StarcoderdataPython
3452660
<gh_stars>0 '''Example 4.5 c-Section wlps (LRFD). <NAME>; <NAME> "Cold-formed steel design" (2020). WILEY. p137 ''' import steeldesign as sd # creo perfil p1 = sd.c_w_lps_profile(H= 10.0, B= 3.5, D= 0.720, t= 0.075, r_out= (0.075+3/32) ) # creo material s = sd.steel(FY= 50, E0= 27000, nu= 0.3, n= 4.58, offset= 0.00...
StarcoderdataPython
8195893
<gh_stars>0 # -*- coding:utf-8 -*- """ 导表工具GUI界面 @author: 覃贵锋 @date: 2020-02-17 """ from PyQt4.Qt import * import os import json import uuid import time import random import Utils import Language import BackService from Config import Config class ExportToolGUI(QMainWindow): """ GUI 主界面 """ def...
StarcoderdataPython
4996150
# -*- coding: utf-8 -*- """ Created on Sat Apr 23 20:00:49 2016 @author: lykke """ # -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import kivy import kivy.uix kivy.require('1.9.0') from kivy.garden.mapview import MapView from kivy.garden.mapview import MapMarker from kivy.app import...
StarcoderdataPython
5117072
<filename>flow/function.py from . import autograd from .utils import _make_pair from .tensor import Tensor, ones, zeros, transpose import numpy as np class Add(autograd.Function): @staticmethod def forward(ctx, a, b, inplace=False): if inplace: a.data += b.data return a ...
StarcoderdataPython
5104908
<filename>python/filemgmt/metadefs.py #!/usr/bin/env python WCL_META_SECT = 'filemeta' WCL_META_HEADERS = 'headers' WCL_META_COMPUTE = 'compute' WCL_META_WCL = 'wcl' WCL_UPDATE_HEAD_PREFIX = 'hdrupd_' WCL_UPDATE_WHICH_HEAD = 'headers' WCL_META_REQ = 'req_metadata' WCL_META_OPT = 'opt_metadata' MD_EXIT_FAILURE = 1
StarcoderdataPython
8159706
<filename>zyte_api/apikey.py # -*- coding: utf-8 -*- import os from typing import Optional from .constants import ENV_VARIABLE class NoApiKey(Exception): pass def get_apikey(key: Optional[str] = None) -> str: """ Return API key, probably loading it from an environment variable """ if key is not None: ...
StarcoderdataPython
1841859
import uuid import pytest from sqlalchemy.exc import IntegrityError from sqlalchemy.orm.exc import ObjectDeletedError from quetz import errors, rest_models from quetz.dao import Dao from quetz.database import get_session from quetz.db_models import Channel, Package, PackageVersion @pytest.fixture def package_name()...
StarcoderdataPython
6448122
""" Download youtube video """ import pytube # url = 'https://youtu.be/fp0O7kp0uW8' # Load url in function Youtube # youtube = pytube.YouTube(url) # Set Streams Resolution # video = youtube.streams.first() # or # video = youtube.streams.get_highest_resolution() # Download Video # video.download() # In Same Folder ...
StarcoderdataPython
11234231
import os import numpy as np import scipy.sparse from sklearn import datasets def load_dataset(args): path = f"{args.data_folder}/{args.function_name}" X, y = datasets.load_svmlight_file(f"{path}.svm") w = np.load(f"{path}.npy") return X, y, w def store_dataset(X, y, w, args): folder = f"{args....
StarcoderdataPython
177633
<filename>python/verify.py ##----------------------------------------------------------------------------- ## Import ##----------------------------------------------------------------------------- import argparse, os from time import time from fnc.extractFeature import extractFeature from fnc.matching import matching...
StarcoderdataPython
6503505
class SymbolTable: def __init__(self): self.table = {} def add_symbol(self, symbol, symbol_type): if self.symbol_exists(symbol): print("TYPE CHECKING ERROR, SYMBOL ALREADY EXISTS (UNIQUENESS CHECK):", symbol, symbol_type) else: self.table[symbol] = symbol_type ...
StarcoderdataPython
11342811
<reponame>baquerrj/ECEN5623 #!/usr/bin/python3.7 import numpy as np import sys def print_execution_times( transform, file ): deltaTimes = [] with open(file) as f: for line in f.readlines(): if transform in line.upper() and 'END' in line.upper(): items = line.split(' ') delt...
StarcoderdataPython
1962081
<filename>.github/script/tags_to_plugins.py import os import shutil from pathlib import Path from typing import Dict import yaml from git import Repo, Diff poc_dir_list = ['cves', 'cnvd', 'vulnerabilities', 'default-logins', 'exposures', 'miscellaneous'] class MyDumper(yaml.Dumper): def increase_indent(self, fl...
StarcoderdataPython
8016069
<filename>sql2eml.py import re import os import argparse import sys import errno import optparse import sqlite3 import uuid import email import email.utils from email.message import EmailMessage from email.parser import BytesParser, Parser from email.policy import default from datetime import datetime import hashlib...
StarcoderdataPython
1862724
<reponame>dcavar/dcavar.github.io<filename>LID/resources/lidtrainer.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ $Revision: 0.3 $ $Date: 2004/12/01 11:00:00 $ $Id: lidtrainer.py,v 0.3 2008/11/23 10:50:00 dcavar Exp $ (C) 2003-2011 by <NAME> <<EMAIL>> License: This program is free software; you can redistri...
StarcoderdataPython
8042368
<gh_stars>1-10 #!/usr/bin/env python """RDFValues for the NSRL file store.""" from grr.lib import rdfvalue from grr.proto import jobs_pb2 class NSRLInformation(rdfvalue.RDFProtoStruct): protobuf = jobs_pb2.NSRLInformation
StarcoderdataPython
201931
import os import json import numpy as np from imagededup.utils import general_utils def test_get_files_to_remove(): from collections import OrderedDict dict_a = OrderedDict({'1': ['2'], '2': ['1', '3'], '3': ['4'], '4': ['3'], '5': []}) dups_to_remove = general_utils.get_files_to_remove(dict_a) ass...
StarcoderdataPython
3549577
#!/usr/bin/env python import argparse import os import os.path as osp import re import chainer import numpy as np import skimage.io import fcn def infer(n_class): parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-g', '--gpu', default=0, ...
StarcoderdataPython
3286224
<filename>UIU/cen_uiu/helpers/bus.py<gh_stars>0 import asyncio import dbus from dbus.proxies import ProxyObject import logging Logger = logging.getLogger(__name__) _LOGGER = Logger """ bus object used to interface with a dbus proxy or interface object. used to create subclasses (act as a baseclass). """ class BusObje...
StarcoderdataPython
1930766
<filename>bin/ansible/ansible/modules/package_facts.py #!/usr/bin/python # (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # most of it copied from AWX's scan_packages module from __future__ import absolute_import, division, print_function __metac...
StarcoderdataPython
74278
<filename>tardis/default_settings/__init__.py # pylint: disable=wildcard-import # first apps, so other files can add to INSTALLED_APPS from tardis.default_settings.apps import * from tardis.default_settings.admins import * from tardis.default_settings.analytics import * from tardis.default_settings.auth import * from...
StarcoderdataPython
3200860
import click import torchvision.models.resnet as resnet from artlearn.common_utils import ( LOG_DIR, MODEL_DIR, get_dataloaders, ArtistLearner ) @click.command() @click.option('--mode', type=str, default='sgd', help='Which optimizer you wish to use, currently supports ' 'SGD ...
StarcoderdataPython
11332681
#!/usr/bin/env python3 # Copyright (C) <2020-2021> Intel Corporation # SPDX-License-Identifier: MIT import tensorflow as tf import cv2 import numpy as np from openvino.inference_engine import IECore, IENetwork import os from tensorflow.python.ops import gen_nn_ops tf.enable_eager_execution() default_config = { '...
StarcoderdataPython
8002737
# coding: utf-8 """ Account Management API API for managing accounts, users, creating API keys, uploading trusted certificates OpenAPI spec version: v3 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re class Ac...
StarcoderdataPython
4843172
<gh_stars>0 import discord from core import checks from core.models import PermissionLevel from discord.ext import commands class idk(commands.Cog): """ Nothing Is Here """ def __init__(self, bot): self.bot = bot self.db = bot.plugin_db.get_partition(self) @commands.command(alias...
StarcoderdataPython
9738835
<filename>infotrope/environment.py<gh_stars>1-10 # # Copyright 2004 - 2006 <NAME> <<EMAIL>> # # This file forms part of the Infotrope Python Library. # # The Infotrope Python Library 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...
StarcoderdataPython
3269656
from __future__ import print_function, absolute_import from autoundo import AutoUndo import numpy as np undo = AutoUndo('mystack', strict=False) from example_module import MyVal, f1, some_list a = MyVal() b = [] c = {0, 1, 2, 3, 4} d = { 'a': 1, 'b': 2, 'c': 3 } e = [[0, 1, 2, 3], 3, 5, 6, [4, 5, 6]] ...
StarcoderdataPython
6466159
<filename>project/api/views/password_reset.py<gh_stars>0 from rest_framework import generics, status from rest_framework.response import Response from rest_framework.exceptions import AuthenticationFailed from rest_framework.permissions import AllowAny from db.serializers import SetNewPasswordSerializer from db.model...
StarcoderdataPython
9602758
<reponame>valosekj/spinalcordtoolbox<filename>spinalcordtoolbox/gui/base.py<gh_stars>1-10 """Base classes for creating GUI objects to create manually selected points. The definition of X,Y axis is the following: xmin,ymin o---------o xmax,ymin | | | | | | ...
StarcoderdataPython
1709423
from util.observe import Observable from util.primitives.funcs import do class SlotsSavable(object): ''' Prereqs: 1) use slots 2) only store persistent information in slots 3) child objects stored in slots must also be SlotSavable (or pickleable) ''' def __getstate__(self): return...
StarcoderdataPython
8095345
<reponame>openeuler-mirror/A-Tune-Collector<gh_stars>0 #!/usr/bin/python3 # -*- coding: utf-8 -*- # Copyright (c) 2019 Huawei Technologies Co., Ltd. # A-Tune is licensed under the Mulan PSL v2. # You can use this software according to the terms and conditions of the Mulan PSL v2. # You may obtain a copy of Mulan PSL v2...
StarcoderdataPython
9672091
from flask import Flask from flask import render_template app = Flask(__name__) @app.route('/hello/<name>') def hello_world(name): return render_template('hello.html', name=name) @app.route('/user/<username>', methods=['POST','GET']) def show_user_profile(username): # show the user profile for that user ...
StarcoderdataPython
56031
""" #################### Create a low hydro scenario Date applied: 2021-07-29 Description: This script adds a scenario to the database for low hydro power. The worst year for hydro is 2015. As such we use those values for every year unless a plant is missing in 2015 in which case we use the lowest value in the other y...
StarcoderdataPython
6539136
<reponame>NirmaniWarakaulla/HackerRankSolutions def getNode(llist, positionFromTail): stk = [] t = llist while t: stk = [t.data] + stk t = t.next return stk[positionFromTail]
StarcoderdataPython
192901
import json import urllib2 import uuid def checkin(id): try: result=urllib2.urlopen('http://stats.kennytheserver.com/checkin?id=%s' %id).read() return True except: pass return False def has_internet(): try: response=urllib2.urlopen('http://7172.16.31.10',timeout=5) return True except ur...
StarcoderdataPython
1689601
# External Resource Algorithms # modules import os # module def module(self, *args): # get module name module_name = str(args[0]) + '.synt' if len(args) > 0 else None # validate file path if module_name is None: self.throw(f"Module not found") else: # get module meta path module_path = self...
StarcoderdataPython
5151938
from askapdev.rbuild.builders import Scons as Builder builder = Builder(pkgname="BLAS", archivename="blas") builder.remote_archive = "blas.tgz" builder.add_file("files/SConstruct") builder.build()
StarcoderdataPython
1618702
<reponame>tungol/bplistlib # encoding: utf-8 """ This file contains classes that know how to handle various different parts of a binary plist file. """ from struct import pack, unpack from datetime import datetime from plistlib import Data from time import mktime from .functions import find_with_type, get_byte_width f...
StarcoderdataPython
11390689
<gh_stars>1-10 import numpy as np from unittest import TestCase from ezyrb import POD snapshots = np.load('tests/test_datasets/p_snapshots.npy').T poddb = np.load('tests/test_datasets/p_snapshots_pod.npy') modes = np.load('tests/test_datasets/p_snapshots_pod_modes.npy') class TestPOD(TestCase): def test_constru...
StarcoderdataPython
11341087
#!/usr/bin/env python # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. import unittest from Bio import pairwise2 class TestPairwiseGlobal(unittest.TestCase): def test_globalxx_simple(self): ...
StarcoderdataPython
6600165
import bintrees #import types import copy def str2int(s): if type(s) is int: ##it is already an int return s assert(type(s) is str) if s.startswith("0x"): ##hex s = s[2:] return int(s, 16) else: ##decimal return int(s) class Method: def addRangeToTree(self, tree, st...
StarcoderdataPython
4837255
<filename>xunsearch/__init__.py # -*- encoding: utf-8 -*- # from .xunsearch import XS from .xunsearch import XSException from .xunsearch import XSDocument from .xunsearch import XSIndex from .xunsearch import XSSearch from .xunsearch import XSTokenizer
StarcoderdataPython
3444582
def chiffre(input: str, key: int, direction: str) -> str: input = input.lower() output = "" if direction == "encrypt": for letter in input: if letter.isalpha(): temp = ord(letter) temp = temp + key if temp > 122: temp_ke...
StarcoderdataPython
15524
# theory MPD client # Copyright (C) 2008 <NAME> <<EMAIL>> # # 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 3 of the License, or # (at your option) any later version. # # This pr...
StarcoderdataPython
109768
<gh_stars>0 import os from shutil import copyfile from absl import app from absl import flags import sys import numpy as np from math import isclose FLAGS = flags.FLAGS flags.DEFINE_string(name = 'data_path', default = 'extracted_actions', help = 'The path to the data.') flags.DEFINE_string(name = 'save_path', de...
StarcoderdataPython
4800367
import random import hangman_art import hangman_words print(hangman_art.logo) # Pick word and prepare chosen_word = random.choice(hangman_words.word_list) display = [] word_length = len(chosen_word) for i in range(word_length): display += "_" life = 6 while life > 0 and ("_" in display): print(display) ...
StarcoderdataPython
6479971
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from yk_utils.models import Model from yk_utils.models import deserialization class VerifyImagesResponse(Model): """NOTE: This class is auto generated by the swagge...
StarcoderdataPython
3500292
""" shutit.tk.setup (core ShutIt setup module) Nomenclature: - Host machine: Machine on which this script is run. - Target: Environment to which we deploy (docker container or bash shell) - Container: Docker container created to run the modules on. - target_child pexpect-spawned chil...
StarcoderdataPython
3518856
<reponame>dpfens/tzktPy<filename>tzktpy/right.py from .base import Base __all__ = ('Right', ) class Right(Base): __slots__ = ('type', 'cycle', 'level', 'timestamp', 'priority', 'slots', 'baker', 'status') def __init__(self, type, cycle, level, timestamp, priority, slots, baker, status): self.type = t...
StarcoderdataPython
1765102
<gh_stars>0 import numpy as np import cv2 # 画像を読み込み Array{Float32,1} に変換 def load_img(filename: str) -> np.ndarray: # cv2.imread の第2引数を0にするとグレースケールで読み込む return np.float32(cv2.imread(filename, 0)) if __name__ == "__main__": # sample1, sample2 画像読み込み img1: np.ndarray = load_img('./puppeteer/screenshot/s...
StarcoderdataPython
149669
<reponame>766F6964/Euler-Problems<filename>Python/Problem021.py<gh_stars>1-10 def get_divisors(n): sum = 1 for i in range(2, int(n ** 0.5 + 1)): if n % i == 0: sum += i sum += n / i return sum def find_amicable_pair(): total = 0 for x in range(1, 10001): a =...
StarcoderdataPython
6632085
<reponame>d34dh0r53/python-tripleoclient # Copyright 2019 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
StarcoderdataPython
1992474
import random import torch import omnifig as fig @fig.AutoComponent('cyclegan-buffer') class ReplayBuffer: def __init__(self, max_size=50): assert max_size > 0, "Empty buffer or trying to create a black hole. Be careful." self.max_size = max_size self.data = [] def push_and_pop(self...
StarcoderdataPython
3303073
""" <NAME>, ПИ19-4 Задания 1-12 """ import random from itertools import permutations class Task1(object): """ Нaпишите программу, на вход которой подаётся список чисел одной строкой. Программа должна для каждого элемента этого списка вывести сумму двух его cоседей. Для элeментов списка, являющиx...
StarcoderdataPython
6542626
from django.apps import AppConfig class CumploApiConfig(AppConfig): name = 'internal_api'
StarcoderdataPython
1923880
<reponame>mfonism/us-pycon-2019-tutorial from setuptools import setup setup(name="proj", packages=["proj"])
StarcoderdataPython
3453563
<filename>news/tests/test_api_views.py<gh_stars>0 from django.core.files.uploadedfile import SimpleUploadedFile from django.urls import reverse from django.test import TestCase, Client, override_settings from django.contrib.auth.models import User, Permission, Group from django.utils import timezone import json from da...
StarcoderdataPython
1614113
# -*- coding: utf-8 -*- import argparse import logging import random from collections import Counter import math import numpy as np import pandas as pd import torch from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping from pytorch_lightning.core.lightning import ...
StarcoderdataPython
3572087
from rest_framework import serializers from main.models import Ingrediente,Sandwich,Pedido class IngredienteSerializer(serializers.ModelSerializer): class Meta: model = Ingrediente fields = '__all__' class SandwichSerializer(serializers.ModelSerializer): class Meta: model = ...
StarcoderdataPython
3570762
from .policy import ImageClassificationPolicy
StarcoderdataPython
1941876
<gh_stars>10-100 from factory.declarations import LazyAttribute, Sequence, SubFactory from factory.django import DjangoModelFactory from roster.factories import StudentFactory from exams.models import ExamAttempt, PracticeExam class ExamFactory(DjangoModelFactory): class Meta: model = PracticeExam family = 'Wal...
StarcoderdataPython
9642142
<reponame>matan-h/friendly<filename>tests/unit/test_run.py """Tests for run(), used as a program launcher from an editor """ from io import StringIO import friendly from contextlib import redirect_stdout def test_run_error_en(): friendly.run( "../name_error.py", include="explain", # comprehensive...
StarcoderdataPython
1814157
#!/usr/bin/env python # Copyright (c) 2011 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Script to synchronise the naclports mirror of upstream archives. This script verifies that the URL for every package is mi...
StarcoderdataPython
65656
from __future__ import annotations from custom_components.magic_lights.const import DOMAIN from custom_components.magic_lights.magicbase.share import get_magic import logging from typing import TYPE_CHECKING from homeassistant.core import Context _LOGGER = logging.getLogger(__name__) if TYPE_CHECKING: from custo...
StarcoderdataPython