max_stars_repo_path
stringlengths
3
269
max_stars_repo_name
stringlengths
4
119
max_stars_count
int64
0
191k
id
stringlengths
1
7
content
stringlengths
6
1.05M
score
float64
0.23
5.13
int_score
int64
0
5
tests/test_check_types.py
oliel/python-ovirt-engine-sdk4
3
17200
<gh_stars>1-10 # -*- coding: utf-8 -*- # # Copyright (c) 2016 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
2.484375
2
nsi/shell.py
NextStepInnovation/nsi-tools
0
17201
<filename>nsi/shell.py<gh_stars>0 import os import io import sys import subprocess import shlex import logging from threading import Timer from typing import Callable, Any, List from pathlib import Path # noqa: for doctest import tempfile # noqa: for doctest from .toolz import ( merge, map, pi...
2.484375
2
ICLR_2022/Cubic_10D/PIVEN/DataGen.py
streeve/PI3NN
11
17202
""" Data creation: Load the data, normalize it, and split into train and test. """ ''' Added the capability of loading pre-separated UCI train/test data function LoadData_Splitted_UCI ''' import numpy as np import os import pandas as pd import tensorflow as tf DATA_PATH = "../UCI_Datasets" class DataGenerator:...
2.921875
3
after/config.py
mauvilsa/2021-config
5
17203
<reponame>mauvilsa/2021-config from dataclasses import dataclass @dataclass class Paths: log: str data: str @dataclass class Files: train_data: str train_labels: str test_data: str test_labels: str @dataclass class Params: epoch_count: int lr: float batch_size: int @dataclass...
1.789063
2
lab7/lab7.py
cudaczek/nlp-labs-2020
0
17204
<reponame>cudaczek/nlp-labs-2020<filename>lab7/lab7.py import pprint import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn import manifold from gensim.models import KeyedVectors # Download polish word embeddings for word2vec github/Google drive: # https://github.com/sdadas/polish-nlp-re...
3.09375
3
Nimbus-Controller/sqs-fastreader.py
paulfdoyle/NIMBUS
0
17205
# This script adds a new message to a specific SQS queue # # Author - <NAME> 2013 # # #from __future__ import print_function import sys import Queue import boto.sqs import argparse import socket import datetime import sys import time from boto.sqs.attributes import Attributes parser = argparse.ArgumentParser() parser....
2.421875
2
dero/ml/results/reformat.py
whoopnip/dero
0
17206
from typing import Optional import pandas as pd from dero.ml.typing import ModelDict, AllModelResultsDict, DfDict def model_dict_to_df(model_results: ModelDict, model_name: Optional[str] = None) -> pd.DataFrame: df = pd.DataFrame(model_results).T df.drop('score', inplace=True) df['score'] = model_results[...
2.546875
3
engine/view.py
amirgeva/py2d
0
17207
import pygame from engine.utils import Rect from engine.app import get_screen_size # EXPORT class View(object): def __init__(self, rect=None): if rect: self.rect = rect else: res = get_screen_size() self.rect = Rect(0,0,res[0],res[1]) def offset(self, d): ...
2.9375
3
oldplugins/coin.py
sonicrules1234/sonicbot
1
17208
<reponame>sonicrules1234/sonicbot import shelve, random arguments = ["self", "info", "args", "world"] minlevel = 2 helpstring = "coin <bet>" def main(connection, info, args, world) : """Decides heads or tails based on the coinchance variable. Adds or removes appropriate amount of money""" money = shelve.open...
3.109375
3
src/rbvfit/vfit_mcmc.py
manoranjan-s/rbvfit
0
17209
from __future__ import print_function import emcee from multiprocessing import Pool import numpy as np import corner import matplotlib.pyplot as plt import sys import scipy.optimize as op from rbvfit.rb_vfit import rb_veldiff as rb_veldiff from rbvfit import rb_setline as rb import pdb def plot_model(wave_obs,fnorm,e...
2.328125
2
yolox/data/dataloading.py
XHYsdjkdsjsk2021/Yolox_xhy
0
17210
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # Copyright (c) Megvii, Inc. and its affiliates. import torch from torch.utils.data.dataloader import DataLoader as torchDataLoader from torch.utils.data.dataloader import default_collate import os import random from .samplers import YoloBatchSampler def ...
2.78125
3
env/lib/python3.9/site-packages/ansible/modules/cloud/amazon/_ec2_vpc_vpn_facts.py
unbounce/aws-name-asg-instances
17
17211
#!/usr/bin/python # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = r''' --- module: ec2_vpc_vpn_info version_added: 1.0.0 short_description:...
1.742188
2
cogs/roleselector.py
YouGotSchott/tcs-discord-bot
1
17212
import discord from discord.ext import commands from pathlib import Path from config import bot from collections import OrderedDict import json class RoleSelector(commands.Cog): def __init__(self, bot): self.bot = bot self.messages_path = str(Path('cogs/data/messages.json')) async def opener(...
2.46875
2
Bunnies.py
fatih-iver/Intro-to-Computer-Science-with-Python
0
17213
<filename>Bunnies.py # Define a procedure, fibonacci, that takes a natural number as its input, and # returns the value of that fibonacci number. # Two Base Cases: # fibonacci(0) => 0 # fibonacci(1) => 1 # Recursive Case: # n > 1 : fibonacci(n) => fibonacci(n-1) + fibonacci(n-2) def fibonacci(n): ...
4.28125
4
symphony/cli/graphql_compiler/tests/test_utils_codegen.py
remo5000/magma
1
17214
#!/usr/bin/env python3 from .base_test import BaseTest from fbc.symphony.cli.graphql_compiler.gql.utils_codegen import CodeChunk class TestRendererDataclasses(BaseTest): def test_codegen_write_simple_strings(self): gen = CodeChunk() gen.write('def sum(a, b):') gen.indent() gen.wri...
2.421875
2
api/__init__.py
zhangyouliang/TencentComicBook
0
17215
from flask import Flask def create_app(): app = Flask(__name__) app.config['JSON_AS_ASCII'] = False from .views import app as main_app app.register_blueprint(main_app) return app
1.625
2
misc/pytorch_toolkit/chest_xray_screening/chest_xray_screening/utils/get_config.py
a-a-egorovich/training_extensions
0
17216
<gh_stars>0 import os import json def get_config(action, optimised = False): """ action: train, test, export or gdrive optimised: False --> DenseNet121 True --> DenseNet121Eff """ root_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) confi...
2.53125
3
src/udpa/annotations/versioning_pb2.py
pomerium/enterprise-client-python
1
17217
<filename>src/udpa/annotations/versioning_pb2.py # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: udpa/annotations/versioning.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from...
1.335938
1
modules/action/scan_smbclient_nullsession.py
mrpnkt/apt2
37
17218
<reponame>mrpnkt/apt2 import re from core.actionModule import actionModule from core.keystore import KeyStore as kb from core.utils import Utils class scan_smbclient_nullsession(actionModule): def __init__(self, config, display, lock): super(scan_smbclient_nullsession, self).__init__(config, display, loc...
2.171875
2
UserSpace/Python/Cosmo.py
dkaramit/MiMeS
2
17219
from numpy import logspace from sys import path as sysPath sysPath.append('../../src') #load the module from interfacePy import Cosmo cosmo=Cosmo('../../src/data/eos2020.dat',0,1e5) for T in logspace(-5,5,50): print( 'T=',T,'GeV\t', 'H=',cosmo.Hubble(T),'GeV\t', 'h_eff=',cosmo.heff(T),...
2.03125
2
src/psion/oauth2/endpoints/revocation.py
revensky/psion
2
17220
<filename>src/psion/oauth2/endpoints/revocation.py from __future__ import annotations from typing import Optional from psion.oauth2.exceptions import InvalidClient, OAuth2Error, UnsupportedTokenType from psion.oauth2.models import JSONResponse, Request from .base import BaseEndpoint class RevocationEndpoint(BaseEn...
2.75
3
experiments/Browser/browser.py
rajKarra69420/bento
3
17221
#!/usr/bin/env python3 import argparse import logging import sys import zlib sys.path.append("../..") from bento.client.api import ClientConnection from bento.common.protocol import * import bento.common.util as util function_name= "browser" function_code= """ import requests import zlib import os def browser(url, ...
2.515625
3
app/views/v1/search.py
daghan/Ostrich
0
17222
from app import webapp, mysql from app.models import Search , Utils, Collection, WebUtils from flask import request, jsonify from flask.ext.jsonpify import jsonify as jsonp import json ''' Generic search call @params q: search query page: the page number of search results (default 0) t...
2.359375
2
run.py
orest-d/pointcloud-viewer-rs
0
17223
from flask import Flask, make_response app = Flask(__name__) @app.route("/") @app.route("/index.html") def index(): html = open("assets/index.html").read() return html @app.route("/assets/<name>") def wasm(name): r = make_response(open(f"assets/{name}","rb").read()) if name.endswith(".wasm"): ...
2.875
3
engine/audio/audio_director.py
codehearts/pickles-fetch-quest
3
17224
from .audio_source import AudioSource from engine import disk import pyglet.media class AudioDirector(object): """Director for loading audio and controlling playback. Attributes: attenuation_distance (int): The default attenuation distance for newly loaded audio. Existing audio will retai...
3.09375
3
source/windows10 system repair tool.py
programmer24680/windows10-system-repair-tool
1
17225
import os import time print("=====================================================================") print(" ") print(" STARTING SYSTEM REPAIR ") print(" ...
3.765625
4
tests/test_fid_score.py
jwblangley/pytorch-fid
1,732
17226
<filename>tests/test_fid_score.py import numpy as np import pytest import torch from PIL import Image from pytorch_fid import fid_score, inception @pytest.fixture def device(): return torch.device('cpu') def test_calculate_fid_given_statistics(mocker, tmp_path, device): dim = 2048 m1, m2 = np.zeros((di...
2.125
2
run/client.py
withcouragetol/codebee-10l
6
17227
<filename>run/client.py #!/usr/bin/env python # -*- coding: utf-8 -*- import socket import time class emsc_client: def __init__(self): self.host = "10.10.83.174" self.port = 5000 self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def run(self): try: se...
3.140625
3
src/sonic_ax_impl/main.py
stepanblyschak/sonic-snmpagent
13
17228
""" SNMP subagent entrypoint. """ import asyncio import functools import os import signal import sys import ax_interface from sonic_ax_impl.mibs import ieee802_1ab from . import logger from .mibs.ietf import rfc1213, rfc2737, rfc2863, rfc3433, rfc4292, rfc4363 from .mibs.vendor import dell, cisco # Background task u...
1.828125
2
btk_server.py
bedrin/keyboard_mouse_emulate_on_raspberry
0
17229
<reponame>bedrin/keyboard_mouse_emulate_on_raspberry<filename>btk_server.py #!/usr/bin/python3 from __future__ import absolute_import, print_function from optparse import OptionParser, make_option import os import sys import uuid import dbus import dbus.service import dbus.mainloop.glib import time import socket from ...
2.640625
3
ai2thor/util/visualize_3D_bbox.py
KuoHaoZeng/ai2thor-1
0
17230
<reponame>KuoHaoZeng/ai2thor-1 import ai2thor.controller import numpy as np from PIL import Image, ImageDraw def get_rotation_matrix(agent_rot): ####### # Construct the rotation matrix. Ref: https://en.wikipedia.org/wiki/Rotation_matrix ####### r_y = np.array([[np.cos(np.radians(agent_rot["y"])), 0, ...
3.46875
3
sa/profiles/ElectronR/KO01M/get_metrics.py
prorevizor/noc
84
17231
<filename>sa/profiles/ElectronR/KO01M/get_metrics.py # --------------------------------------------------------------------- # ElectronR.KO01M.get_metrics # --------------------------------------------------------------------- # Copyright (C) 2007-2020 The NOC Project # See LICENSE for details # -----------------------...
2
2
clustering.py
t20100/ccCluster
0
17232
<reponame>t20100/ccCluster from __future__ import print_function __author__ = "<NAME>" __copyright__ = "Copyright 20150-2019" __credits__ = ["<NAME>, <NAME>"] __license__ = "" __version__ = "1.0" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __status__ = "Beta" from scipy.cluster import hierarchy import scipy imp...
2.421875
2
wrappaconda.py
nckz/wrappaconda
0
17233
#!/usr/bin/env python # Author: <NAME> # Date: 2015oct31 from __future__ import print_function import os import sys import stat import errno import shutil import optparse import traceback import subprocess wrappaconda_name_string = 'Wr[App]-A-Conda' class AppAtizer(object): def __init__(self): # tmp ...
2.375
2
watchtower/wallet/wallet.py
paytaca/watchtower-py
0
17234
import requests class Wallet(object): def __init__(self, testnet=False): if testnet: self.base_url = 'https://testnet.watchtower.cash/api/' else: self.base_url = 'https://watchtower.cash/api/' def _get_utxos(self, wallet_hash, amount): url = self.base_url + f'...
2.796875
3
test/unit/test_finalize.py
phated/binaryen
5,871
17235
<reponame>phated/binaryen<filename>test/unit/test_finalize.py from scripts.test import shared from . import utils class EmscriptenFinalizeTest(utils.BinaryenTestCase): def do_output_test(self, args): # without any output file specified, don't error, don't write the wasm, # but do emit metadata ...
2.125
2
mc/tools/TreeWidget.py
zy-sunshine/falkon-pyqt5
1
17236
from PyQt5.QtWidgets import QTreeWidget from PyQt5.Qt import pyqtSignal from PyQt5.QtWidgets import QTreeWidgetItem from PyQt5.Qt import Qt class TreeWidget(QTreeWidget): # enum ItemShowMode ItemsCollapsed = 0 ItemsExpanded = 1 def __init__(self, parent=None): super().__init__(parent) s...
2.75
3
app/api/v2/models/sales.py
danuluma/dannstore
0
17237
<filename>app/api/v2/models/sales.py import os import sys LOCALPATH = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, LOCALPATH + '/../../../../') from app.api.v2.db import Db def format_sale(sale): """Formats the results to a dictionary""" sale = { "id": sale[0], "books": sal...
3.234375
3
ubirch/linux/bleManager.py
ubirch/ubirch-ble-tool
4
17238
<filename>ubirch/linux/bleManager.py from bleSuite import bleConnectionManager, bleServiceManager from bluepy.btle import Scanner from ubirch.linux.bleServiceManager import BLEServiceManager class BLEManager(object): """ BLE network manager """ def __init__(self, address, adapter, addressType, securityLevel...
2.875
3
sysinv/cgts-client/cgts-client/cgtsclient/v1/load.py
SidneyAn/config
0
17239
<reponame>SidneyAn/config # Copyright (c) 2015-2020 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # from cgtsclient.common import base from cgtsclient import exc CREATION_ATTRIBUTES = ['software_version', 'compatible_version', 'required_patches'] IMPORT_ATTRIBUTES = ['path...
1.851563
2
tests/keras_tests/feature_networks_tests/feature_networks/weights_mixed_precision_tests.py
haihabi/model_optimization
0
17240
<reponame>haihabi/model_optimization<gh_stars>0 # Copyright 2021 Sony Semiconductors Israel, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
1.328125
1
src/ansible_navigator/actions/run.py
NaincyKumariKnoldus/ansible-navigator
0
17241
""":run """ import curses import datetime import json import logging import os import re import shlex import shutil import time import uuid from math import floor from queue import Queue from typing import Any from typing import Callable from typing import Dict from typing import List from typing import Optional from ...
2.234375
2
storagetest/pkgs/pts/__init__.py
liufeng-elva/storage-test2
0
17242
#!/usr/bin/python # -*- coding: UTF-8 -*- """ @file : __init__.py.py @Time : 2020/11/12 13:37 @Author: Tao.Xu @Email : <EMAIL> """ """ phoronix-test-suite: Main for Performance Test =================== https://github.com/phoronix-test-suite/phoronix-test-suite The Phoronix Test Suite is the most comprehensive testin...
0.855469
1
owlbot.py
rahul2393/python-spanner
0
17243
<gh_stars>0 # Copyright 2018 Google LLC # # 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 i...
1.765625
2
k_means.py
sokrutu/imagemean
0
17244
<reponame>sokrutu/imagemean from random import randint def k_means(data, K): """ k-Means clustering TODO: Assumes values from 0-255 :param data: NxD array of numbers :param K: The number of clusters :return: Tuple of cluster means (KxD array) and cluster assignments (Nx1 with values from 1 to...
3.203125
3
contrib/analysis_server/src/analysis_server/__init__.py
Kenneth-T-Moore/OpenMDAO-Framework
3
17245
<reponame>Kenneth-T-Moore/OpenMDAO-Framework """ Support for interacting with ModelCenter via the AnalysisServer protocol. Client-mode access to an AnalysisServer is provided by the 'client', 'factory', and 'proxy' modules. Server-mode access by ModelCenter is provided by the 'server' and 'wrapper' modules. An extens...
1.609375
2
3rd party/YOLO_network.py
isaiasfsilva/ROLO
962
17246
import os import numpy as np import tensorflow as tf import cv2 import time import sys import pickle import ROLO_utils as util class YOLO_TF: fromfile = None tofile_img = 'test/output.jpg' tofile_txt = 'test/output.txt' imshow = True filewrite_img = False filewrite_txt = False disp_console = True weights_file ...
2.328125
2
pipenv/cmdparse.py
sthagen/pipenv
23
17247
<reponame>sthagen/pipenv<filename>pipenv/cmdparse.py import itertools import re import shlex class ScriptEmptyError(ValueError): pass def _quote_if_contains(value, pattern): if next(iter(re.finditer(pattern, value)), None): return '"{0}"'.format(re.sub(r'(\\*)"', r'\1\1\\"', value)) return value...
2.796875
3
msph/clients/ms_online.py
CultCornholio/solenya
11
17248
<filename>msph/clients/ms_online.py<gh_stars>10-100 from .framework import Client, Resource from . import constants as const client = Client( base_url='https://login.microsoftonline.com', base_headers={ 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0', 'Con...
2.109375
2
warn/platforms/job_center/cache.py
anikasikka/warn-scraper
12
17249
<reponame>anikasikka/warn-scraper import logging import re from warn.cache import Cache as BaseCache from .urls import urls logger = logging.getLogger(__name__) class Cache(BaseCache): """A custom cache for Job Center sites.""" def save(self, url, params, html): """Save file to the cache.""" ...
2.8125
3
ebcli/core/abstractcontroller.py
senstb/aws-elastic-beanstalk-cli
110
17250
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
1.78125
2
python/speaktest.py
kyle-cook/templates
0
17251
import unittest import speak class SpeakTests(unittest.TestCase): """ Unit test for the speak library """ def testHello(self): self.assertEqual("Hello World!", speak.helloworld()) def testGoodbye(self): self.assertEqual("Goodbye World!", speak.goodbyeworld()) if __name__ == "__mai...
3.046875
3
c2f_loop.py
devopsprosiva/python
0
17252
<filename>c2f_loop.py<gh_stars>0 #!/usr/local/bin/python import sys temperatures=[10,-20,-289,100] def c2f(cel_temp): if cel_temp < -273.15: return "The lowest possible temperature that physical matter can reach is -273.15C" else: fah_temp=(cel_temp*1.8)+32 return fah_temp for temp i...
3.34375
3
problems/eggs/services/confirm_min_throws_server.py
giuliagalvan/TAlight
0
17253
#!/usr/bin/env python3 # METADATA OF THIS TAL_SERVICE: problem="eggs" service="confirm_min_throws" args_list = [ ('min',int), ('n_eggs',int), ('n_floors',int), ('lang',str), ('ISATTY',bool), ] from sys import stderr, exit, argv from random import randrange from math import inf as IMPOSSIBLE from ...
2.859375
3
pylox/error_reporting.py
hculpan/pylox
1
17254
errorFound = False def hasError(): global errorFound return errorFound def clearError(): global errorFound errorFound = False def error(message, lineNo = 0): report(lineNo, "", message) def report(lineNo, where, message): global errorFound errorFound = True if lineNo == 0: ...
3.09375
3
tests/syntax/scripts/annotated_comments.py
toddrme2178/pyccel
0
17255
<reponame>toddrme2178/pyccel #$ header variable x :: int #$ acc parallel private(idx) #$ omp parallel private(idx)
0.910156
1
server/admin.py
allisto/allistic-server
5
17256
from django.contrib import admin from .models import Doctor, ConsultationTime, Medicine, Allergy, Child, Parent admin.site.site_header = "Allisto - We Do Good" @admin.register(Doctor) class DoctorAdmin(admin.ModelAdmin): list_display = ('name', 'aadhar_number', 'specialization', 'email', 'phone_number') lis...
1.765625
2
backend/ir/ir.py
zengljnwpu/yaspc
0
17257
from backend.entity.entity import DefinedFuntion from backend.ir.dumper import Dumper from backend.ir.stmt import Assign from backend.ir.stmt import Return from backend.ir.expr import Bin from backend.ir.expr import Call from backend.entity.scope import * def import_ir(data, asm_file): def_vars = list() def_...
2.09375
2
forest/benchmarking/tests/test_superoperator_transformations.py
stjordanis/forest-benchmarking
40
17258
import numpy as np from pyquil.gate_matrices import X, Y, Z, H from forest.benchmarking.operator_tools.superoperator_transformations import * # Test philosophy: # Using the by hand calculations found in the docs we check conversion # between one qubit channels with one Kraus operator (Hadamard) and two # Kraus operat...
2.15625
2
0702 In-Place Move Zeros to End of List.py
ansabgillani/binarysearchcomproblems
1
17259
<gh_stars>1-10 class Solution: def solve(self, nums): return [num for num in nums if num != 0] + [0]*nums.count(0)
2.90625
3
OIL/__init__.py
vjdad4m/OIL
1
17260
import OIL.color import OIL.label import OIL.parser import OIL.tools import OIL.errors
1
1
lib/spack/spack/cmd/load.py
padamson/spack
2
17261
<reponame>padamson/spack<gh_stars>1-10 # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import sys import spack.cmd import spack.cmd.common.arguments as arguments import ...
2.3125
2
poisson_image_editing.py
zishun/Poisson-EVA2019
0
17262
import numpy as np import imageio from PoissonTemperature import FiniteDifferenceMatrixConstruction def ind_sub_conversion(img, ind2sub_fn, sub2ind_fn): rows, cols = img.shape[:2] num = rows*cols arange = np.arange(rows*cols, dtype=np.int32) ind2sub = np.empty((num, 2), dtype=np.int32) ind2sub[:, ...
2.21875
2
mindsdb/api/http/initialize.py
mindsdb/main
261
17263
from distutils.version import LooseVersion import requests import os import shutil import threading import webbrowser from zipfile import ZipFile from pathlib import Path import traceback import tempfile # import concurrent.futures from flask import Flask, url_for, make_response from flask.json import dumps from flask_...
1.820313
2
pyrocov/io.py
corneliusroemer/pyro-cov
22
17264
# Copyright Contributors to the Pyro-Cov project. # SPDX-License-Identifier: Apache-2.0 import functools import io import logging import math import re import sys import torch import torch.multiprocessing as mp from Bio import AlignIO from Bio.Phylo.NewickIO import Parser from Bio.Seq import Seq from Bio.SeqRecord im...
2.15625
2
core.py
mistifiedwarrior/house_price_prediction
0
17265
import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression def convert_to_sqft(str): tokens = str.split(' - ') if len(tokens) == 2: return (float(tokens[0]) + float(tokens[1])) / 2 try: return float(tokens[0]) except Exception: return np.NAN def co...
3.078125
3
Python/bank-robbers.py
JaredLGillespie/CodinGame
1
17266
# https://www.codingame.com/training/easy/bank-robbers from heapq import * def calc_vault_time(c, n): return 10**n * 5**(c - n) def solution(): robbers = int(input()) vault = int(input()) vault_times = [] for i in range(vault): c, n = map(int, input().split()) vault_times.appen...
3.453125
3
14Django/day04/BookManager/introduction1.py
HaoZhang95/PythonAndMachineLearning
937
17267
<gh_stars>100-1000 """ 模板语言: {{ 变量 }} {% 代码段 %} {% 一个参数时:变量|过滤器, Book.id | add: 1 <= 2 当前id+1来和2比较 两个参数时:变量|过滤器:参数 %}, 过滤器最多只能传2个参数,过滤器用来对传入的变量进行修改 {% if book.name|length > 4 %} 管道|符号的左右不能有多余的空格,否则报错,其次并不是name.length而是通过管道来过滤 {{ book.pub_date|date:'Y年m月j日' }} 日期的转换管道 """ """ ...
2.546875
3
gammapy/maps/__init__.py
watsonjj/gammapy
0
17268
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Sky maps.""" from .base import * from .geom import * from .hpx import * from .hpxnd import * from .hpxsparse import * from .hpxmap import * from .wcs import * from .wcsnd import * from .wcsmap import * from .sparse import *
0.867188
1
lhotse/dataset/sampling/utils.py
stachu86/lhotse
353
17269
import warnings from typing import Dict, Tuple from lhotse import CutSet from lhotse.dataset.sampling.base import CutSampler def find_pessimistic_batches( sampler: CutSampler, batch_tuple_index: int = 0 ) -> Tuple[Dict[str, CutSet], Dict[str, float]]: """ Function for finding 'pessimistic' batches, i.e. ...
2.765625
3
book/migrations/0010_auto_20170603_1441.py
pyprism/Hiren-Mail-Notify
0
17270
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-06-03 08:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('book', '0009_book_folder'), ] operations = [ migrations.AddField( ...
1.796875
2
contrib/ComparisonStatistics/Test/test_1.py
xylar/cdat
62
17271
<reponame>xylar/cdat #!/usr/bin/env python import ComparisonStatistics import cdutil import os,sys # Reference ref = os.path.join(cdutil.__path__[0],'..','..','..','..','sample_data','tas_dnm-95a.xml') Ref=cdutil.VariableConditioner(ref) Ref.var='tas' Ref.id='reference' # Test tst = os.path.join(cdutil.__path__[0],'...
1.90625
2
mathipy/functions/linearithmic.py
BatiDyDx/maths-tools-python
1
17272
<reponame>BatiDyDx/maths-tools-python<filename>mathipy/functions/linearithmic.py<gh_stars>1-10 import math import numpy as np from mathipy.math import calculus class Linearithmic(calculus.Function): """ f(x) = (mx + h)log_b(kx + a) """ function_type = 'Linearithmic' def __init__(self, m = 1, h = 0...
3.046875
3
pivot_based_eccv2018/misc/expander/disambiguate.py
gujiuxiang/unpaired_im2text_iccv19
18
17273
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This module contains the necessary functions to load a text-corpus from NLTK, contract all possible sentences, applying POS-tags to the contracted sentences and compare that with the original text. The information about which contraction+pos-tag pair gets expanded to ...
3.4375
3
setup.py
baye0630/paperai
0
17274
# pylint: disable = C0111 from setuptools import find_packages, setup setup(name="paperai", # version="1.5.0", # author="NeuML", # description="AI-powered literature discovery and review engine for medical/scientific papers", # long_description=DESCRIPTION, # long_description_content_typ...
1.445313
1
hit_analysis/image/cut_reconstruction.py
credo-science/credo-classify
0
17275
from io import BytesIO from typing import List, Dict from PIL import Image from hit_analysis.commons.config import Config from hit_analysis.commons.consts import IMAGE, CROP_X, CROP_Y, CROP_SIZE, FRAME_DECODED, CLASSIFIED, CLASS_ARTIFACT, ORIG_IMAGE def append_to_frame(image: Image, detection: dict): hit_img = ...
2.21875
2
tests/st/fallback/control_flow/test_fallback_010_if_in_if.py
httpsgithu/mindspore
1
17276
<filename>tests/st/fallback/control_flow/test_fallback_010_if_in_if.py # Copyright 2022 Huawei Technologies Co., Ltd # # 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/...
2.484375
2
EPOpt/SpectrumAnalysis.py
ruixueqingyang/GPOEO
5
17277
<filename>EPOpt/SpectrumAnalysis.py # -*- coding: utf-8 -*- from scipy.fftpack import fft, fftshift, ifft from scipy.fftpack import fftfreq from scipy.signal import find_peaks from scipy import signal import numpy as np import matplotlib.pyplot as plt import pickle import warnings import sys from scipy.signal.filter_d...
2.171875
2
slippy/core/tests/test_materials.py
KDriesen/slippy
12
17278
import numpy as np import numpy.testing as npt import slippy import slippy.core as core """ If you add a material you need to add the properties that it will be tested with to the material_parameters dict, the key should be the name of the class (what ever it is declared as after the class key word). The value should ...
2.796875
3
python/dash_tools/restore_from_bup.py
Dash-Industry-Forum/media-tools
60
17279
#!/usr/bin/env python """Restore files with ending BACKUP_ENDING to original files.""" # The copyright in this software is being made available under the BSD License, # included below. This software may be subject to other third party and contributor # rights, including patent rights, and no such rights are granted un...
2.078125
2
src/opendr/simulation/human_model_generation/utilities/joint_extractor.py
makistsantekidis/opendr
3
17280
# Copyright 2020-2021 OpenDR European Project # # 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 agree...
1.734375
2
bluebottle/donations/migrations/0009_auto_20190130_1140.py
jayvdb/bluebottle
0
17281
<reponame>jayvdb/bluebottle<filename>bluebottle/donations/migrations/0009_auto_20190130_1140.py # -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2019-01-30 10:40 from __future__ import unicode_literals import bluebottle.utils.fields from decimal import Decimal from django.db import migrations, models import dja...
1.59375
2
pickle_storage/tests/__init__.py
PyUnchained/pickle_storage
0
17282
<gh_stars>0 # import os # os.environ.setdefault('PICKLE_STORAGE_SETTINGS', 'pickle_storage.tests.settings')
1.164063
1
src/config.py
NicolasSommer/valuenet
0
17283
<reponame>NicolasSommer/valuenet<gh_stars>0 import argparse import json import os class Config: DATA_PREFIX = "data" EXPERIMENT_PREFIX = "experiments" def write_config_to_file(args, output_path): config_path = os.path.join(output_path, "args.json") with open(config_path, 'w', encoding='utf-8') as f...
2.390625
2
aqg/utils/summarizer.py
Sicaida/Automatic_Question_Generation
134
17284
<gh_stars>100-1000 from __future__ import absolute_import from __future__ import division, print_function, unicode_literals from sumy.parsers.html import HtmlParser from sumy.parsers.plaintext import PlaintextParser from sumy.nlp.tokenizers import Tokenizer #from sumy.summarizers.lsa import LsaSummarizer as Summarizer...
2.859375
3
tests/__init__.py
AdamRuddGH/super_json_normalize
2
17285
<reponame>AdamRuddGH/super_json_normalize """Unit test package for super_json_normalize."""
1.148438
1
examples/turbulent_condensate/run.py
chrisjbillington/parpde
0
17286
<reponame>chrisjbillington/parpde # An example of a turbulent BEC in a harmonic trap. The groundstate is found # and then some vortices randomly printed about with a phase printing. Some # evolution in imaginary time is then performed to smooth things out before # evolving the BEC in time. # Run with 'mpirun -n <N CPU...
2.546875
3
src/Test_Sfepy_NavierStokes.py
somu15/Small_Pf_code
0
17287
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 28 09:33:53 2020 @author: dhulls """ from __future__ import print_function from __future__ import absolute_import from argparse import ArgumentParser import numpy as nm import sys sys.path.append('.') from sfepy.base.base import IndexedStruct, St...
1.90625
2
nd_customization/api/lab_test.py
libermatic/nd_customization
0
17288
<filename>nd_customization/api/lab_test.py # -*- coding: utf-8 -*- from __future__ import unicode_literals import frappe import json from frappe.utils import now, cint from functools import partial from toolz import compose @frappe.whitelist() def deliver_result(lab_test, revert=0, delivery_time=None): doc = frap...
1.9375
2
build-flask-app.py
Abdur-rahmaanJ/build-flask-app
1
17289
#!/usr/bin/env python3 from scripts.workflow import get_app_name, is_name_valid from scripts.workflow import get_args, is_args_valid from scripts.workflow import create_dir, create_app, create_templates_folder, create_static_folder, create_dockerfile from scripts.manual import print_manual from scripts.messages import...
2.40625
2
stacker/assembler.py
unrahul/stacker
0
17290
import os from pathlib import Path from jinja2 import Template import parser from utils import write_to_file from utils import mkdir_p parser.init() # parse and assign to vars spec = parser.spec def _concat(slice: str) -> str: """helper to concatenate each template slice.""" return "{}\n".format(slice) ...
2.90625
3
akshare/fx/cons.py
PKUuu/akshare
1
17291
<filename>akshare/fx/cons.py # -*- coding:utf-8 -*- # /usr/bin/env python """ Author: <NAME> date: 2019/10/20 10:58 contact: <EMAIL> desc: 外汇配置文件 """ # headers SHORT_HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36' } # url...
1.71875
2
entropylab/tests/test_issue_204.py
qguyk/entropy
0
17292
import os from datetime import datetime import pytest from entropylab import ExperimentResources, SqlAlchemyDB, PyNode, Graph @pytest.mark.skipif( datetime.utcnow() > datetime(2022, 6, 25), reason="Please remove after two months have passed since the fix was merged", ) def test_issue_204(initialized_project...
2.4375
2
src/__init__.py
PY-GZKY/fconversion
1
17293
<reponame>PY-GZKY/fconversion from .file_core import FileEngine from src.utils.utils import * from .version import __version__
0.902344
1
app/app/calc.py
benning55/recipe-app-api
0
17294
# # def add(x, y): # """ # Add Number Together # """ # return x+y # # # def subtract(x, y): # """ # Subtract x from y # """ # return x-y
3.90625
4
open_anafi/lib/indicator_tools.py
Cour-des-comptes/open-anafi-backend
7
17295
<gh_stars>1-10 from open_anafi.models import Indicator, IndicatorParameter, IndicatorLibelle from open_anafi.serializers import IndicatorSerializer from .frame_tools import FrameTools from open_anafi.lib import parsing_tools from open_anafi.lib.ply.parsing_classes import Indic import re from django.db import transactio...
2.09375
2
src/python/commands/LikeImpl.py
plewis/phycas
3
17296
<filename>src/python/commands/LikeImpl.py import os,sys,math,random from phycas import * from MCMCManager import LikelihoodCore from phycas.utilities.PhycasCommand import * from phycas.readnexus import NexusReader from phycas.utilities.CommonFunctions import CommonFunctions class LikeImpl(CommonFunctions): #---+--...
2.28125
2
app/models.py
dangger/awesome-flask-todo
0
17297
<reponame>dangger/awesome-flask-todo<gh_stars>0 from app import db import datetime from flask_mongoengine.wtf import model_form class Todo(db.Document): content = db.StringField(required=True, max_length=20) time = db.DateTimeField(default=datetime.datetime.now()) status = db.IntField(default=0) TodoForm ...
2.203125
2
Python/Mundo01/teste/teste2.py
eStev4m/CursoPython
0
17298
dia = int(input('Dia = ')) mes = str(input('Mês = ')) ano = int(input('Ano = ')) print('Você nasceu no dia {} de {} de {}. Correto?' .format(dia, mes, ano))
3.84375
4
firebirdsql/services.py
dand-oss/pyfirebirdsql
31
17299
<filename>firebirdsql/services.py<gh_stars>10-100 ############################################################################## # Copyright (c) 2009-2021, <NAME><<EMAIL>> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the follow...
1.234375
1