id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
101568
<reponame>BAMresearch/ctsimu-toolbox import os # File and path handling import numpy import copy from ..image import * from ..helpers import * from .pipeline import Pipeline from .step import Step class Step_Noise(Step): """ Add noise to image according to SNR characteristics. The noise ch...
StarcoderdataPython
97594
<filename>Basic/__main2.py # import __main print("Hello, Python welcomes you!!! " + __name__)
StarcoderdataPython
1769429
from .biothings_transformer import BioThingsTransformer class SemmedTransformer(BioThingsTransformer): def wrap(self, res): result = {} for pred, val in res.items(): tmp = [] if isinstance(val, list) and len(val) > 0: for item in val: if ...
StarcoderdataPython
1656050
import day14.src as src def test_run_race(): results = src.run_race(src.load_data(src.TEST_INPUT_FILE), 1000) assert results['Comet'] == 1120 assert results['Dancer'] == 1056 def test_part1(): assert src.part1(src.TEST_INPUT_FILE, 1000) == 1120 def test_part1_full(): assert src.part1(src.FULL_...
StarcoderdataPython
3268396
"""Utils for ViViT-based regression models.""" from typing import Any from absl import logging import flax import jax.numpy as jnp import ml_collections import numpy as np from scenic.common_lib import debug_utils from scenic.projects.vivit import model_utils as vivit_model_utils average_frame_initializer = vivit_m...
StarcoderdataPython
4821925
from flask import Blueprint web_module = Blueprint( "web", __name__, url_prefix = "", template_folder = "templates", static_folder = "web_static" ) from . import views
StarcoderdataPython
154840
#!/usr/bin/env python3 # EasyGoPiGo3 documentation: https://gopigo3.readthedocs.io/en/latest # ######################################################################## # This example demonstrates using the distance sensor with the GoPiGo # In this examples, the GoPiGo keeps reading from the distance sensor # When it cl...
StarcoderdataPython
85573
<filename>portal/apps/core/utils.py # -*- coding: utf-8 -*- import re from time import timezone from datetime import datetime, tzinfo, timedelta from dateutil import tz from math import copysign from os import path import pytz from pytz import country_timezones, country_names import requests from django.conf import se...
StarcoderdataPython
1780185
class Config(object): ENVIRONMENT = None DEBUG = False TESTING = False
StarcoderdataPython
1634946
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.utils import _pair from torch.nn import init import math from net import MLP, StateTransition class GNN(nn.Module): def __init__(self, config, state_net=None, out_net=None): super(GNN, self).__init__() self....
StarcoderdataPython
1752013
from __future__ import print_function ############################################################################################ # # The MIT License (MIT) # # Intel AI DevJam IDC Demo Classification Server # Copyright (C) 2018 <NAME> (<EMAIL>) # # Permission is hereby granted, free of charge, to any person obtainin...
StarcoderdataPython
157990
#!/usr/bin/python # Copyright (C) 2019 EASYSOFT-IN # All rights exclusively reserved for EASYSOFT-IN, # unless otherwise expressly agreed. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # This file contains class for easin Args Manager # - - - - - - - - - - - - - - - - - - - - - - - - -...
StarcoderdataPython
3375982
<reponame>DXYyang/shenNeng_gasAnalysis def density_plot(data,k): #自定义作图函数 import matplotlib.pyplot as plt plt.rcParams['font.sans-serif'] = ['SimHei'] #用来正常显示中文标签 plt.rcParams['axes.unicode_minus'] = False #用来正常显示负号 p = data.plot(kind='kde', linewidth = 2, subplots = True, sharex = False) [p[i].set_ylabel(u'密...
StarcoderdataPython
3231319
<filename>ask_api_examples/list_five_models_offset.py """List five models written in C, starting at item 20 from the full list. """ from ask_api_examples import make_query query = '[[Programming language::Python]]|limit=5|offset=20' def main(): r = make_query(query, __file__) return r if __name__ == '__ma...
StarcoderdataPython
126416
#Init records_storage = dict() line_break = "-----------------------------------------------\n" run_program = True # Define Functions def add_item(key, value): records_storage[key] = value def delete_item(key): try: del records_storage[key] except KeyError: print(f"Key '{key}' could not be f...
StarcoderdataPython
3371940
"""Files for data exploration."""
StarcoderdataPython
103198
def test_add_two_params(): expected = 5 actual = add(2, 3) assert expected == actual def test_add_three_params(): expected = 9 actual = add(2, 3, 4) assert expected == actual def add(a, b, c=None): if c is None: return a + b else: return a + b + c
StarcoderdataPython
1763732
## install tensorflow to anaconda print("Are you running anacocnda? Y/N") print("Scanning system for anaconda...") import os import sys import subprocess import time import shutil import requests import json import re import random import string import numpy as np ## Design A UX to check if the user wants to install m...
StarcoderdataPython
1711851
<filename>src/migrations/versions/adbff74fc1de_.py """empty message Revision ID: adbff74fc1de Revises: Create Date: 2021-01-30 10:30:33.372825 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "adb<PASSWORD>" down_revision = None branch_labels = None depends_on = ...
StarcoderdataPython
180399
import dash_core_components as dcc import dash_html_components as html layout = html.Div([ html.H3('App 1'), dcc.Dropdown( id='app-1-dropdown', options=[ {'label': 'App 1 - {}'.format(i), 'value': i} for i in [ 'NYC', 'MTL', 'LA' ] ] ), h...
StarcoderdataPython
108107
class dtype(object): def __init__(self, name): self.type_name = name float = dtype('float') double = dtype('double') half = dtype('half') uint8 = dtype('uint8') int16 = dtype('int16') int32 = dtype('int32') int64 = dtype('int64')
StarcoderdataPython
135216
#programa que vai gerar cinco números aleatórios e colocar em uma tupla. # Depois disso, mostre a listagem de números gerados e também indique o menor e o maior valor que estão na tupla from random import randint n = (randint(1, 10), randint(1, 10), randint(1, 10), randint(1, 10), randint(1, 10)) print(f'Eu sortiei os ...
StarcoderdataPython
1708590
from logging.config import dictConfig import psycopg2 import logging import os def migrate(conn): cur = conn.cursor() # Check to see if the google_calendar_info table exists cur.execute("SELECT EXISTS (SELECT 1 FROM pg_tables WHERE tablename = 'google_calendar_info');") exists = cur.fetchone() l...
StarcoderdataPython
3221776
import json import os # Nombre del archivo de configuracion # si se cambia cambiarlo aqui tambien confFile = "./components.json" # Pide los datos necesarios para crear un nuevo componente # y crea los archivos necesarios y lo agrega al archivo de configuracion print("Add new component\n"); print("*"*30) comp = { "...
StarcoderdataPython
115467
from validaciones import * class Punto(): # Representar un punto en un plano def __init__(self, x=0, y=0): if es_numero(x) and es_numero(y): self.x = x self.y = y else: raise TypeError("X e Y Deben ser valores numericos ") def distancia(self, otro): ...
StarcoderdataPython
1686115
<reponame>statgen/locuszoom-hosted from django import template import furl register = template.Library() @register.filter(name='add_token') def add_token(value, token): """Generate an absolute URL that includes a private link token as a query param""" if not token: return value return furl.furl(...
StarcoderdataPython
1627237
# Copyright 2021 the authors. # This file is part of Hy, which is free software licensed under the Expat # license. See the LICENSE. import os import importlib.util import py_compile import tempfile import hy.importer def test_pyc(): """Test pyc compilation.""" with tempfile.NamedTemporaryFile(suffix='.hy')...
StarcoderdataPython
1670261
<reponame>Art-Ev/aequilibrae from .reference_files import *
StarcoderdataPython
3227967
# Copyright 2013 Nebula 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 # # Unless required by applicable law or agreed to...
StarcoderdataPython
124337
# -*- coding: utf-8 -*- import unittest def binary_search(sorted_list: list, first: int, last: int, target: int) -> int: mid = int((first + last) / 2) if first > last: return 0 elif target == sorted_list[mid]: return 1 else: if target > sorted_list[mid]: return bi...
StarcoderdataPython
3259804
<reponame>Valalala/mc2unity<filename>learning/testBlender.py # testBlender.py # <NAME> # Testing code for a project that converts Minecraft worlds to Unity. import bpy import bmesh import time ###### Alpha ###### # Only useful when viewing the file in blender. def fixAlpha(): # Note: mineways has a blender script, ...
StarcoderdataPython
183456
"""Export a checkpoint as an ONNX model. Applies onnx utilities to improve the exported model and also tries to simplify the model with onnx-simplifier. https://github.com/onnx/onnx/blob/master/docs/PythonAPIOverview.md https://github.com/daquexian/onnx-simplifier """ import argparse import logging import shutil im...
StarcoderdataPython
153736
<gh_stars>0 import argparse from collections import defaultdict from operator import itemgetter import sys import tqdm import warnings import faiss import numpy as np from numpy.linalg import norm # TODO refactor some of the functionality into a library, so that it can # also be called from Python code. def ngrams...
StarcoderdataPython
133218
from unittest import TestCase from mock import Mock, patch from samcli.commands.local.lib.sam_base_provider import SamBaseProvider from samcli.lib.intrinsic_resolver.intrinsic_property_resolver import IntrinsicResolver class TestSamBaseProvider_get_template(TestCase): @patch("samcli.commands.local.lib.sam_base_pr...
StarcoderdataPython
180495
<gh_stars>100-1000 from __future__ import unicode_literals, print_function import ideone import time import praw import re import urllib import traceback import config from socket import error as SocketError from sys import exit from functools import wraps def handle_api_exceptions(max_attempts=1): """Return a fu...
StarcoderdataPython
3364102
import unittest from pycpfcnpj import cpf class CPFTests(unittest.TestCase): """docstring for CPFTests""" def setUp(self): self.valid_cpf = '11144477735' self.invalid_cpf = '11144477736' def test_validate_cpf_true(self): self.assertTrue(cpf.validate(self.valid_cpf)) def test...
StarcoderdataPython
175603
import os import unittest import settings as settings import urllib.request from helper import InputFiles class FindOrbitReferenceHelperTest(unittest.TestCase): pass # def test_find_orbit_reference_default(self): # """ Passing all arguments as default, must return igr18471.sp3.Z """ # self.a...
StarcoderdataPython
3303839
<reponame>amymariaparker2401/luci-py #!/usr/bin/env vpython # Copyright 2019 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. import sys import unittest import isolate_test_env as test_env test_env.setup_test_en...
StarcoderdataPython
3302821
# # Copyright(c) 2012-2019 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause-Clear # import pytest import mock import stat import helpers as h import opencas @pytest.mark.parametrize( "line", [ "", " ", "#", " # ", ( ...
StarcoderdataPython
3329555
import unittest from blng.Voodoo import DataAccess from alchemy_cli import alchemy_voodoo_wrapper import prompt_toolkit.validation class TestAlchemySimple(unittest.TestCase): def setUp(self): self.session = DataAccess('crux-example.xml') self.root = self.session.get_root() self.subject =...
StarcoderdataPython
3246718
"""Upload models. Upload the scene's configuration file and asset file. """ # Import built-in modules import configparser import os import subprocess # Import local modules from rayvision_sync import RayvisionTransfer from rayvision_sync.utils import run_cmd from rayvision_sync.utils import read_ini_config from ray...
StarcoderdataPython
1762397
from sails.ui.mainmenubar import MainMenuBar class SunVoxMainMenuBar(MainMenuBar): pass
StarcoderdataPython
1783057
<reponame>TheGoldfish01/pydpf-core<gh_stars>10-100 from .serializer import serializer from .mechanical_csv_to_field import mechanical_csv_to_field from .field_to_csv import field_to_csv from .deserializer import deserializer from .csv_to_field import csv_to_field from .vtk_export import vtk_export from .vtk_to_fi...
StarcoderdataPython
1691821
import numpy as np from opendp.smartnoise_t.sql.privacy import Privacy class Odometer: """ Implements k-folds homogeneous composition from Kairouz, et al Theorem 3.4 https://arxiv.org/pdf/1311.0776.pdf """ def __init__(self, privacy: Privacy): self.k = 0 self.privacy = privacy ...
StarcoderdataPython
3373633
class Quote(object): def __init__(self, recipient, quote): self.quote = '@{RECIPIENT} {QUOTE}'.format(RECIPIENT=recipient, QUOTE=quote) def __unicode__(self): return self.quote def __str__(self): return unicode(self).encode('UTF-8') def __repr__(self): ...
StarcoderdataPython
1725490
# This file is part of the Data Cleaning Library (openclean). # # Copyright (C) 2018-2021 New York University. # # openclean is released under the Revised BSD License. See file LICENSE for # full license details. """String tokenizer that returns a list of n-grams. A n-gram in this case is a substring of length n. """ ...
StarcoderdataPython
1610244
# Copyright 2018-2021 Streamlit 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 # # Unless required by applicable law or agreed to in wr...
StarcoderdataPython
3303400
<gh_stars>0 import requests import logging from django.conf import settings from django.contrib.auth.models import Group from .config import access_and_compliance_group_name logger = logging.getLogger(__name__) def ensure_compliant(sender, request, user, **kwargs): payload = {'uniqname': user.username} res...
StarcoderdataPython
1798221
import cv2 as cv import dlib import numpy as np import torch import torch.backends.cudnn as cudnn import torchvision.transforms as transforms from config import device from retinaface.detector import Detector from utils.ddfa import ToTensorGjz, NormalizeGjz, _parse_param from utils.inference import crop_img, parse_roi...
StarcoderdataPython
3397609
# -*- coding: utf-8 -*- # # Copyright 2015 <NAME> # # 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 a...
StarcoderdataPython
1759610
<reponame>seik/django-belt<gh_stars>0 import warnings from django.core.exceptions import ValidationError from django.db import models from django.utils.translation import ugettext_lazy as _ def transition_handler_decorator(func): """Decorator for transitions methods. Allows to activate a flag if the transiti...
StarcoderdataPython
53541
<reponame>remo5000/magma #!/usr/bin/env python3 import os SPACES = ' ' * 4 class CodeChunk: class Block: def __init__(self, codegen: 'CodeChunk'): self.gen = codegen def __enter__(self): self.gen.indent() return self.gen def __exit__(self, exc_type, e...
StarcoderdataPython
3243224
from worker import app from worker.utils import Mailer @app.task def send_mail(recipient, subject, body): mailer = Mailer(app.conf) return mailer.send(recipient=recipient, subject=subject, body=body)
StarcoderdataPython
3329378
#!/usr/bin/env python # -*- coding: utf-8 -*- # Part of the PsychoPy library # Copyright (C) 2002-2018 <NAME> (C) 2019-2021 Open Science Tools Ltd. # Distributed under the terms of the GNU General Public License (GPL). """Experiment classes: Experiment, Flow, Routine, Param, Loop*, *Handlers, and NameSpace The c...
StarcoderdataPython
3246581
""" Record from the default microphone in an infinite loop and create a Live Playlist (Sliding Window). Reference: https://developer.apple.com/documentation/http_live_streaming/ """ import hashlib import os import multiprocessing import pyaudio import pydub from typing import List, Tuple MEDIAS_DIR: str = os.envir...
StarcoderdataPython
1665137
# added processing time seems not worth added 'accuracy' def single2float(x): """Convert a single x to a rounded floating point number that has the same number of decimals as the original""" dPlaces = len(str(x).split('.')[1]) y = round(float(x),dPlaces+2) # NOTE: Alternative method: #y = round...
StarcoderdataPython
27464
<reponame>namrak/pyzkillredisq from pymongo import MongoClient, errors import tstp from mdb import creds def connect(logfile): """connect to mongodb""" try: client = MongoClient(creds['ip'], int(creds['port'])) db = client.fpLoss db.authenticate(creds['un'], creds['pw']) return ...
StarcoderdataPython
3206404
<filename>app/types_frontend.py """ Data types shared by the frontend and backend. """ from enum import Enum class Aggregate(Enum): day = 'day' week = 'week' month = 'month' year = 'year' class Ternary(Enum): true = 'true' false = 'false' both = 'both' class SearchKey: video = 'vi...
StarcoderdataPython
4810653
<gh_stars>10-100 #!/usr/bin/env python __version__ = '$Revision: 8143 $'.split()[1] __date__ = '$Date: 2008-01-07 19:19:20 -0500 (Mon, 07 Jan 2008) $'.split()[1] __author__ = '<NAME>' __doc__=''' Normalize AIS messages so that each message takes exactly one line. Works like a Queue. Messages must use the uscg forma...
StarcoderdataPython
3269044
import urllib.request def getGovPdf(index): baseurl="https://www.mscbs.gob.es/profesionales/saludPublica/ccayes/alertasActual/nCov/documentos/" filename = f"Actualizacion_{index}_COVID-19.pdf" url = baseurl + filename print (url) urllib.request.urlretrieve(url, f"./data/{filename}") return...
StarcoderdataPython
170150
<gh_stars>1-10 from flask import Flask, render_template, request from wtforms import Form, TextAreaField, validators import pickle import sqlite3 import re import os import numpy as np app = Flask(__name__) ######## Preparing the Classifier import re from sklearn.feature_extraction.text import HashingVectorizer cur...
StarcoderdataPython
91642
import argparse import logging from concurrent import futures from importlib import import_module from time import sleep import grpc from gate_grpc.api import service_pb2_grpc as api_grpc from . import InstanceServicer, RootServicer default_addr = "localhost:12345" service_instance_types = {} def main(): parse...
StarcoderdataPython
3392140
import tensorflow as tf from tensorflow import keras from keras.layers import ( Conv2D, Conv2DTranspose, MaxPooling2D, Dropout, concatenate, Reshape) from keras import Model from keras_unet_collection.losses import dice def conv_block(input, filt): C_1 = Conv2D(filt, (3, 3), activation='relu', kernel...
StarcoderdataPython
1663508
<filename>tools/optimized_workflows/encode-bag-client.py<gh_stars>1-10 import requests import sys from bdbag import bdbag_api import urllib BAG_SERVICE = "http://encode.bdbag.org/encode" #QUERY_BASE = "https://www.encodeproject.org/search/?type=Experiment&assay_slims=DNA+accessibility&assay_title=DNase-seq&" QUERY_BAS...
StarcoderdataPython
1782978
<gh_stars>0 # -*- coding: utf-8 -*- """A major refactoring of ``edge2vec``. A high level overview: .. code-block:: python from edge2vec import calculate_edge_transition_matrix, train, read_graph graph = read_graph(...) transition_matrix = calculate_edge_transition_matrix(graph=graph, ...) word2vec =...
StarcoderdataPython
3297054
<filename>tf_agents/system/default/multiprocessing_core.py # coding=utf-8 # Copyright 2018 The TF-Agents Authors. # # 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...
StarcoderdataPython
81551
from . import halconfig_types as types from . import halconfig_dependency as dep name = "CSEN" compatibility = dep.Dependency(dep.Platform.SERIES1) # all peripheral = 'CSEN' modes = { 'define': 'hal_csen_mode', 'description': 'Mode', 'hide_properties': False, 'values': [ types.EnumValue('singl...
StarcoderdataPython
3267055
<reponame>tody411/ImageViewerFramework # -*- coding: utf-8 -*- ## @package ivf.scene.scene # # ivf.scene.scene utility package. # @author tody # @date 2016/01/25 import numpy as np from PyQt4.QtGui import * from PyQt4.QtCore import * from ivf.io_util.image import loadRGBA from ivf.scene.data import D...
StarcoderdataPython
3282322
# # Copyright 2017 Import.io # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
StarcoderdataPython
5952
<filename>src/freemovr_engine/calib/acquire.py import roslib roslib.load_manifest('sensor_msgs') roslib.load_manifest('dynamic_reconfigure') import rospy import sensor_msgs.msg import dynamic_reconfigure.srv import dynamic_reconfigure.encoding import numpy as np import time import os.path import queue class CameraHa...
StarcoderdataPython
4831957
import os import time import base64 import redis import config import plivo def baseN(num,b,numerals="0123456789abcdefghijklmnopqrstuvwxyz"): return ((num == 0) and "0" ) or (baseN(num // b, b).lstrip("0") + numerals[num % b]) def tinyid(size=6): id = '%s%s' % ( baseN(abs(hash(time.time())), 36)...
StarcoderdataPython
1722393
<reponame>zibuyu1995/Hardware from RPi import GPIO def led_on(): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(4, GPIO.OUT) GPIO.output(4, GPIO.HIGH) print('LED on') if __name__ == '__main__': led_on()
StarcoderdataPython
3316564
# coding: utf-8 try: import cPickle as pickle except: import pickle from django.test import TestCase from value.application_settings.models import ApplicationSetting class ApplicationSettingTests(TestCase): def setUp(self): ApplicationSetting.objects.create( name=ApplicationSetting...
StarcoderdataPython
1736028
<filename>src/xscontainer/remote_helper/ssh.py<gh_stars>1-10 from xscontainer import api_helper from xscontainer import util from xscontainer.util import log import constants import fcntl import errno import os import paramiko import paramiko.rsakey import select import socket import StringIO import sys DOCKER_SOCKET...
StarcoderdataPython
3253000
<reponame>shantanu561993/PyCssMinify # -*- coding: utf-8 -*- import os import concurrent.futures import requests def minify_css(file_path): if type(file_path)!=str : raise Exception("Image file path must be string") if not os.path.isfile(os.path.abspath(file_path)) and not os.path.isdir(os.path.abspath(file_path...
StarcoderdataPython
3361740
#!/usr/bin/env python3 import os import sys path = "/media/Colossus/Series/" if len(sys.argv) > 1: path = sys.argv[1] isFile = os.path.exists(path) #print(path) #print(isFile) #print(len(sys.argv)) if isFile: sys.exit(0) else: sys.exit(1)
StarcoderdataPython
125386
<reponame>dariusgrassi/trex-core<filename>scripts/external_libs/scapy-2.4.5/scapy/contrib/automotive/gm/gmlanutils.py<gh_stars>100-1000 #! /usr/bin/env python # This file is part of Scapy # See http://www.secdev.org/projects/scapy for more information # Copyright (C) <NAME> <<EMAIL>> # Copyright (C) <NAME> <<EMAIL>> #...
StarcoderdataPython
1772803
from cache import REDIS from fastapi.responses import PlainTextResponse from loguru import logger # pylint: disable=E0611 from pydantic import BaseModel # pylint: enable=E0611 DOC = { 200: { "description": "API response successfully", "content": {"application/json": {"example": {"name": "apple", "...
StarcoderdataPython
1796447
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """PNG形式で画像を保存する""" import os from gimpfu import * FILENAME_ENCODING = 'cp932' def generate_new_filename(filename): """拡張子を.pngにしたファイル名を作成""" dirname = os.path.dirname(filename) basename_without_ext = os.path.splitext(os.path.basename(filename))[0] ne...
StarcoderdataPython
140710
#usr/bin/env python import time import io import os import re import sys from io import open from sys import argv import pandas as pd ## ARGV if len (sys.argv) < 4: print ("\nUsage:") print ("python3 %s repeatMasker info_sequence_names folder\n" %os.path.abspath(argv[0])) exit() repeatMasker_file = argv[1] convers...
StarcoderdataPython
3315570
#! /usr/bin/env python3 class Rectangle: def __init__(self, offset, dimensions, patchid): self.patchid = patchid self.left = offset[0] self.up = offset[1] self.width = dimensions[0] self.height = dimensions[1] with open('input/day3') as input: vals = list(map(lambda x: x.strip(), input.readlines())) # ...
StarcoderdataPython
140377
<filename>testinvenio/records/api.py # -*- coding: utf-8 -*- # # Copyright (C) 2020 alzp. # # testInvenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Records API.""" from __future__ import absolute_import, print_function from ...
StarcoderdataPython
1693652
<filename>Beginner/1963.py A, B = tuple(map(float,input().split())) print("{0:.2f}%".format((B/A-1)*100))
StarcoderdataPython
3327915
<reponame>zhaoyi3264/leetcode-solutions # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def constructFromPrePost(self, pre: List[int], post: List[int]) -> T...
StarcoderdataPython
86622
<gh_stars>0 from .resellerclub import ResellerClubAPI
StarcoderdataPython
17818
<gh_stars>1-10 from bs4 import BeautifulSoup import requests import re from lxml.html import fromstring from lxml.etree import ParserError from gemlog_from_rss.spip import SinglePost def localize(lang): if lang == "pl": return { "our_articles": "Nasze artykuły" } if lang == "fr": ...
StarcoderdataPython
121182
# Created: 06.01.2020 # Copyright (c) 2020 <NAME> # License: MIT License from string import ascii_letters from typing import Iterable from pyparsing import * from . import ast ABS = Keyword('ABS') ABSTRACT = Keyword('ABSTRACT') ACOS = Keyword('ACOS') AGGREGATE = Keyword('AGGREGATE') ALIAS = Keyword('ALIAS') AND = Ke...
StarcoderdataPython
3312614
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """Tests scenarios for pausing/resuming a microVM.""" import host_tools.network as net_tools def test_pause_resume(test_microvm_with_ssh, network_config): """Test pausing and resuming the vCPUs.""" ...
StarcoderdataPython
3291080
# -*- coding: utf-8 -*- from collections import deque from proxy2 import * class SSLStripRequestHandler(ProxyRequestHandler): replaced_urls = deque(maxlen=1024) def request_handler(self, req, req_body): if req.path in self.replaced_urls: req.path = req.path.replace('http://', 'https://')...
StarcoderdataPython
4841113
<filename>kdeepmodel/transformer/detr.py #!/usr/bin/env python """End-to-End Object Detection with Transformers https://arxiv.org/abs/2005.12872 https://github.com/facebookresearch/detr https://colab.research.google.com/github/facebookresearch/detr/blob/colab/notebooks/detr_demo.ipynb#scrollTo=h91rsIPl7tVl https://git...
StarcoderdataPython
3352427
<gh_stars>0 # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------...
StarcoderdataPython
1751537
<reponame>MarcoMene/epidemics-suppression<gh_stars>0 """ Contains a function that runs the algorithm several times, each with a different choice of the input parameters. """ from bsp_epidemic_suppression_model.model_utilities.epidemic_data import ( make_scenario_parameters_for_asymptomatic_symptomatic_model, ) fro...
StarcoderdataPython
8955
<gh_stars>0 try: from tango import DeviceProxy, DevError except ModuleNotFoundError: pass class PathFixer(object): """ Basic pathfixer which takes a path manually. """ def __init__(self): self.directory = None class SdmPathFixer(object): """ MAX IV pathfixer which takes a pat...
StarcoderdataPython
1679347
<gh_stars>0 # -*- coding: utf-8 -*- ########################################################################## # NSAp - Copyright (C) CEA, 2020 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_...
StarcoderdataPython
1687093
<gh_stars>0 """ General utilities. MIT license. Copyright (c) 2017 <NAME> <<EMAIL>> """ from markdown.inlinepatterns import InlineProcessor import xml.etree.ElementTree as etree from collections import namedtuple import sys import copy import re import html from urllib.request import pathname2url, url2pathname from u...
StarcoderdataPython
1607924
<reponame>int-brain-lab/iblscripts import numpy as np import random import shutil from ibllib.ephys.np2_converter import NP2Converter from ibllib.io import spikeglx from ci.tests import base class TestNeuropixel2ConverterNP24(base.IntegrationTest): """ Check NP2 converter with NP2.4 type probes ...
StarcoderdataPython
3374293
import useeioapi.data as data import useeioapi.calc as calc from flask import Flask, jsonify, request, abort app = Flask(__name__) data_dir = 'data' # no caching -> just for dev ... @app.after_request def add_header(r): """ Add headers to both force latest IE rendering engine or Chrome Frame, and also t...
StarcoderdataPython
4819305
# Copyright (C) 2010-2015 Cuckoo Foundation. # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org # This signature was contributed by RedSocks - http://redsocks.nl # See the file 'docs/LICENSE' for copying permission. from lib.cuckoo.common.abstracts import Signature class Dibik(Signature): name =...
StarcoderdataPython
1633606
from mp4box.utils.stream_reader import StreamReader from mp4box.box_parser import BoxParser # This class represents both an mp4 and m4s files class ISOFile: class Track: def __init__(self, id, user, trak): self.id = id self.user = user self.trak = trak ...
StarcoderdataPython
4814694
<reponame>walidpiano/Udacity_Learning<gh_stars>0 from flask import Flask app = Flask(__name__) @app.route("/index") def home(): return "Hi there" @app.route("/SayHello/<name>") def say_hello(name): return f"Hello {name}" app.run()
StarcoderdataPython