id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
11324982
#!/usr/bin/env python3 ''' # Autor: <NAME> # Datum: 21.04.2018 # Soubor: isj_proj07_xsnase06.py ''' ''' DEKLARACE ZÁSTUPNÝCH PROMNĚNÝCH ''' NULA=0 JEDNA=1 DVA=2 TRI=3 CTYRI=4 ''' Konec deklarace ''' ''' import knihoven ''' import math ''' konec importu ''' class TooManyCallsError(Exception): ''' Třída TooManyCallsEr...
StarcoderdataPython
9755803
<reponame>sutasu/tortuga<gh_stars>10-100 # Copyright 2008-2018 Univa Corporation # # 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 r...
StarcoderdataPython
3546820
<filename>gym-BuildingControls/gym_BuildingControls/envs/bldg_models.py #!/usr/bin/env python # -*- coding: utf-8 -*- """@author: <NAME> Variable Names Uin: Conductance matrix input by user, upper triangle only, (nN x nN) (W/K) U: Conductance matrix (symmetrical) with added capacitance for diagonal term, (nN x nN) (W/...
StarcoderdataPython
11394613
import sys sys.path.append('../src') import unittest from posture import PostureWatcher class TestPostureWatcherClass(unittest.TestCase): def setUp(self): self.pw = PostureWatcher() def test_class_has_correct_attributes(self): self.assertTrue(hasattr(self.pw, 'detector')) self.assert...
StarcoderdataPython
4991137
<filename>metaprogramming/descriptor_demo.py<gh_stars>0 'Simple script showing how to use descriptors for type checking' class descriptor: def __init__(self, name, inst_typ): self.name = name self.inst_type = inst_typ def __get__(self, instance, cls): print("getting inst var", self.na...
StarcoderdataPython
5061639
#@title Apache 2.0 License # # Copyright (c) 2019 <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, ...
StarcoderdataPython
1676000
<filename>file/read-lines-between-two-values/main-find.py #!/usr/bin/env python3 text = '''DATA_out file values DATA_LINE 1 DATA_LINE 2 DATA_LINE 3 DATA_LINE 4 total ''' start = text.find('values') end = text.find('total', start) if start > -1 and end > -1: start += len("values") prin...
StarcoderdataPython
3499798
#!/usr/bin/env python # Copyright 2009 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
StarcoderdataPython
6487241
<gh_stars>1-10 import os import numpy as np from scipy.sparse import csr_matrix from perform.constants import REAL_TYPE, RES_NORM_PRIM_DEFAULT from perform.solution.solution_phys import SolutionPhys class SolutionInterior(SolutionPhys): """Physical solution of interior cells. This SolutionPhys represents t...
StarcoderdataPython
3200660
<reponame>adiitya-dey/datastructures import logging import numpy as np class BasicSort: def __init__(self, arr, sortfn): logging.debug("Sorting class is initialized.") self.__arr = arr print(sortfn) self.__sortfn = sortfn.lower() if self.__sortfn == "insertsor...
StarcoderdataPython
11263753
<reponame>rimmartin/cctbx_project<gh_stars>0 # -*- coding: utf-8 -*- from __future__ import division, absolute_import from cctbx.xray import ext from cctbx.xray import structure_factors from cctbx import miller from cctbx import crystal from cctbx import sgtbx import cctbx.eltbx.xray_scattering from cctbx import adptbx...
StarcoderdataPython
258561
"""Utility functions.""" from genologics.entities import Workflow import config def char_to_bool(letter): """Transform character (J/N) to Bool.""" if letter.upper() == 'J': return True elif letter.upper() == 'N': return False else: raise ValueError('Invalid character, only J o...
StarcoderdataPython
6559330
<gh_stars>10-100 # Copyright 2021 FIRST # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
StarcoderdataPython
5039946
from .twoRoundDeterministicRewardEnv import TwoRoundDeterministicRewardEnv
StarcoderdataPython
8046752
<reponame>Fangyh09/pysteps<filename>pysteps/io/importers.py<gh_stars>1-10 """ pysteps.io.importers ==================== Methods for importing files containing 2d precipitation fields. The methods in this module implement the following interface:: import_xxx(filename, optional arguments) where **xxx** is the nam...
StarcoderdataPython
3490054
""" Asyncio client for Zyte Data API """
StarcoderdataPython
9673146
import asyncio import logging import re from datetime import date, datetime from itertools import cycle from urllib.parse import urlencode import aiohttp from django.conf import settings from django.utils.translation import ugettext as _ from ..constants import colors, matomo_periods logger = logging.getLogger(__...
StarcoderdataPython
11221746
<reponame>mpimp-comas/npfc """ Module filter ============== This modules contains the class Filter, which is used to filter molecules using molecular descriptors. """ # data handling import logging import re # chemoinformatics from rdkit.Chem import Mol from rdkit.Chem import Crippen from rdkit.Chem import Descriptors...
StarcoderdataPython
5170223
# package org.apache.helix.manager.zk #from org.apache.helix.manager.zk import * #from java.util.concurrent import BlockingQueue #from java.util.concurrent import LinkedBlockingQueue #from java.util.concurrent.atomic import AtomicInteger #from org.I0Itec.zkclient.exception import ZkInterruptedException #from org.apache...
StarcoderdataPython
1849636
#!/usr/bin/env python # -*- coding: utf-8 -*- """Define the Action class. This file defines the `Action` class, which is returned by the policy and given to the environment. """ import copy import collections # from abc import ABCMeta, abstractmethod import numpy as np import torch import gym from pyrobolearn.utils....
StarcoderdataPython
9608979
import sys try: name = sys.argv[1] except IndexError: print(f'Error: please provide a name and a repeat count to the script') sys.exit(1) try: repeat_count = int(sys.argv[2]) except IndexError: print(f'Error: please provide a name and a repeat count to the script') sys.exit(1) except ValueErro...
StarcoderdataPython
136227
<reponame>Guillem96/ssd-pytorch<gh_stars>1-10 import click import yaml import torch import ssd import ssd.transforms as T from ssd.coco.coco_utils import get_coco_api_from_dataset device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') @click.command() @click.option('--dataset', required=True, ...
StarcoderdataPython
3215978
<gh_stars>10-100 import sys import os sys.path.append(os.path.dirname(os.path.abspath(__file__)))
StarcoderdataPython
1647596
<gh_stars>1-10 ''' given this sequence: 1, 2, 3, 4, 3, 4, 5, 6, 5, 6, 7, 8 ... deduce and between 1 and 9223372036854775807 return the corresponding numer of the sequence ''' import math def sequence(n): if 1 <= n <= 9223372036854775807: return a(n) else: return -1 def a(n): if n % 2 =...
StarcoderdataPython
1859570
<filename>vedastr/models/bodies/rectificators/__init__.py from .tps_stn import TPS_STN from .spin import SPIN from .builder import build_rectificator
StarcoderdataPython
6494818
from __future__ import division import numpy as np from resample.utils import eqf from scipy.stats import (norm, laplace, gamma, f as F, t, beta, lognorm, pareto, logistic, invgauss, poisson) def jackknife(a, f=None): ...
StarcoderdataPython
6533295
<gh_stars>0 import usys import unittest class MockConfig: def __init__(self): self.max_degrees = 10 self.speed_limit = 10 self.speed_increment = 1 class MockMotor: def __init__(self, speed): self.speed = speed def get_position(self): return self.speed usys.path.in...
StarcoderdataPython
147573
# Copyright 2014 ARM Limited # # Licensed under the Apache License, Version 2.0 # See LICENSE file for details. # standard library modules, , , import os import logging from collections import OrderedDict # access, , get components, internal from yotta.lib import access from yotta.lib import access_common # pool, , s...
StarcoderdataPython
8113200
with open("primes/primes_1000.txt", "r") as file: primes_1000 = list(map(int, file.readlines()[0].split(","))) with open("primes/primes_1000000.txt", "r") as file: primes_1000000 = list(map(int, file.readlines()[0].split(",")))
StarcoderdataPython
5028063
<filename>flopy/modflow/mfhfb.py """ mfhfb module. Contains the ModflowHfb class. Note that the user can access the ModflowHfb class as `flopy.modflow.ModflowHfb`. Additional information for this MODFLOW package can be found at the `Online MODFLOW Guide <http://water.usgs.gov/ogw/modflow/MODFLOW-2005-Guide/inde...
StarcoderdataPython
11351301
import abc from .renderer import Renderer from hail.utils.java import Env class BaseIR(object): def __init__(self): super().__init__() self._type = None def __str__(self): r = Renderer(stop_at_jir = False) return r(self) @abc.abstractmethod def parse(self, code, ref_m...
StarcoderdataPython
1614397
import operator import math import BeatFrequentPick import PatternPredictor import justRock import rps import random from pprint import pprint Debug = True Debug = False # opcode scoreBufferWin = 0 scoreBufferLost = 1 # implementations useScoreBuffer = True useScoreBuffer = False scoreReset = False # perfor...
StarcoderdataPython
388974
from .nbplot import main main()
StarcoderdataPython
1873270
try: from setuptools import setup, find_packages except ImportError: from distutils.core import setup print(find_packages()) setup( name="Weather", version='1.0.2', description='A wrapper for the Weather Underground Rest API.', author='<NAME>', author_email='<EMAIL>', license='MIT', ...
StarcoderdataPython
6469550
from __future__ import division, absolute_import, print_function import os import json import pickle from flask import Flask, request, jsonify, send_from_directory, send_file, \ render_template, redirect, url_for, abort from tinyrecord import transaction from functools import wraps from . import stats, casting, u...
StarcoderdataPython
6414040
# Copyright (c) 2021, Xilinx, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of ...
StarcoderdataPython
4816665
<reponame>ankur-gupta/rain from setuptools import setup PACKAGE_NAME = 'rain' # Read-in the version # See 3 in https://packaging.python.org/guides/single-sourcing-package-version/ version_file = './{}/version.py'.format(PACKAGE_NAME) version = {} try: # Python 2 execfile(version_file, version) except NameErro...
StarcoderdataPython
4817770
import setuptools import shutil import os path = os.path.dirname(os.path.abspath(__file__)) shutil.copyfile(f"{path}/dmm.py", f"{path}/dmm/dmm.py") #shutil.copyfile(f"{path}/dmm.py", f"{path}/dmm/gcn.py") setuptools.setup( name="DMM", version="1.0", author="<NAME>", author_email="<EMAIL>", descri...
StarcoderdataPython
45070
""" A toy example of playing against defined set of bots on Mocsár Using env "mocsar"-cfg Using 'human_mode' """ import rlcard3 # Make environment and enable human mode env = rlcard3.make('mocsar-cfg', config={'human_mode': True}) # Register agents agents = {"mocsar_random": 2, "mocsar_min": 2} env.model.create_agen...
StarcoderdataPython
1742800
<reponame>nak/pytest_mproc<gh_stars>1-10 import os import socket import sys import time from multiprocessing import Semaphore, JoinableQueue, Queue, Process from typing import Any, Dict, Iterator, Union import pytest from _pytest.config import _prepareconfig import pytest_cov.embed import resource from pytest_mproc i...
StarcoderdataPython
9709040
names = [""] emails = [""]
StarcoderdataPython
8165252
"""Detects outliers based on Chi-square test Description: ------------ """ # External library imports import numpy as np # Midgard imports from midgard.dev import plugins from midgard.gnss.solution_validation import sol_validation # Where imports from where.lib import config # Name of section in configuration _SE...
StarcoderdataPython
5131442
<reponame>spara/examples """Google Cloud Function source code for an ETA messaging app. Defines a single Cloud Function endpoint, get_demo, which will compute the estimated travel time to a location. If configured, will also send the result via SMS. """ import os from datetime import datetime import googlemaps import...
StarcoderdataPython
8019207
<reponame>moran991231/LeetCode-Solutions class Solution: def findAndReplacePattern(self, words, pattern): sz = len(pattern) ans = [] for w in words: ok = True trans = {} used = set([]) for i in range(sz): if pattern[i] not in tr...
StarcoderdataPython
152244
from django.core.exceptions import ValidationError from django.db import models from django.urls import reverse from django.db.models.deletion import CASCADE from storages.backends.sftpstorage import SFTPStorage from django.core.files.storage import FileSystemStorage from django.contrib.auth.models import User # Create...
StarcoderdataPython
5039353
import argparse import pathlib import xml.etree.ElementTree as ET import numpy as np def update_const(xml_input_filepath, bin_input_filepath, bin_output_filepath, node_id, new_value): tree = ET.parse(xml_input_filepath) for layer in tree.getroot().find('layers').findall('layer'): if layer.get('id') ==...
StarcoderdataPython
54712
from django import template register = template.Library() @register.filter def next(some_list, current_index): """ Returns the next element of the list using the current index if it exists. Otherwise returns an empty string. https://docs.djangoproject.com/en/3.0/howto/custom-template-tags/#writing-c...
StarcoderdataPython
189361
"""Useful fixtures for testing the convention document.""" import pytest from tests.test_convention_doc import doctypes @pytest.fixture def sections(): """Fixture with each convention section.""" return doctypes.SECTIONS @pytest.fixture def subsections(): """Fixture with each convention subsection."""...
StarcoderdataPython
285346
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
StarcoderdataPython
3370654
<gh_stars>0 import mysql.connector from mysql.connector import Error #Open database connection with a dictionary conDict = {'host':'localhost', 'database':'game_records', 'user':'root', 'password':''} db = mysql.connector.connect(**conDict) #preparing cursor cursor = db.cur...
StarcoderdataPython
391605
def gen_detector_intro(filename_out,seconds,fps=30): ''' Generate a video of a central dot running for the defined number of seconds, and a corner rectangle with changing brigthness, used as introduction step in experiment to calibrate the stimulus-detector syn...
StarcoderdataPython
8001124
<reponame>MS17-010/python-misc # alternative for windows # download notify-send from here: http://vaskovsky.net/notify-send/notify-send.zip # unzip the file and add notify-send.exe to environment variables OR # keep notify-send.exe in same folder where this python script is kept. from subprocess import call call(["n...
StarcoderdataPython
274486
from django.test.client import RequestFactory from mock import patch from nose.tools import eq_, ok_ from mozillians.common.tests import TestCase from mozillians.groups import forms from mozillians.groups.models import Group from mozillians.groups.tests import GroupAliasFactory, GroupFactory from mozillians.users.tes...
StarcoderdataPython
6490673
from .capture import Capture
StarcoderdataPython
3585780
pkg_dnf = { 'haproxy': {}, } svc_systemd = { 'haproxy': { 'needs': ['pkg_dnf:haproxy'] }, } files = { '/etc/haproxy/haproxy.cfg': { 'mode': '0664', 'source': '{}.haproxy.cfg'.format(node.name), 'triggers': ['svc_systemd:haproxy:restart'], }, }
StarcoderdataPython
1703783
# -*- coding: utf-8 -*- from __future__ import print_function import ssl, hmac, base64, hashlib,json from datetime import datetime as pydatetime # from eventNotice.models import EventNoticeSmsSendStatistic try: from urllib import urlencode from urllib2 import Request, urlopen except ImportError: from urlli...
StarcoderdataPython
4806400
import operator as op from abc import ABC, abstractmethod from dataclasses import dataclass, field from functools import reduce from typing import Type file_name = 'data/day16.txt' with open(file_name) as file: data = file.readline() bits = '' end = 0 for _hex in data: for bit in f'{int(_hex, 16):04b}': ...
StarcoderdataPython
1686538
import pyaudio import speech_recognition as sr #ENTER THE NAME OF THE MIC THAT WE ARE GOING TO TEST ON #I WILL BE MAKING ANOTHER PROGRAM TO DISPLAY NAMES OF MIC ON A SYSTEM #FROM THAT LIST WE WILL BE SELECTING WHICH ONE WE WANT TO USE #mic_name is the mic that we will be using, mic_name = "Microphone (Realt...
StarcoderdataPython
5139308
#!python #-*- coding:utf-8 -*- import os,sys,base64,hashlib,time from Crypto import Random from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_v1_5 def KeysNew(bit = 2048): rnd_generator = Random.new().read rsa = RSA.generate(bit,rnd_generator) secret_pem = rsa.exportKey() public_pem ...
StarcoderdataPython
172621
import csv from pathlib import Path def get_student_dict() -> list: pom = [] with open(f"{Path(__file__).parent.absolute()}/../assets/students.csv", mode="rt+") as f: reader = csv.reader(f) header = reader.__iter__().__next__() for line in reader: pom.append(l...
StarcoderdataPython
1928753
from numpy import equal from ui.Menus import Menus from service.PlatformService import PlatformService from service.dtos.PlatformDto import PlatformDto from service.CategoryService import CategoryService from service.dtos.CategoryDto import CategoryDto, PasswordRetentionPeriod from utils.UiUtils import UiUtils import s...
StarcoderdataPython
3561122
<gh_stars>0 import logging import datetime from flask_sqlalchemy import sqlalchemy from init import ProductCostEstimation, config from utilities.scm_enums import ErrorCodes, BoxStatus from utilities.scm_exceptions import ScmException from utilities.scm_logger import ScmLogger class ProductCostEstimationRepository: ...
StarcoderdataPython
5115162
<filename>api/app/controllers/api/domain.py<gh_stars>10-100 import os from flask import current_app, request from flask_restful import Resource, reqparse from app.helpers import command, helpers, validator from app.middlewares import auth from app.models import domain as domain_model from app.models import model from...
StarcoderdataPython
3376275
# Generated by Django 3.2.3 on 2021-09-13 11:32 from functools import partial from django.db import migrations import easydmp.dmpt.models.questions.mixins from easydmp.dmpt.utils import register_question_type register_email_type = partial(register_question_type, 'email') class Migration(migrations.Migration): ...
StarcoderdataPython
1989527
# # -*- coding: utf-8 -*- # Wireshark tests # By <NAME> <<EMAIL>> # # Ported from a set of Bash scripts which were copyright 2005 <NAME> # # SPDX-License-Identifier: GPL-2.0-or-later # '''Capture tests''' import fixtures import glob import hashlib import os import socket import subprocess import subprocesstest import ...
StarcoderdataPython
4832475
from flask import current_app from flask_classful import FlaskView, route from flask_json import as_json from flexmeasures.data import db def _check_sql_database(): try: db.session.execute("SELECT 1").first() return True except Exception: # noqa: B902 current_app.logger.exception("Da...
StarcoderdataPython
1664692
import argparse import logging import logging.config from bunsan.broker import connection_pb2 from bunsan.broker.service import consumer from bunsan.broker.worker import worker from google.protobuf import text_format def main(): parser = argparse.ArgumentParser(description='Server') parser.add_argument('--lo...
StarcoderdataPython
6615495
"""This module provides file I/O for the Quake network protocol. References: Quake Source - id Software - https://github.com/id-Software/Quake The Unofficial DEM Format Description - <NAME>, et al. - https://www.quakewiki.net/archives/demospecs/dem/dem.html """ import io import struct __all...
StarcoderdataPython
9713917
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Base class for RPC testing import logging import optparse import os import sys import shutil import te...
StarcoderdataPython
1746138
import logging from typing import Any, Dict, List from pydantic import BaseModel # pylint: disable=no-name-in-module from tgcf.plugins import FileType, TgcfMessage, TgcfPlugin from tgcf.utils import match class FilterList(BaseModel): blacklist: List[str] = [] whitelist: List[str] = [] class FilesFilterLi...
StarcoderdataPython
120550
######################################################################## # # Copyright (c) 2021 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # ######################################################################## import jsonpatch import pecan from pecan import rest import six import wsme from ws...
StarcoderdataPython
6543709
#Imports import os import fnmatch import matplotlib.pyplot as plt from tensorflow import keras def load_images_from_folder(folder, filter): # Get files in the folder files = fnmatch.filter(os.listdir(folder), filter) # Load all files result = [] for file in files: # Get full fil...
StarcoderdataPython
8171838
<gh_stars>0 """ report test results in JUnit-XML format, for use with Hudson and build integration servers. Based on initial code from <NAME>. """ import py import os import re import sys import time # Python 2.X and 3.X compatibility try: unichr(65) except NameError: unichr = chr try: unicode('A') excep...
StarcoderdataPython
15193
<filename>wwt_api_client/communities.py # Copyright 2019-2020 the .NET Foundation # Distributed under the terms of the revised (3-clause) BSD license. """Interacting with the WWT Communities APIs.""" import json import os.path import requests import sys from urllib.parse import parse_qs, urlparse from . import APIRe...
StarcoderdataPython
3366933
<filename>third_party/gtest/workspace.bzl """Google Test project.""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def deps(): http_archive( name = "com_google_googletest", urls = ["https://github.com/google/googletest/archive/011959aafddcd30611003de96cfd8d7a7685c700.zip"], ...
StarcoderdataPython
1810521
<filename>sample.py from random import random , sample num = random() print( 'Random Float 0.0-1.0 : ' , num ) num = int( num * 10 ) print( 'Random Integer 0 - 9 : ' , num ) nums = [] ; i = 0 while i < 6 : nums.append( int( random() * 10 ) + 1 ) i += 1 print( 'Random Multiple Integers 1-10: ' , nums ...
StarcoderdataPython
9790734
<filename>replaying/xor_nxor_pdf.py #%% import random import matplotlib.pyplot as plt import tensorflow as tf import tensorflow.keras as keras import seaborn as sns import numpy as np import pickle import pandas as pd from sklearn.model_selection import StratifiedKFold from math import log2, ceil #%% def pdf(x): ...
StarcoderdataPython
5199625
<reponame>nelliesnoodles/Whispering-Wall<filename>wiwa_class.py #!usr/bin/python3 # -*- coding: utf-8 -*- import sys import re #import enchant #Remove enchant for windows, will not install easily from nltk.corpus import wordnet import nltk as nltk import random import os """ Requires: *Running setup1.py in li...
StarcoderdataPython
6675476
from django.db.models.fields import DecimalField from django.shortcuts import render from django.contrib.contenttypes.models import ContentType from django.http import HttpResponse from django.core.exceptions import ObjectDoesNotExist from store.models import Product from store.models import Collection from store.model...
StarcoderdataPython
341770
<filename>main.py from flask import Flask, render_template, url_for, request, redirect from flask import send_from_directory app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/calendar/<year>', methods=['POST']) def calendar(year): return send_from_directory(...
StarcoderdataPython
1759208
<reponame>scieloorg/scielo-opds # coding: utf-8 """ .. module: scieloopds.renderers :synopsis: Renderer to build OPDS Atom catalog from dict input .. moduleauthor:: <NAME> <<EMAIL>> """ from datetime import datetime from lxml import etree from lxml.builder import ElementMaker from opds import ContentType, Namespa...
StarcoderdataPython
6674619
import jax.numpy as jnp import objax import bayesnewton from bayesnewton.utils import softplus_inv from .models import MGPR from numpy.random import gamma def squash_sin(m, s, max_action=None): """ Squashing function, passing the controls mean and variance through a sinus, as in gSin.m. The output is in [...
StarcoderdataPython
6697607
# # Copyright 2022 European Centre for Medium-Range Weather Forecasts (ECMWF) # # 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 req...
StarcoderdataPython
6670168
with open('test.txt',mode= 'w+') as gamefile: gamefile.seek(0) curr_highscore = float(gamefile.read()) cup = ['','o','',] token = 0 from random import shuffle def guess_func(): guess = '' while guess not in ['0','1','2']: guess = input("pick a number : 0,1, or 2 \n") return int(guess) def cupro...
StarcoderdataPython
8054080
<reponame>Amplo-GmbH/AutoML import numpy as np import pandas as pd from Amplo.AutoML import Sequencer class TestSequence: def test_init(self): assert Sequencer(), 'Class initiation failed' def test_numpy_none(self): # Parameters features = 5 length = 500 back = np.ra...
StarcoderdataPython
8169691
import logging import os import pkg_resources import requests try: import youtube_dl youtube_dl_bin_name = 'youtube-dl' except: import youtube_dlc as youtube_dl youtube_dl_bin_name = 'youtube-dlc' from boltons.urlutils import URL from plumbum import local, ProcessExecutionError, ProcessTimedOut from...
StarcoderdataPython
5110514
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2019-04-23 11:22 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("crm", "0024_auto_20190423_1113")] operations = [ migrations.AlterField( mod...
StarcoderdataPython
4817583
class AdversarialArm(): def __init__(self, t, active_start, active_end): self.t = t self.active_start = active_start self.active_end = active_end def draw(self): self.t = self.t + 1 if self.active_start <= self.t <= self.active_end: return 1.0 else: return 0.0
StarcoderdataPython
9668072
from PyQt5 import QtWidgets, QtCore from . selectable_line import Template,Source from . draggable_points import TemplateLandmarks,SourceLandmarks from . stack import SelectionStack class _LinePointCollection(QtCore.QObject): LandmarksClass = TemplateLandmarks LineClass = Template point_deleted ...
StarcoderdataPython
1787584
#!/usr/bin/env python import rospy from std_msgs.msg import UInt16 import random def publisher(): pub = rospy.Publisher('launcher/pitch', UInt16, queue_size=10) rospy.init_node('pitch_control', anonymous=False) rate = rospy.Rate(1) # 1 hz angle = 90 while not rospy.is_shutdown(): angle = random.randint(5,160) ...
StarcoderdataPython
4874728
# -*- coding: utf-8 -*- import queue import threading from mantarray_desktop_app import MantarrayProcessesMonitor from mantarray_desktop_app import SERVER_INITIALIZING_STATE import pytest @pytest.fixture(scope="function", name="test_monitor") def fixture_test_monitor(): def _foo(process_manager): the_dic...
StarcoderdataPython
189014
<filename>0x15-api/1-export_to_CSV.py #!/usr/bin/python3 """ Python CVS """ import csv import requests from sys import argv if __name__ == '__main__': user_id = argv[1] url_todos = "https://jsonplaceholder.typicode.com/todos?userId={}" api_todos = requests.get(url_todos.format(user_id), verify=False).json...
StarcoderdataPython
12836058
<reponame>lynnUg/vumi-go from uuid import uuid4 import urllib from django.core.urlresolvers import reverse from go.base.tests.helpers import GoDjangoTestCase, DjangoVumiApiHelper from go.channel.views import get_channel_view_definition class TestChannelViews(GoDjangoTestCase): def setUp(self): self.vum...
StarcoderdataPython
1899208
import miniserver miniserver.start_server()
StarcoderdataPython
1860181
from textwrap import dedent from dnslib import RR, QTYPE, RCODE from boucanpy.core import logger from boucanpy.dns.record import Record from boucanpy.dns.zone_template import ZONE_TEMPLATE class RecordParser: def __init__(self, records): self.records = records # TODO: make this better @classmetho...
StarcoderdataPython
285684
from __future__ import absolute_import, division, print_function import itertools import inspect from functools import wraps, partial import numpy as np import scipy.interpolate import scipy.linalg from future.builtins import zip, range from future.backports import OrderedDict import torch from matplotlib.colors impo...
StarcoderdataPython
9651111
<filename>Tabuada1078.py ''' Leia 1 valor inteiro N (2 < N < 1000). A seguir, mostre a tabuada de N: 1 x N = N 2 x N = 2N ... 10 x N = 10N Entrada = A entrada contém um valor inteiro N (2 < N < 1000). Saída = Imprima a tabuada de N, conforme o exemplo fornecido. Exemplo de Entrada Exemplo de Sa...
StarcoderdataPython
1987710
<reponame>edz-o/unreal-stereo-evaluation #!/usr/bin/env python import numpy as np from skimage.color import rgb2gray import time, datetime import cv2 import json, re import os, sys import os.path as osp import argparse import metrics from utils import read_disp from config import cfg imread = lambda x: cv2.imread(x)[...
StarcoderdataPython
3380398
from django.contrib import admin from .models import Obliged, Payment admin.site.register(Obliged) admin.site.register(Payment)
StarcoderdataPython
3436260
<filename>HelloWorld-OOP/Clases.py # Este archivo es una coleccion de clases que se llamaran desde otros archivos import math class Calculadora: def __init__(self, num1, num2): self.num1 = float(num1) self.num2 = float(num2) print "Los numeros a operar son: ", self.num1, "y", self...
StarcoderdataPython