id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
28231
<reponame>chfw/gease from mock import MagicMock, patch from nose.tools import eq_ from gease.contributors import EndPoint from gease.exceptions import NoGeaseConfigFound class TestPublish: @patch("gease.contributors.get_token") @patch("gease.contributors.Api.get_public_api") def test_all_contributors(sel...
StarcoderdataPython
3463500
<reponame>hpu12138/pkg import numpy as np import pandas as pd from sklearn.manifold import TSNE import matplotlib.pyplot as plt from matplotlib import gridspec from scsim import CortexDataset, Sampler import torch from sklearn.mixture import GaussianMixture as GM n_epochs_all = None save_path='data/' dat...
StarcoderdataPython
5033001
<gh_stars>0 import sys import multiprocessing import numpy as np import pandas as pd from HLTIO import IO from HLTIO import preprocess from HLTvis import vis from HLTvis import postprocess import xgboost as xgb import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import importlib import pickle import...
StarcoderdataPython
9639601
<reponame>pjgrandinetti/mrsimulator<gh_stars>10-100 #!/usr/bin/env python # -*- coding: utf-8 -*- """ Coupled spin-1/2 (Static dipolar spectrum) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ¹³C-¹H static dipolar coupling simulation. """ # %% import matplotlib.pyplot as plt from mrsimulator import Simulator, SpinSystem ...
StarcoderdataPython
3387669
<reponame>kunalk3/Machine_Learning_using_Python<gh_stars>0 #--------------------------------------------------------------------- # File Name : MultilinearRegression.py # Author : <NAME>. # Description : Implementing MLR # Date: : 13 Nov. 2020 # Version : V1.0 # Ref No : DS_Code_P_K07 #-----------...
StarcoderdataPython
358758
#!/usr/bin/env python # -*- encoding: utf-8 -*- import sqlite3 import re import time,threading import urllib2,os import hashlib import MySQLdb import datetime from multiprocessing import Pool _db_host = '127.0.0.1' _db_user = 'root' _db_pwd = '<PASSWORD>' _db_name = 'spider' _db_table = 'spider_data2' _down_dir = '/roo...
StarcoderdataPython
1908351
@app.route('/magic/<number>/') def do_magic(number): try: print "About to do some magic with {0}".format(number) response = magic(number) except Exception as e: print "Got an exception {0} :(".format(e) abort(500, "Oops :(") else: print "Magic done: {0}".format(respon...
StarcoderdataPython
8115838
from django.db import models from django.contrib.auth.models import User from simple_history.models import HistoricalRecords class ColorPalette(models.Model): name = models.CharField(max_length=255) user = models.ForeignKey(User, on_delete=models.CASCADE) is_public = models.BooleanField(default=True) ...
StarcoderdataPython
4980877
<reponame>verifid/idtext<gh_stars>10-100 #!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import argparse import cv2 from mocr import TextRecognizer, face_detection def display_image(image, results, file_name): output = image.copy() # loop over the results for ((startX, startY, endX, e...
StarcoderdataPython
4977141
from scipy.special import comb from Binomial import binomialTree from scipy.stats import norm from scipy.optimize import root from scipy.optimize import brentq import math class Liquidity(binomialTree): def __init__(self, k=1, rf=0.05, steps=50, vol=0.2, ttm=1): if (steps % (k + 1) != 0): rais...
StarcoderdataPython
1792862
import yaml def read_config(config_path): with open(config_path, "r") as f_config: config = yaml.load(f_config) return config
StarcoderdataPython
4982935
<reponame>relax-space/python-xxm import sys,os,traceback,json import dto """ 练习文件的读写 python.exe .\second_step\s2.py 参考: https://www.w3cschool.cn/pythonlearn/dfmt1pve.html https://www.runoob.com/python/file-methods.html """ class File: def __init__(self): pass def read(self): path ="seco...
StarcoderdataPython
8172651
<gh_stars>10-100 import bpy from bpy.props import * from ...nodes.BASE.node_base import RenderNodeBase # from ...utility import source_attr from mathutils import Color, Vector def update_node(self, context): if self.operate_type == 'MULTIPLY': self.create_input('RenderNodeSocketInt', 'count', 'Count') ...
StarcoderdataPython
158815
<gh_stars>0 # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
StarcoderdataPython
128023
<gh_stars>0 # ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by <NAME> and <NAME> # Email: <EMAIL> # Details: SiamFC training script # ------------------------------------------------------------------------------ im...
StarcoderdataPython
156033
<reponame>Orion-Hunter/SaladoEmpreendedor from pydantic import BaseModel from typing import Optional, List from datetime import datetime ####Schemas Servidor class ServidorBase(BaseModel): MATRICULA: int NOME: str SENHA: str SECRETARIA: str class ServidorCreate(ServidorBase): SENHA: str...
StarcoderdataPython
11337560
<reponame>hutomadotAI/Research-Experiments import tensorflow as tf from layers import dropout, _last_relevant class GRU: def __init__(self, num_layers, num_units, batch_size, input_size, keep_prob=1.0, is_train=None, seed=3435, scope=None): self.num_layers = num_layers self.grus ...
StarcoderdataPython
4816056
<reponame>Euromance/pycopy # It's not possible to delete a global var at runtime in strict mode. gvar = 1 del gvar gvar = 2 def __main__(): print("in __main__") global gvar # In the current implementation, TypeError is thrown. This is considered # an implementation detail and may change later to e.g...
StarcoderdataPython
6565197
from sqlalchemy import Column from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchemy import LargeBinary from sqlalchemy import String from chainerui import database class Bindata(database.BASE): __tablename__ = 'bindata' id = Column(Integer, primary_key=True) asset_id = Column(...
StarcoderdataPython
9696760
<reponame>krzjoa/sciquence import string def load_txt(path): with open(path, mode='r') as f: return f.readlines() def remove_punctuation(s): return s.translate(None, string.punctuation) def word2idx(path): word2idx = {'START': 0, 'END': 1} current_idx = 2 sentences = [] for line in o...
StarcoderdataPython
6657190
if __name__ == "__main__": import sys sys.path.insert(0, ".") from zzgui.qt5.zzapp import ZzApp from zzgui.qt5.zzform import ZzForm as ZzForm from zzgui.qt5.zzform import zzMess from zzgui.zzmodel import ZzCursorModel from zzdb.schema import ZzDbSchema from zzdb.db import ZzDb from zzdb.cursor import ZzCur...
StarcoderdataPython
1910301
import logging import requests import json from operator import itemgetter import urllib.parse logger = logging.getLogger(__name__) def _get_cf_url(self): return self.get_apibase() + "/custom-fields/objects" def supported_cf_object_types(self): '''Get the types and cache them since they are static (on a per-...
StarcoderdataPython
203709
"""Pytorch Resnet_RS This file contains pytorch implementation of Resnet_RS architecture from paper "Revisiting ResNets: Improved Training and Scaling Strategies" (https://arxiv.org/pdf/2103.07579.pdf) """ from functools import partial import torch.nn as nn import torch.nn.functional as F from .base import StemBlock...
StarcoderdataPython
369340
""" A few global defintions """ from typing import TypeVar from apischema import schema #: A generic Type for use in type hints T = TypeVar("T") def desc(description: str): """a description Annotation to add to our Entity derived Types""" return schema(description=description)
StarcoderdataPython
9656481
<filename>CondCore/PopCon/test/PopConEffExampleTargetDB.py import FWCore.ParameterSet.Config as cms process = cms.Process("ProcessOne") process.load("CondCore.DBCommon.CondDBCommon_cfi") process.CondDBCommon.connect = 'sqlite_file:pop_test2.db' process.MessageLogger = cms.Service("MessageLogger", cout = cms.untr...
StarcoderdataPython
6628144
import pytest import whwreader.whwreader as whwreader from whwreader.whwreader import Reading def test_transform(): #Preamble whwreader.__sensor_time_offset['boris'] = 0 whwreader.__sensor_time_offset['charles'] = 1546804623.6360931 sensor_reading = "name=boris::time=2134457::temp=25.5::humid=56.8" ...
StarcoderdataPython
1733634
from pathlib import Path from tqdm import tqdm import tensorflow as tf from modules.esrgan import rrdb_net from modules.lr_scheduler import MultiStepLR from modules.data import load_dataset from modules.losses import get_pixel_loss HAS_WANDB_ACCOUNT = True PROJECT = 'esrgan-tf2' import wandb if not HAS_WAND...
StarcoderdataPython
1633133
#!/usr/bin/env python import DIRAC from DIRAC import S_OK, S_ERROR from DIRAC.Core.Base import Script Script.setUsageMessage( """ Insert random trigger file into the File Catalog Usage: %s [option] """ % Script.scriptName ) fcType = 'FileCatalog' Script.registerSwitch( "f:", "file-catalog=", "Catalog client ty...
StarcoderdataPython
5044451
#!/usr/bin/env python import optparse import os import sys import tempfile import shutil import subprocess import re import logging import urllib2 from urlparse import urlparse assert sys.version_info[:2] >= (2, 6) log = logging.getLogger(__name__) CHUNK_SIZE = 2**20 #1mb def stop_err(msg): sys.stderr.write("%...
StarcoderdataPython
4812152
import discord from discord.ext import commands from discord.ext.commands import cooldown from discord.ext.commands.cooldowns import BucketType import time import asyncio import asyncpg from datetime import datetime, timedelta from random import randint sorts = ['total_deaths','foes_killed','uwus','current_xp','curren...
StarcoderdataPython
9699916
<gh_stars>0 from livereload import Server from microblog import app # app.debug = True # server = Server(app.wsgi_app) # server.serve()
StarcoderdataPython
188210
<reponame>erwan-lemonnier/pymacaron-core<filename>pymacaron_core/swagger/server.py import jsonschema import logging import uuid import os from functools import wraps from werkzeug.exceptions import BadRequest from flask import request, jsonify from flask_cors import cross_origin from pymacaron_core.exceptions import Py...
StarcoderdataPython
3270464
class TweetCounter(object): def __init__(self, **kwargs): self.counter = 0 def add_tweet(self,tweet): self.counter += 1 def get(self): return [(self.counter,self.get_name())] def get_name(self): return 'TweetCounter' def combine(self,new): self.counter += new....
StarcoderdataPython
1946690
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('rsvp', '0005_event_caption'), ] operations = [ migrations.AlterField( ...
StarcoderdataPython
1644990
import shutil from functools import partial try: from contextlib import asynccontextmanager except ImportError: from async_generator import asynccontextmanager import pytest import tus from aiohttp import hdrs, web from aiohttp.test_utils import TestClient from aiohttp_tus import setup_tus from aiohttp_tus.a...
StarcoderdataPython
6414042
""" This is a class to store the global chain params """ class CHAIN(object): # Max possible target for a block MAX_TARGET = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff MAX_TARGET_HEX = 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' MAX_NONCE_LEN = 64 ...
StarcoderdataPython
6705671
import pandas as pd import numpy as np import redis import json import geopandas, astral import time from astral.sun import sun import requests, zipfile, io, os, re from tabulate import tabulate METEO_FOLDER = r"C:/Users/48604/Documents/semestr5/PAG/pag2/Meteo/" ZAPIS_ZIP = METEO_FOLDER + r"Meteo_" url = ...
StarcoderdataPython
5071280
from kernel.kernel import Kernel from kernel.output import Output, OutputResult from modules import AbstractModule class Dictionary(AbstractModule): def check(self): return True def check_arguments(self): self.dict_words = {} self.encoding_list = [] if len(self.args) == 0: ...
StarcoderdataPython
1686225
""" Generates the regret plot for an experiment. Includes the regret curves for the random policy, conventional algorithms like SW-UCB, and the default and best neural bandits. Usage: $ python3 regret_analysis.py experiment_folder/ With no additional flag this takes the 'best' rnn and ffnn po...
StarcoderdataPython
1671652
#RESOLUÇÃO DO PROFESSOR/LEONARDO: from time import sleep import random print('''Escolha uma opção: [ 0 ] - PEDRA [ 1 ] - PAPEL [ 2 ] - TESOURA ''') print('-=-'*30) jog = int(input('Qual é a sua jogada? ')) if jog<0 or jog>2: print('COMANDO INVÁLIDO, TENTE NOVAMENTE') exit() sleep(0.5) print('PEDRA...') sleep(1...
StarcoderdataPython
11360479
<filename>vmaig_blog/uwsgi-2.0.14/plugins/transformation_offload/uwsgiplugin.py NAME='transformation_offload' CFLAGS = [] LDFLAGS = [] LIBS = [] GCC_LIST = ['offload']
StarcoderdataPython
6697021
<filename>framework/game.py<gh_stars>0 # -*- coding: utf-8 -*- from .card import Rank, Suit, Card from .hand import Hand from .learning_state import LearningState from .round_info import RoundInfo from .utils import * from copy import deepcopy from random import shuffle class Game: def __init__(self, players, l...
StarcoderdataPython
1838996
<filename>model/Media.py from shared import db class Media(db.Model): id = db.Column(db.Integer, primary_key=True) ext = db.Column(db.String(3), nullable=False)
StarcoderdataPython
6634016
<gh_stars>10-100 import signal from concurrent import futures import grpc import service_pb2 import service_pb2_grpc class ServerServicer(service_pb2_grpc.ServerServicer): def Foo(self, request, context): return service_pb2.Empty() def main(): port = '1337' with open('server.key', 'rb') as f:...
StarcoderdataPython
5153369
from .UnaryArithmeticOpNode import UnaryArithmeticOpNode class SuffixOpNode(UnaryArithmeticOpNode): def __init__(self,op,expr): super().__init__(op,expr) def accept(self,visitor): return visitor.visit(self)
StarcoderdataPython
9622118
<filename>tests/test_lib.py """Unit tests for library integration.""" import pathlib import toml import pytest import mkdocs_code_runner from mkdocs_code_runner import lib def test_findall(markdown: str) -> None: """Check that the JavaScript code is correctly found.""" query = "div.code-runner" expe...
StarcoderdataPython
109077
# Copyright 2022 iiPython # Wrapper for the builtin Python socket module # It includes basic encryption using Python cryptography # Modules import json import socket import base64 from typing import Any, List from types import FunctionType from copy import copy as copyobj try: from cryptography.fernet import Fer...
StarcoderdataPython
1646285
<reponame>mv/ynab-py-scripts #!/usr/bin/env python3 """ YNAB: creting CSV files to be imported into YNAB 4 Classic Usage: ynab <filename> [options] ynab <filename> [<filename>...] [-o | -i ] [-v | --verbose] ynab --version ynab -h | --help Options: -o --ofx Type: ofx file (defa...
StarcoderdataPython
5135430
<gh_stars>0 # Copyright (c) 2016 The UUV Simulator Authors. # 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 # # Unles...
StarcoderdataPython
341157
<reponame>gbv/mc2skos #!/usr/bin/env python # encoding=utf8 # # Script to convert MARC 21 Classification records # (serialized as MARCXML) to SKOS concepts. See # README.md for more information. import sys import re import time import warnings from datetime import datetime from iso639 import languages import argparse ...
StarcoderdataPython
3350691
<reponame>TriggeredMessaging/django-mongoengine def resolve_callables(mapping): """ Generate key/value pairs for the given mapping where the values are evaluated if they're callable. """ # backport from django-3.2 # after we drop support for django below 3.2, this can be removed for k, v in ...
StarcoderdataPython
6696331
# encoding: utf-8 import ckan.authz as authz def package_patch(context, data_dict): return authz.is_authorized('package_update', context, data_dict) def resource_patch(context, data_dict): return authz.is_authorized('resource_update', context, data_dict) def group_patch(context, data_dict): return au...
StarcoderdataPython
9784029
print("In this lesson take each keyword and first try to write out what it does from memory.") print("Next, search online for it and see what it really does.")
StarcoderdataPython
5104776
<gh_stars>0 from challenges.models.challenge import Challenge from django.db import models from django.utils import timezone from challenges.models import Challenge from accounts.models import Profile class Submission(models.Model): challenge = models.ForeignKey(Challenge, on_delete=models.CASCADE, related_name='...
StarcoderdataPython
8093465
<filename>TableGeneration/tools.py<gh_stars>1-10 from PIL import Image from io import BytesIO import urllib.parse def html_to_img(driver,html_content,id_count): '''converts html to image''' html_content = urllib.parse.quote(html_content) driver.get("data:text/html;charset=utf-8," + html_content) windo...
StarcoderdataPython
4963677
# -*- coding: utf-8 -*- """Flask integration that avoids the need to hard-code URLs for links. This includes a Flask-specific schema with custom Meta options and a relationship field for linking to related resources. """ from __future__ import absolute_import import flask from werkzeug.routing import BuildError from...
StarcoderdataPython
6421024
from enum import Enum import os from robonaldo.context.game import GameContext from robonaldo.context.updater import ContextUpdater from robonaldo.context.robot import Robot from robonaldo.controller import RobotController from robonaldo.log import Logger, LogLevel from robonaldo.utils import Singleton from typing impo...
StarcoderdataPython
1960495
<filename>Tagged/save_data.py #!/usr/bin/python # -*- coding:utf-8 -*- #author:iuyyoy import os,sys sys.path.append('..') from Global.config import * from Global.db_op import Db_op as DB from Global.global_function import printout from get_data import * class Save_data(object): db = DB(dbinfo = dbinfo) def...
StarcoderdataPython
9748824
# -*- coding: utf-8; -*- ''' Generate a Python extension module with the constants defined in linux/input.h. ''' from __future__ import print_function import os, sys, re #----------------------------------------------------------------------------- # The default header file locations to try. headers = [ '/usr/i...
StarcoderdataPython
9605692
<reponame>alisaifee/aredis from __future__ import annotations import os import warnings from abc import ABC, abstractmethod from numbers import Number from typing import ( TYPE_CHECKING, AbstractSet, Any, AnyStr, AsyncGenerator, Awaitable, Callable, ClassVar, Coroutine, Dict, ...
StarcoderdataPython
4868168
"""glitter positioning system""" import time import gc import math # import adafruit_lsm9ds1 import adafruit_gps import adafruit_rfm9x import board import busio import digitalio # import neopixel # import rtc from glitterpos_util import timestamp # glitterpos_cfg.py should be unique to each box, and formatted as foll...
StarcoderdataPython
2958
#!/usr/bin/env python ######################################################################################### # # Apply transformations. This function is a wrapper for sct_WarpImageMultiTransform # # --------------------------------------------------------------------------------------- # Copyright (c) 2014 Polytechn...
StarcoderdataPython
6669554
<filename>datasets/prepare_data/SISR/make_kernel_noise.py #!/usr/bin/env python # -*- coding:utf-8 -*- # Power by <NAME> 2020-06-07 17:21:29 from pathlib import Path import sys sys.path.append(str(Path('./'))) from utils import getGaussianKernel2D from datasets.data_tools import anisotropic_Gaussian import numpy as...
StarcoderdataPython
1849949
import re import pytest from pyquery import PyQuery from scripts.helpers import serialize_xml, parse_xml from scripts.generate_case_html import generate_html, tag_map from scripts.merge_alto_style import generate_styled_case_xml from scripts.compare_alto_case import validate from capdb.models import CaseXML, CaseMetad...
StarcoderdataPython
6577653
<gh_stars>0 machines = ['fan','pump','slider','valve'] kinds = ['normal', 'abnormal'] rootpath = f'F:/Graduate_projrct/Pictures/Mel/' def name_path(name): paths = [] for machine in machines: paths.append(rootpath+f'{machine}/{name}') return paths file_names = {'normal': name_path(kinds[0]),'abnormal...
StarcoderdataPython
6601509
import numpy as np from cachetools.keys import hashkey from cachetools import LRUCache, cached from scipy import signal, fftpack from datavis.common import strided_array def speckey(sig, *args, **kwargs): key = hashkey(*args, **kwargs) return key @cached(LRUCache(maxsize=10), key=speckey) def spectrogram(si...
StarcoderdataPython
3400409
import pathlib import typer import pandas as pd from transliterate import get_translit_function from sklearn.model_selection import train_test_split from ..common import nlu_path_to_dataframe, dataframe_to_nlu_file, entity_names app = typer.Typer( name="augment", add_completion=False, help="""Commands t...
StarcoderdataPython
5196537
<gh_stars>10-100 import sys import spotipy import yaml import spotipy.util as util from pprint import pprint import json def load_config(): global user_config stream = open('config.yaml') user_config = yaml.load(stream) # pprint(user_config) def add_monthly_playlist_tracks(sources, target_playlist_id)...
StarcoderdataPython
1908793
<reponame>BraveGroup/SSPL """ Predictive coding module (PCM) for audio and visual feature alignment. """ import torch import torch.nn as nn import torch.nn.functional as F # top-down prediction process class pred_module(nn.Module): def __init__(self, inchan, outchan, downsample=False): super(pred_module...
StarcoderdataPython
290170
# Generated by Django 3.0.5 on 2021-09-01 10:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Quiz', '0006_auto_20210901_0043'), ] operations = [ migrations.AlterField( model_name='elegirrespuesta', name='id', ...
StarcoderdataPython
12807212
spam = 42 # global variable def eggs(): spam = 42 # local variable print('Some code here.') print('Some more code.')
StarcoderdataPython
3496166
def xor(*args): if sum([bool(a) for a in args])==1: return True return False
StarcoderdataPython
6420497
import numpy as np def round_amount(amount, exchange, symbol, type): rounded_amount_str = exchange.amount_to_precision(symbol, amount) if type == 'down': rounded_amount = float(rounded_amount_str) elif type == 'up': decimal = rounded_amount_str[::-1].find('.') min_amount...
StarcoderdataPython
208280
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP. # Apache License 2.0 import json import logging from pyaoscx.exceptions.generic_op_error import GenericOperationError from pyaoscx.exceptions.parameter_error import ParameterError from pyaoscx.exceptions.response_error import ResponseError from pyaoscx.u...
StarcoderdataPython
11344485
<filename>bika/lims/upgrade/to3019.py from Acquisition import aq_inner from Acquisition import aq_parent from bika.lims.permissions import * def upgrade(tool): # Hack prevent out-of-date upgrading # Related: PR #1484 # https://github.com/bikalabs/Bika-LIMS/pull/1484 from bika.lims.upgrade import skip_...
StarcoderdataPython
6691260
import pymysql import bcrypt import pygame import sqlite3 import os pygame.mixer.init() main_dir = os.path.split(os.path.abspath(__file__))[0] data_dir = os.path.join(main_dir, 'data') class Database(object): path = os.path.join(data_dir, 'hiScores.db') def __init__(self,host='database-1.c79ahye2go7m.ap-north...
StarcoderdataPython
11218511
<gh_stars>10-100 #!/usr/bin/env python # encoding: utf-8 """ test_geomutils.py Created by <NAME> on 2015-04-21. """ from __future__ import division, print_function, absolute_import, unicode_literals import os from pygaarst import geomutils as gu def test_modapsclient_creation(): a = True assert a
StarcoderdataPython
377527
<filename>test/torch/nn/test_conv.py from syft.frameworks.torch.nn.conv import Conv2d import syft as sy import torch as th import torch.nn as nn def test_conv2d(workers): """ Test the Conv2d module to ensure that it produces the exact same output as the primary torch implementation, in the same order. ...
StarcoderdataPython
6478940
<filename>exempel1.py hej = int(32.8) + int( 333 ) + int( 99 ) print(hej) hej = "tja" he = "kalle" print( he ) apa = hej print( apa ) apa = "orm" print(apa) hej = hej + he + apa print( hej )
StarcoderdataPython
1831509
<gh_stars>1-10 from fastapi import Depends from fastapi_utils.cbv import cbv from fastapi_utils.inferring_router import InferringRouter from core.addons import AddonsManager from core.config import settings from core.pagination import Pagination from core.response import api_return_handler, ResponseMessage from fastap...
StarcoderdataPython
3240960
#coding:utf-8 # # id: bugs.core_5550 # title: Computed decimal field in a view has wrong RDB$FIELD_PRECISION # decription: # 30SS, build 3.0.3.32738: OK, 0.828s. # 40SS, build 4.0.0.680: OK, 1.062s. # # tracker_id: CORE-5550 # min_versions: ['3.0...
StarcoderdataPython
3599753
import datetime import unittest import googleanalytics from googleanalytics.exception import GoogleAnalyticsClientError from googleanalytics import config class GoogleAnalyticsTest(unittest.TestCase): def setUp(self): self.connection = googleanalytics.Connection() self.valid_profile_ids = config.g...
StarcoderdataPython
100857
<reponame>saurabhindoria/celery-docker-swarm import random from celery_tasks.tasks import AdditionCeleryTask, SubtractionCeleryTask, MultiplicationCeleryTask, DivisionCeleryTask from celery_tasks.utils import create_worker_from from flask import Flask flask_app = Flask(__name__) # create worker _, addition_worker = ...
StarcoderdataPython
226344
<gh_stars>1-10 import numpy as np from sklearn.metrics import (accuracy_score, f1_score, log_loss, mean_absolute_error, mean_squared_error, r2_score, roc_auc_score) from typing import List from sklearn.preprocessing import LabelBinarizer from fedot.core.data.data import InputData, OutputD...
StarcoderdataPython
8016114
from sys import stdin def get_answer(criteria): answer = "" if type(criteria) is int: while len(answer) < criteria: answer = stdin.readline().strip() elif type(criteria) is list or type(criteria) is tuple or type(criteria) is dict: while answer not in criteria: answ...
StarcoderdataPython
1953160
from emnist import extract_training_samples, extract_test_samples from matplotlib import pyplot trainx, trainy = extract_training_samples('digits') for i in range(25): pyplot.subplot(5, 5, 1 + i) pyplot.axis('off') pyplot.imshow(trainx[i], cmap='gray_r') pyplot.show()
StarcoderdataPython
6532058
<filename>config.py<gh_stars>0 import argparse import torch device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') folder = 'data/《刘慈欣作品全集》(v1.0)' print_freq = 1000 data_path = 'data/data.pkl' vocabulary_size = 60898 emb_size = 128 def parse_args(): parser = argparse.ArgumentParser(descr...
StarcoderdataPython
4881212
<reponame>Rakshit2214/virtual-assistant-Python-<gh_stars>1-10 from __future__ import print_function import numpy as np from pydub import AudioSegment import random import sys import os from scipy.io import wavfile print("by Logical Spot") import tensorflow import argparse parser = argparse.ArgumentParser(description=...
StarcoderdataPython
5174228
<gh_stars>1-10 #!/usr/bin/python -Wall # ================================================================ # Please see LICENSE.txt in the same directory as this file. # <NAME> # <EMAIL> # 2007-05-31 # ================================================================ # --------------------------------------------------...
StarcoderdataPython
6666341
<reponame>lestrato/badgepack<filename>apps/community/admin.py from django.contrib import admin from community.models import Community, Membership, Invitation, Application class CommunityAdmin(admin.ModelAdmin): readonly_fields = () #'created', 'name', list_display = ('name', 'description', 'tag', 'created_on',...
StarcoderdataPython
9746666
# -*- coding: utf-8 -*- """ Created on Sat Jun 29 07:41:54 2019 @author: (c) 2020 The Patent2Net Developers """ #import codecs import os import sys #import shutil #import pickle import matplotlib.cm from Patent2Net.P2N_Lib import LoadBiblioFile, AnnonceProgres, AnnonceLog from Patent2Net.P2N_Config import LoadConfi...
StarcoderdataPython
3437900
<reponame>jeevan-revaneppa-hirethanad/audio-to-speech-pipeline CONFIG_NAME = "audio_transcription_config" CLEAN_AUDIO_PATH = "remote_clean_audio_file_path" SHOULD_SKIP_REJECTED = "should_skip_rejected" LANGUAGE = "language" AUDIO_LANGUAGE = "audio_language"
StarcoderdataPython
5088928
import torch from torch import nn from torch.nn import functional def multiplicative(x, data): """ This function takes a 5d tensor (with the same shape and dimension order as the input to Conv3d) and a 2d data tensor. For each element in the batch, the data vector is combined with the first D dimensio...
StarcoderdataPython
6624517
<reponame>ws0416/tencentcloud-cli-intl-en<filename>tccli/services/gaap/gaap_client.py # -*- coding: utf-8 -*- import os import json import tccli.options_define as OptionsDefine import tccli.format_output as FormatOutput from tccli import __version__ from tccli.utils import Utils from tccli.exceptions import Configurati...
StarcoderdataPython
1858510
from .. import Provider as PersonProvider class Provider(PersonProvider): formats = ( "{{first_name}} {{last_name}}", "{{first_name}} {{last_name}}", "{{last_name}}, {{first_name}}", ) first_names = ( "Tomas", "Lukas", "Mantas", "Deividas", ...
StarcoderdataPython
1994104
#!/usr/bin/env python # -*- coding: utf-8 -*- # This script reads Huffman Code table [1] and generates symbol table # and decoding tables in C language. The resulting code is used in # lib/nghttp2_hd_huffman.h and lib/nghttp2_hd_huffman_data.c # # [1] http://http2.github.io/http2-spec/compression.html from __future_...
StarcoderdataPython
236087
N, Q = map(int,input().split()) A = [0] + list(map(int,input().split())) # print(N, Q) # print(A) # print("----") for i in range(Q): t, x, y = map(int,input().split()) if t == 1: A[x] = A[x] ^ y if t == 2: xor_list = A[x:-1] + [y] for j in range(len(xor_list)-1): res = ...
StarcoderdataPython
3222764
#!/usr/bin/env python from unittest import TestLoader, TestSuite, TextTestRunner import test_main import test_minimal import test_formula import test_json import test_use_case import test_styles modules = [test_main, test_minimal, test_formula, test_json, test_use_case, test_styles] loader = TestLoader() if __name...
StarcoderdataPython
6662803
import random def quick_sort_helper(a, beg, end): length = end - beg + 1 if length <= 1: return if length == 2: if a[beg] > a[end]: a[beg], a[end] = a[end], a[beg] return pivot_index = random.randint(beg, end) pivot = a[pivot_index] # 1 swap pivot with begi...
StarcoderdataPython
390871
from Levenshtein import distance import pandas as pd def compute_lev(x, y): try: return distance(x, y) except TypeError: # print("problem with retu ",x) return len(y) def compute_lev_norm(x, y): try: return y / len(x) except TypeError: return 1 def compute_l...
StarcoderdataPython