id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
11236887
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import from numba import double from numba.decorators import jit as jit #@autojit def sum2d(arr): M, N = arr.shape result = 0.0 for i in range(M): for j in range(N): result += arr[i,j] return result c...
StarcoderdataPython
3267898
<reponame>NathanKr/python-modules-and-packages-playground<gh_stars>0 from setuptools import find_packages, setup setup( name='myutils', packages=find_packages(), version='0.1.0', description='first python package', author='<NAME>', author_email = '<EMAIL>', license='MIT', install_require...
StarcoderdataPython
307227
<filename>power_renamer/__init__.py from fman import DirectoryPaneCommand, DirectoryPane, ApplicationCommand, show_alert, FMAN_VERSION, DirectoryPaneListener, load_json, save_json, show_prompt, YES, NO, ABORT from fman.fs import copy, move, exists from fman.url import as_human_readable, basename from subprocess import ...
StarcoderdataPython
4908058
import os import math import torch import ujson import traceback from itertools import accumulate from colbert.parameters import DEVICE from colbert.utils.utils import print_message, dotdict, flatten BSIZE = 1 << 14 class IndexRanker(): def __init__(self, tensor, doclens): self.tensor = tensor # Big doc...
StarcoderdataPython
5137251
<reponame>FlyreelAI/sesemi # # Copyright 2021, Flyreel. All Rights Reserved. # =============================================# """Configuration structures and utilities."""
StarcoderdataPython
9726229
""" Defines a reinforcement learning agent which uses a simple version of proximal policy optimization, without an actor-critic style baseline value function. """ import tensorflow as tf import numpy as np import gym import roboschool class Sample: """ Represents an arbitrary state-action sample. Mainly to ...
StarcoderdataPython
3301667
class Solution: def countArrangement(self, n: int) -> int: cache = {} def helper(X): if len(X) == 1: return 1 if X in cache: return cache[X] total = 0 for j in range(len(X)): if X[j] % len(X) == 0 or le...
StarcoderdataPython
9727738
<filename>camera.py import cv2 from model import FacialExpressionModel import numpy as np facec = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') model = FacialExpressionModel("model.h5") font = cv2.FONT_HERSHEY_DUPLEX class VideoCamera(object): def __init__(self): self.video = cv2.VideoCaptu...
StarcoderdataPython
4990216
<gh_stars>0 from pybedtools import BedTool import numpy as np import os from functools import reduce import timeit def run_intersect(file_list, overlap_min=1, gap_min=0, multi_bed=2, multi_frag=3): # File 1 BED_file_lines_1 = get_file_lines(abs_file_name=file_list[0]) BED_file_dict_1 = get_file_bed_dict(...
StarcoderdataPython
1997394
<reponame>wutangclancee/quantulum3 """quantulum3 init.""" VERSION = (0, 7, 1) __version__ = '.'.join([str(i) for i in VERSION]) __author__ = '<NAME>, nielstron, sohrabtowfighi, grhawk and Rodrigo Castro' __author_email__ = '<EMAIL>' __copyright__ = 'Copyright (C) 2016 <NAME>, nielstron,t sohrabtowfighi, ' 'grhawk and...
StarcoderdataPython
1925474
<reponame>stanford-oval/decaNLP # # Copyright (c) 2020 The Board of Trustees of the Leland Stanford Junior University # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of sourc...
StarcoderdataPython
204781
from abc import ABC, abstractmethod from telebot.types import InlineKeyboardButton class BaseController(ABC): @abstractmethod def callback_name(self) -> str: pass def get_menu_btn(self) -> InlineKeyboardButton: pass
StarcoderdataPython
11238742
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-09-08 13:05 from __future__ import unicode_literals from django.db import migrations, models import wagtail.core.blocks import wagtail.core.fields import wagtail.images.blocks class Migration(migrations.Migration): dependencies = [ ('home', '0...
StarcoderdataPython
326003
# keep credit if u gonna edit or kang it # without creadit copy paster mc # creadits to sawan(@veryhelpful) learned from kraken import asyncio from uniborg.util import lightning_cmd @borg.on(lightning_cmd(pattern="mst ?(.*)")) async def _(event): if not event.text[0].isalpha() and event.text[0] not in ("/", "...
StarcoderdataPython
9732734
from pyglet.window import key import numpy as np from onpolicy.envs.agar.Agar_Env import AgarEnv import time render = True num_agents = 2 class Args(): def __init__(self): self.num_controlled_agent = num_agents self.num_processes = 64 self.action_repeat = 1 self.total_step = 1e8...
StarcoderdataPython
5062154
<filename>examples/test_hydraulics.py import serial # Electro-hydraulic controller import time SERIAL_DEVICE = '/dev/ttyACM0' SERIAL_BAUD = 9600 INTERVAL = 1 PWM_MIN = 2 PWM_MAX = 255 try: arduino = serial.Serial(SERIAL_DEVICE, SERIAL_BAUD) except Exception as error: print('ERROR: %s' % str(error)) pwm = raw_...
StarcoderdataPython
5126469
<reponame>MacHu-GWU/learn_flask-project #!/usr/bin/env python # -*- coding: utf-8 -*- """ - How to: http://flask.pocoo.org/docs/0.12/quickstart/#file-uploads - Patterns: http://flask.pocoo.org/docs/0.12/patterns/fileuploads/ """ from flask import Flask, request, render_template from werkzeug.utils import secure_filen...
StarcoderdataPython
8071961
<reponame>HomeWeave/HomePiServer import random import socket from copy import deepcopy from threading import Thread, Event, Semaphore import pytest from weavelib.exceptions import ObjectNotFound, ObjectAlreadyExists from weavelib.exceptions import SchemaValidationFailed, ProtocolError from weavelib.exceptions import B...
StarcoderdataPython
5094558
from mechmat.core.chainable import Chainable, Guarded from mechmat import ureg from mechmat.principal import geometry class Vector(Chainable): def __init__(self, **kwargs): super(Vector, self).__init__(**kwargs) self.set_guard('coordinate', ureg.m) coordinate = Guarded() class Segment(Chai...
StarcoderdataPython
1684864
# Converts the repl into a web server # Which allows the bot to stay alive # CREDITS TO BEAU FROM FREECODECAMP FOR THIS ONE # https://www.youtube.com/watch?v=SPTfmiYiuok from flask import Flask from threading import Thread app = Flask("") @app.route("/") def home(): return "<h1>Cosette Bot is alive</h1>" def ru...
StarcoderdataPython
9719727
<reponame>king/s3vdc<gh_stars>1-10 """ Copyright (C) king.com Ltd 2019 https://github.com/king/s3vdc License: MIT, https://raw.github.com/king/s3vdc/LICENSE.md """ import tensorflow as tf from lib.resolve_learning_rate import resolve_lr from typing import Union, Tuple OPTIMIZER_NAMES = { "Adagrad": tf.train.Ada...
StarcoderdataPython
3220470
<reponame>suiluj/pi-adhoc-mqtt-cluster class Graphinfo: def __init__(self, measurement, where_time_range=None): self.measurement = measurement self.where_time_range = where_time_range def setmeasurement(self,measurement): self.measurement = measurement def getmeasuremen...
StarcoderdataPython
4929082
<gh_stars>1-10 import time from operator import methodcaller from types import FunctionType import grpc from concurrent import futures from py_micro.py_consul import ConsulMicroServer class MicroService(object): _ONE_DAY_IN_SECONDS = 60 * 60 * 24 """配置""" START_SERVER = True MAX_WORKERS = 4 HOS...
StarcoderdataPython
12845752
<filename>Utils/Submission/Submission.py import RootPath def create_submission_file(tweets, users, predictions, output_file): # Preliminary checks assert len(tweets) == len(users), f"length are different tweets -> {len(tweets)}, and users -> {len(users)} " assert len(users) == len(predictions), f"length...
StarcoderdataPython
3263842
""" It contains all the projects that can be ignored in graph. """ FLAGS = {}
StarcoderdataPython
9707183
""" HTTP utilities for MOVE Airflow jobs. """ from urllib3.util import Retry import requests from requests.adapters import HTTPAdapter def requests_session( retries=3, backoff_factor=0.3, status_forcelist=(500, 502, 504), session=None): """ Create a new `requests` session that automatically retrie...
StarcoderdataPython
9737909
<gh_stars>1-10 #!/usr/bin/python3 import pandas as pd import numpy as np import matplotlib.pyplot as plt import statistics """ Last edited by : Shawn Last edited time : 25/11/2021 Version Status: dev TO DO: Verify correctness """ class new_Node: def __init__(self, json_object): self.id = json_object['i...
StarcoderdataPython
12834116
<reponame>AvantikaNaik/fractals import turtle import time def drawKochSide(length, level): if (level == 1): turtle.forward(length) else: drawKochSide(length/3, level-1) turtle.left(60) drawKochSide(length/3, level-1) turtle.right(120) drawKochSide(len...
StarcoderdataPython
5158415
<filename>Python/2021/Class 2/Student Code/Harshit Sanghi/Assignment 1.py num = int(input("Enter your number")) if(num%2) == 0: print("the number",num,"is even") else: print("the number",num,"is odd”)
StarcoderdataPython
11254713
class A: a : str b : int print(A.__dict__) print(A().__dict__) A.a = "a" print(A.__dict__) print(A().__dict__) print(A.a) A.a = 1 print(A.__dict__) print(A().__dict__) print(A.a) print(A().a) print(A.b)
StarcoderdataPython
6618637
<reponame>godweiyang/ParaGen import torch.nn as nn class AbstractEncoderLayer(nn.Module): """ AbstractEncoderLayer is an abstract class for encoder layers. """ def __init__(self): super().__init__() self._cache = {} self._mode = 'train' def reset(self, mode): """ ...
StarcoderdataPython
4873815
<filename>manage.py import os from app import create_app, db from app.models import Category, Product, Store from flask_script import Manager, Shell from flask_migrate import Migrate, MigrateCommand app = create_app(os.getenv('CAMPAIGN_CONFIG') or 'default') manager = Manager(app) migrate = Migrate(app, db) def make_...
StarcoderdataPython
9672884
<reponame>Gustavo-daCosta/Projetos from tkinter import * import time from os import system from random import randint app = Tk() app.title("Fast Typing Test") app.geometry("600x550") def semComando(): print("Sem comando") barra_menu = Menu(app) menuHelp = Menu(barra_menu, tearoff=0) menuHelp.add_command(label="...
StarcoderdataPython
12808001
<filename>app/site_image.py from flask import Flask from PIL import Image, ImageOps, ImageFilter import base64 import io import binascii app = Flask(__name__) __all__ = ['normalize_image', 'get_data_uri'] def normalize_image(image_data=None): if image_data is None: raise TypeError('Image data must not ...
StarcoderdataPython
12803188
import py from os import system, chdir from urllib import urlopen log_URL = 'http://tismerysoft.de/pypy/irc-logs/' archive_FILENAME = 'pypy.tar.gz' tempdir = py.test.ensuretemp("irc-log") # get compressed archive chdir( str(tempdir)) system('wget -q %s%s' % (log_URL, archive_FILENAME)) system('tar xzf %s' % archiv...
StarcoderdataPython
11283478
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2017-05-11 07:01 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('booking', '0005_auto_20170510_1941'), ] operations = [ migrations.AlterUniqueTogether...
StarcoderdataPython
12847511
<gh_stars>0 from nltk.corpus import reuters import sys import numpy as np from scipy import optimize # Loading data here train_documents, train_categories = zip(*[(reuters.raw(i), reuters.categories(i)) for i in reuters.fileids() if i.startswith('training/')]) test_documents, test_categories = zip(*[(reuters.raw(i), ...
StarcoderdataPython
1706651
from public import getDepth, getTradeHistory from trade import TradeAPI from scraping import scrapeMainPage from keyhandler import KeyHandler import mexbtcapi.api.btce from mexbtcapi.api.btce.high_level import BTCeMarket, BTCeParticipant, BTCeSecretFileContainer import logging logging.getLogger(__name__) name = BTC...
StarcoderdataPython
325247
<reponame>matt-ullmer/Diamond # coding=utf-8 """ Uses /proc/vmstat to collect data on virtual memory manager #### Dependencies * /proc/vmstat """ import diamond.collector import os import re class VMStatCollector(diamond.collector.Collector): PROC = '/proc/vmstat' MAX_VALUES = { 'pgpgin': diamo...
StarcoderdataPython
3225024
import aceutils aceutils.cdToScript() aceutils.mkdir('../Doxygen') aceutils.cd(r'../Doxygen/') aceutils.call(r'doxygen ../Script/Doxyfile_cpp_XML')
StarcoderdataPython
4807123
<reponame>kevinjalbert/h<filename>tests/h/h_api/bulk_api/id_references_test.py import pytest from h.h_api.bulk_api.id_references import IdReferences from h.h_api.bulk_api.model.data_body import CreateGroupMembership from h.h_api.enums import DataType from h.h_api.exceptions import UnpopulatedReferenceError class Tes...
StarcoderdataPython
8102571
#!/usr/bin/env python3 # # Copyright 2019, 2020, 2021 Internet Corporation for Assigned Names and Numbers. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, you can obtain one at https://mozilla.org/MPL/2.0/. # # Develop...
StarcoderdataPython
3277676
<gh_stars>0 from scrapy import spider,Request from wikiPageRank.items import WikipagerankItem class WikiSpider(spider.Spider): name = "wiki" allowed_domains = ["vi.wikipedia.org"] start_urls = [ 'https://vi.wikipedia.org/wiki/Chi%E1%BA%BFn_tranh_bi%C3%AAn_gi%E1%BB%9Bi_Vi%E1%BB%87t%E2%80%93Trung_1...
StarcoderdataPython
1990900
""" Provides jupyter server proxy endpoints for launching Jaeger. """ __version__ = "1.0.3" import pathlib # https://jupyter-server-proxy.readthedocs.io/en/latest/server-process.html def setup_jaeger_proxy(): return { "command": ["jaeger-browser"], "environment": {"PORT": "{port}"}, "lau...
StarcoderdataPython
3497810
from .decorators import (timeout_decorator, timeout, retry)
StarcoderdataPython
5181707
#!/usr/bin/env python3 # # A PyMol extension script to compare Elfin solution against specification. # # *Needs to be re-implemented to deal with new spec and solution format. # from pymol import cmd import numpy as np import elfinpy def compare_solutions(spec_file=None, sol_csv_file=None): """ Compares s...
StarcoderdataPython
11298497
from autonmt.toolkits.autonmt import AutonmtTranslator from autonmt.toolkits.fairseq import FairseqTranslator
StarcoderdataPython
6585257
<reponame>DVSR1966/par4all<gh_stars>10-100 from __future__ import with_statement from pyps import workspace,module #Deleting workspace workspace.delete("hyantes") #Creating workspace w = workspace("hyantes/hyantes.c","hyantes/options.c",cppflags='-Ihyantes',name="hyantes",deleteOnClose=True) #Add some default proper...
StarcoderdataPython
8083640
import unittest from Tags import * from functools import cmp_to_key """ Author: <NAME> Problem Description/link: https://leetcode.com/problems/largest-number/ """ class Solution(object): def getTags(self): tags = [Difficulty.Medium, Topic.Math] return tags def _cmpNum(self, x, y): if ...
StarcoderdataPython
11219392
<gh_stars>100-1000 #!/usr/bin/python # -*- coding: utf8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) from pandas_ml.confusion_matrix.cm import LabeledConfusionMatrix, ConfusionMatrix # noqa from pandas_ml.confusion_matrix.bcm import BinaryConfusionM...
StarcoderdataPython
8182970
<reponame>ABDUL174/fekyou # coding=utf-8 import os import subprocess from core import fekyou from core import fekyousCollection from tools.others.android_attack import AndroidAttackTools from tools.others.email_verifier import EmailVerifyTools from tools.others.hash_crack import HashCrackingTools from tools.others.hom...
StarcoderdataPython
1948522
from sqlalchemy import create_engine from sqlalchemy.orm.session import sessionmaker def get_session(Base): engine = create_engine("sqlite:///") Base.metadata.create_all(engine) Session = sessionmaker(engine) return Session()
StarcoderdataPython
4899577
<reponame>Ewpratten/Graphite letters_numbers = { " ":0, "a":1, "b":2, "c":3, "d":4, "e":5, "f":6, "g":7, "h":8, "i":9, "j":10, "k":11, "l":12, "m":13, "n":14, "o":15, "p":16, "q":17, "r":18, "s":19, "t":20, "u":21, "v":22, "w":23, "x":24, "y":25, "z":26, ":":27 } numbers_letters = { 0:" ",...
StarcoderdataPython
11375362
<reponame>ybkuroki/selenium-e2e-sample #!/usr/local/bin/python3 from selenium.webdriver.common.keys import Keys from pages import PageObject from time import sleep # ログイン画面 class LoginPage(PageObject): # ユーザ名を入力する def set_user_name(self, username): self.find_element_by_xpath("//div[contains(@class, 'f...
StarcoderdataPython
6484940
<filename>refresher/index.py #!/usr/bin/python import sys def utf8_print(string=''): sys.stdout.buffer.write(string.encode('utf8') + b'\n') # Turn on debug mode. import cgitb cgitb.enable() # Print necessary headers. utf8_print("Content-Type: text/html") utf8_print() with open('index.template.html', 'r', encodin...
StarcoderdataPython
5103330
<filename>deepspeed/runtime/eigenvalue.py import torch from deepspeed.utils import log_dist import numpy as np import logging class Eigenvalue(object): def __init__(self, verbose=False, max_iter=100, tol=1e-2, stability=0, ...
StarcoderdataPython
9679163
# -*- coding: utf-8 -*- import os import libvirt import sys from xml.dom import minidom def install_env(): return os.system("sudo apt-get install qemu-kvm qemu virt-manager \ virt-viewer libvirt-bin bridge-utils") def set_bridge(): file = '/etc/network/interfaces' #网络配置文件 try: with open(file) as f: strs ...
StarcoderdataPython
3560654
# -*- coding: utf-8 -*- # Copyright (c) 2018 <NAME> # See LICENSE.md for details. """ PWM flashing LED. ------------- Every second change duty cycle. """ import sys, time from argparse import * from cffi import FFI from libpwmio import libpwmio class ledflash: def __init__(self): """Create library...
StarcoderdataPython
9685238
<reponame>nahuelmol/patitas from rest_framework import serializers from django.contrib.auth.models import User from rest_framework.authtoken.models import Token from rest_framework.response import Response from rest_framework import status from users.utils import generate_access_token class RegisterSerializer(serial...
StarcoderdataPython
11214652
"""This script is an example on how to perform NER inference on plain texts. Input file must be either a JSON file (that can have multiple documents) or a txt file with a single document. """ import json import logging import os import tempfile from argparse import ArgumentParser, Namespace from typing import List, Tu...
StarcoderdataPython
8041672
<filename>src/Authenticate.py """Framework for allowing flexible access authorization. To start, this is used by the HTTP api to perform basic access authorization. """ from Tkinter import * import tktools import string import urlparse import base64 import re class AuthenticationManager: """Handles HTTP access a...
StarcoderdataPython
9693106
<filename>Python/Topics/Accessing data in a DataFrame/Clever index reseting/main.py<gh_stars>1-10 # your code here, the dataset is already loaded. The variable name is df_rock. df_rock.reset_index(drop=True, inplace=True) print(df_rock.index)
StarcoderdataPython
6509712
from verbs.baseforms import forms class ApplyForm(forms.VerbForm): name = "Apply" slug = "apply" edit_what_remark = forms.CharField() describe_where = forms.CharField() duration_min_time = forms.IntegerField() edit_remarks = forms.CharField() specify_tool = forms.CharField() comment_...
StarcoderdataPython
11277718
N = int(input()) print("ABC" if N <= 999 else "ABD")
StarcoderdataPython
1956811
<filename>Exam preparation/Python Advanced Exam - 14 February 2021/01_fireworks.py firework_effect = [int(el) for el in input().split(", ")] explosive_power = [int(el) for el in input().split(", ")] firework_effect_copy = firework_effect.copy() explosive_power_copy = explosive_power.copy() palm_firework = 0 willow_fir...
StarcoderdataPython
8004740
<filename>server/utils.py import logging import time import math from datetime import datetime,timedelta,tzinfo # import cProfile, pstats, cStringIO import functools import inspect import os,sys try: from server.config import conf except: from config import conf def advance_logger(loglevel): def get_line...
StarcoderdataPython
11250929
<reponame>kusanagi/katana-sdk-python3<gh_stars>1-10 """ Python 3 SDK for the KATANA(tm) Framework (http://katana.kusanagi.io) Copyright (c) 2016-2018 KUSANAGI S.L. All rights reserved. Distributed under the MIT license. For the full copyright and license information, please view the LICENSE file that was distributed...
StarcoderdataPython
11328284
# -*- mode: python; coding: utf-8 -*- # Copyright (c) 2018 Radio Astronomy Software Group # Licensed under the 2-clause BSD License """Class for reading and writing calibration FITS files.""" import warnings import numpy as np from astropy.io import fits from .uvcal import UVCal from .. import utils as uvutils __all...
StarcoderdataPython
4880893
<reponame>mindspore-ai/contrib<gh_stars>1-10 """[summary] Returns: [type]: [description] """ import os import json import numpy as np from sklearn import model_selection, preprocessing from src.global_variables import FED_NUM, file_path def load_only(src_path): """[summary] Args: src_path ([type...
StarcoderdataPython
1851643
<reponame>domlysi/djangocms_plus import logging from collections import OrderedDict from django import forms from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from cmsplus.app_settings import cmsplus_settings from cmsplus.fields import (PageSearchField, PlusFil...
StarcoderdataPython
143592
from flask import Flask, render_template, jsonify, request from json import dump from colony import Colony # diaspora.py is a web service that serves space colonies. # (built with Flask, served with gunicorn, deployed with heroku) app = Flask(__name__, static_url_path='/static') app.config["JSON_SORT_KEYS"] = False ...
StarcoderdataPython
218267
<reponame>fredatgithub/github-stats # coding: utf-8 from datetime import datetime import logging from flask.ext import restful from werkzeug import exceptions import flask import util class Api(restful.Api): def unauthorized(self, response): flask.abort(401) def handle_error(self, e): return handle_er...
StarcoderdataPython
4852998
<reponame>knot126/Stratigise { # NOTE: While the opcodes are fairly well known, the arguments are not very # well known and are still in research. 'InstructionSize': 1, 0x00: ['CommandError'], # This should never normally appear. 0x01: ['LoadObject', 'string'], 0x02: ['LoadSprite'], 0x03: ['LoadAnim'], 0x04: ['...
StarcoderdataPython
3540412
<reponame>ChrisCummins/format<gh_stars>0 # Copyright 2014-2019 <NAME> <<EMAIL>>. # # 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
335375
<reponame>BenMussay/Data-Independent-Neural-Pruning-via-Coresets<filename>coreset.py from typing import Callable, Tuple, Union import sys import torch import numpy as np class Coreset: def __init__(self, points, weights, activation_function: Callable, upper_bound: int = 1): assert points.shape[0...
StarcoderdataPython
6652642
# Copyright (c) 2019, IRIS-HEP # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the foll...
StarcoderdataPython
148916
<gh_stars>0 """ Experiment for XGBoost + CF Aim: To find the best tc(max_depth), mb(min_child_weight), mf(colsample_bytree * 93), ntree tc: [13, 15, 17] mb: [5, 7, 9] mf: [40, 45, 50, 55, 60] ntree: [160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360] Averaging 20 models Summary Best loss ...
StarcoderdataPython
11228011
<reponame>Nutzer001/greenaddress from zipfile import ZipFile from io import BytesIO import base64 from pycoin.encoding import to_bytes_32 from pycoin.tx.Tx import Tx, SIGHASH_ALL from gaservices.utils.btc_ import tx_segwit_hash from gaservices.utils import inscript from wallycore import * def _fernet_decrypt(key, ...
StarcoderdataPython
1751789
''' Todo ano, Papai Noel faz o recrutamento de elfos e gnomos para a sua equipe de preparação natalina. O setor de sua produção que mais tem alterações ao longo do ano é o da fabricação dos presentes, pois ele contrata elfos temporários, que trabalham uma determinada quantidade de horas H com ele. Além disso, cada elfo...
StarcoderdataPython
6502463
#!/usr/bin/env python2.7 """ UNC Best Practice RNA-Seq Pipeline Author: <NAME> Affiliation: UC Santa Cruz Genomics Institute Please see the README.md in the same directory Tree Structure of RNA-Seq Pipeline (per sample) 0---> 2 | | 1 3 - - - - -> Consolidate Output -> Upload_to_S3 / \ ...
StarcoderdataPython
4865127
import threading from time import sleep from requests import get, exceptions from re import sub from re import compile as Compile from json import loads from os import mkdir, path from bs4 import BeautifulSoup as bs from hashlib import md5 default_headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; W...
StarcoderdataPython
12831074
<reponame>EDF-Lab/EDF """ .. module:: threading :platform: Unix :synopsis: A module that implements threading tools to use a GUI. .. Copyright 2022 EDF .. moduleauthor:: <NAME>, <NAME>, <NAME>, <NAME> .. License:: This source code is licensed under the MIT License. """ from PyQt5.QtCore import QObject, py...
StarcoderdataPython
1764444
# -*- coding: utf-8 -*- """ Created on Thu Aug 23 22:17:05 2018 @author: yoelr """ from ._splitter import Splitter from .decorators import cost __all__ = ('MolecularSieve',) # @cost('Flow rate', 'Pressure filter drying (2)', # cost=405000, CE=521.9, S=22687, n=0.6, kW=1044) # @cost('Flow rate', 'Pressure filt...
StarcoderdataPython
100646
<reponame>Imperat/SSU-Information-Security-Course import pda_exceptions as e class PDA(object): def __init__(self, rules, input_alphabet, states, initial_state, terminate_states): self.rules = rules self.input_alphabet = input_alphabet self.states = states self.sta...
StarcoderdataPython
11206042
# SETS THE APPLICATION CONFIG default_app_config = "canteenREST.apps.CanteenrestConfig"
StarcoderdataPython
9702033
from ..templatetags.analysis_tags import analyses_results_urls_list_str from topobank.analysis.models import Analysis def test_analyses_results_urls_list_str(mocker): mocker.patch('topobank.analysis.models.Analysis', autospec=True) analyses = [Analysis(id=i) for i in range(3)] # we just need any id rev...
StarcoderdataPython
5046120
<filename>demo_seq2seq_nmt.py # -*- coding: utf-8 -*- """ Created on Sun Jun 16 20:31:32 2019 @author: ruan """ import codecs import collections from operator import itemgetter import numpy as np from pandas import DataFrame as dataframe from pandas import Series as series import os import time import tensorflow as t...
StarcoderdataPython
1745686
{ "includes": [ "../common.gypi" ], "targets": [ { "target_name": "libgdal_ogr_htf_frmt", "type": "static_library", "sources": [ "../gdal/ogr/ogrsf_frmts/htf/ogrhtfdatasource.cpp", "../gdal/ogr/ogrsf_frmts/htf/ogrhtfdriver.cpp", "../gdal/ogr/ogrsf_frmts/htf/ogrhtflayer.cpp" ], "include...
StarcoderdataPython
6468683
from torch.utils.data import Dataset, DataLoader import cv2 import torchvision.transforms.functional as TF import numpy as np import torch class CharacteristicsDataset(Dataset): def __init__(self, path, target, size = None, transform = None): self.path = path self.target = torch.from_numpy(target...
StarcoderdataPython
1793108
<gh_stars>10-100 import tkinter as tk class Bottom(tk.Frame): def __init__(self, master, *args, **kwargs): tk.Frame.__init__(self, master, *args, **kwargs) self['bg'] = '#2c2c2c' self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=1) self.grid_propagate(False) def show_frame(self, ti...
StarcoderdataPython
3432543
<gh_stars>10-100 from __future__ import print_function import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import make_blobs from sklearn.cluster import AgglomerativeClustering # For reproducibility np.random.seed(1000) nb_samples = 3000 def plot_clustered_dataset(X, Y): fig, ax = plt.sub...
StarcoderdataPython
221765
"""Copyright 2012 Phidgets Inc. This work is licensed under the Creative Commons Attribution 2.5 Canada License. To view a copy of this license, visit http://creativecommons.org/licenses/by/2.5/ca/ """ __author__ = '<NAME>' __version__ = '2.1.8' __date__ = 'May 17 2010' import threading from ctypes import * from Phi...
StarcoderdataPython
9714473
from regression_tests import * class Test(Test): settings = TestSettings( tool='fileinfo', input=[ 'sample_20.ex', 'sample_236.ex', 'sample_23x.ex', 'sample_42321.ex', 'sample_uv_02.ex', ], args='--json' ) def test...
StarcoderdataPython
1713961
def create_description(): print('ok') class mission: id = -1 delete_count = -1 count = -1 def __init__(self, name, date_add, date_start, date_end, description): mission.id += 1 mission.count += 1 self.count = mission.count self.date_start = date_start ...
StarcoderdataPython
9615915
import pytest try: import ray from ray.rllib.agents.a3c import A2CTrainer, A3CTrainer from ray.rllib.agents.es import ESTrainer from ray.rllib.agents.ddpg import TD3Trainer, ApexDDPGTrainer from ray.rllib.agents.ddpg.ddpg import DDPGTrainer from ray.rllib.agents.impala import ImpalaTrainer f...
StarcoderdataPython
9712145
<filename>_Model Testing/match_model_test.py from math import * import time import csv surface_gas_molpercent = {"H2O": 93.32, "CO2": 3.33, "SO2": 3.34} shallow_eq = {"H2O": 71.41, "CO2": 19.93, "SO2": 8.67} int_eq = {"H2O": 24.43, "CO2": 3.83, "SO2": 71.74} deep_eq = {"H2O": 35....
StarcoderdataPython
3444405
from tkinter import * import time import serial SIZE = 18 UPDATE_RATE = 100 pixels = [0]*(SIZE**2) BAUD_RATE = 115200 time.sleep(1) def get_port_name(): for i in range(0, 256): # Select right port (GNU/Linux and Windows) for serial_name in ['/dev/ttyUSB', '/dev/ttyACM', 'COM']: try: arduino ...
StarcoderdataPython
6641756
import numpy as np def lyapunov(N,phi,QQ): return(np.matmul(np.linalg.inv(np.identity(N**2) - np.kron(phi,phi)), QQ.reshape(N**2,1)).reshape((N,N)))
StarcoderdataPython
354729
<reponame>GuiBarreto/Segundo-Mundo-Python-Curso-em-Video<gh_stars>0 valor1 = float(input('Primeiro número: ')) valor2 = float(input('Segundo número: ')) if valor1 > valor2: print('O primeiro número é maior!') elif valor1 < valor2: print('O segundo valor é maior!') else: print('Os dois números são iguais!')
StarcoderdataPython
4853145
from ..pkg_info import cmp_pkg_version import unittest from unittest import mock import pytest MODULE_SCHEDULE = [ ("5.0.0", ["nibabel.keywordonly"]), ("4.0.0", ["nibabel.trackvis"]), ("3.0.0", ["nibabel.minc", "nibabel.checkwarns"]), # Verify that the test will be quiet if the schedule outlives the mo...
StarcoderdataPython