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
scripts/make_fasta.py
orionzhou/snk-rnaseq
0
18100
from snakemake import shell input, output, params, threads, w, config = snakemake.input, snakemake.output, snakemake.params, snakemake.threads, snakemake.wildcards, snakemake.config genome = w.genome params.hybrid = config['x'][genome]['hybrid'] opt = params.opt shell(""" rm -rf {output.fna}* {output.fai}* rm...
1.921875
2
HanderCode/aidaiwangApp/aidaiwangApp/Login_aidaiwangApp.py
mocne/PycharmProjects
0
18101
<gh_stars>0 # -*- coding: utf-8 -*- import time import xlrd import Register_aidaiwangApp import LogOut_aidiawangApp def start_to_login(filename): print(u'login') driver = Register_aidaiwangApp.driver driver.launch_app() time.sleep(3) try: driver.find_element_by_id('cn.phaidai.loan:id/rb_m...
2.515625
3
Python/Learning/Language/arg_ex.py
prynix/learning-programming
2
18102
from sys import argv script, user_name = argv prompt = '>' print(user_name, script) print("Do you like me " + user_name + "?") likes = input(prompt) print("Where do you live " + user_name + "?") lives = input(prompt) print(""" So you said {:s} about liking me. You live in {:s}. """.format(likes, lives)) print("Scr...
3.875
4
tests/functional/test_uploads.py
jounile/nollanet
3
18103
import io import pytest from requests import get from urllib.parse import urljoin def test_my_uploads_page(wait_for_api, login_user): """ GIVEN a user has logged in (login_user) WHEN the '/my/uploads' page is navigated to (GET) THEN check the response is valid and page title is correct """ requ...
2.78125
3
plugins/python/test/testCustomEntity.py
shotgunsoftware/cplusplus-api
3
18104
<gh_stars>1-10 #!/usr/bin/env python import sys from shotgun import * try: if len(sys.argv) > 1: sg = Shotgun(sys.argv[1]) else: sg = Shotgun() ################################################################# # Find CustomEntity01 entities ########################################...
2.328125
2
word2vec_np/utils/data.py
mkserge/word2vec-np
1
18105
<gh_stars>1-10 import word2vec_np.utils.checks as checks import collections import numpy as np import math import time import logging def get_sentences_from_file(train_file): """ Returns a list of sentences from an input file. Args: train_file: A path to a file Returns: A l...
3.328125
3
nicegui/elements/row.py
florianwittkamp/nicegui
30
18106
import justpy as jp from .group import Group class Row(Group): def __init__(self): '''Row Element Provides a container which arranges its child in a row. ''' view = jp.QDiv(classes='row items-start', style='gap: 1em', delete_flag=False) super().__init__(view)
2.8125
3
src/mtvs/__init__.py
digsim/mtvs
2
18107
<reponame>digsim/mtvs<gh_stars>1-10 # -*- coding: utf-8 -*- import pkg_resources __version__ = pkg_resources.require("mtvs")[0].version
1.109375
1
tests/guinea-pigs/unittest/expected_failure.py
Tirzono/teamcity-messages
105
18108
<filename>tests/guinea-pigs/unittest/expected_failure.py # coding=utf-8 import sys from teamcity.unittestpy import TeamcityTestRunner if sys.version_info < (2, 7): from unittest2 import main, TestCase, expectedFailure else: from unittest import main, TestCase, expectedFailure class TestSkip(TestCase): de...
2.703125
3
main.py
GabrielIFPB/wishlist-fastapi
0
18109
import uvicorn from fastapi import FastAPI from database import Base, engine from routers.user import router as router_user from routers.product import router as router_product from routers.authentication import router as router_auth app = FastAPI( title="Wish List", description="Permita que seus clientes acompan...
2.421875
2
libs/data_layers/transform.py
lsc25846/Wildlife-Recognition-System
0
18110
# encoding: utf-8 import torch import cv2 import numpy as np import pdb def detection_collate(batch): """Custom collate fn for dealing with batches of images that have a different number of associated object annotations (bounding boxes). Arguments: batch: (tuple) A tuple of tensor images and lists...
2.59375
3
rllab/torch/algos/base.py
NeurIPSPaperSubmission7934/code_submission
0
18111
# Copyright (c) 2018 Copyright holder of the paper Generative Adversarial Model Learning # submitted to NeurIPS 2019 for review # All rights reserved. import numpy as np import torch class Optimizer(object): def __init__(self, policy, use_gpu=False): self.networks = self._init_networks(policy.input_dim, ...
2.265625
2
lab-4.py
PavelKovalets/python-reviewer-test
0
18112
<reponame>PavelKovalets/python-reviewer-test<gh_stars>0 #!/usr/bin/python3 import boto3 source_ddb = boto3.resource('dynamodb', 'us-east-1') dest_ddb = boto3.client('dynamodb', 'us-west-2') def sync(source_ddb, dest_ddb): table = source_ddb.Table("CodeGuru-MusicCollection") scan_kwargs = { 'ProjectionE...
2.203125
2
core/reports/views.py
jilbertozamorasaa/panda-bigmon-core
3
18113
<gh_stars>1-10 """ """ import json from django.views.decorators.cache import never_cache from django.http import HttpResponse from django.shortcuts import render_to_response from core.views import initRequest, DateEncoder from core.reports import MC16aCPReport, ObsoletedTasksReport, TitanProgressReport @never_cac...
1.960938
2
xain/fl/participant/participant.py
danieljanes/ox-msc-diss-code-freeze
1
18114
<filename>xain/fl/participant/participant.py from typing import Dict, List, Tuple import numpy as np import tensorflow as tf from absl import logging from xain.datasets import prep from xain.types import History, Metrics, Partition, Theta, VolumeByClass from .model_provider import ModelProvider class Participant: ...
2.078125
2
client/animation/qr_code.py
Nurgak/IoT-RGB-LED-Matrix-Socket
1
18115
<reponame>Nurgak/IoT-RGB-LED-Matrix-Socket<filename>client/animation/qr_code.py #!/usr/bin/env python3 """! QR code generator animation script.""" import numpy as np import qrcode from src.animate import Animate class QRCode(Animate): """! QR code generator animation class. @image html qr_code.QRCode.png widt...
2.71875
3
tests/test_xiaochengtu.py
lamzuzuzu/yxf_yixue_py
20
18116
#!/usr/bin/python3 # -*- coding: utf-8 -*- import os import sys BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # 基地址是本项目根目录 sys.path.append(BASE_DIR) import datetime from yxf_yixue.xiaochengtu import XiaochengtuApi if __name__ == '__main__': string = '1996/02/29 23:16' obj = datetime....
2.625
3
_Dist/NeuralNetworks/b_TraditionalML/MultinomialNB.py
leoatchina/MachineLearning
1,107
18117
<filename>_Dist/NeuralNetworks/b_TraditionalML/MultinomialNB.py<gh_stars>1000+ import numpy as np from sklearn.preprocessing import OneHotEncoder class MultinomialNB: """ Naive Bayes algorithm with discrete inputs Parameters ---------- alpha : float, optional (default=1.) Smooth parameter use...
3.375
3
Reinforcement-Learning/Python-Model/venv/lib/python3.8/site-packages/tensorflow/core/protobuf/graph_debug_info_pb2.py
lawrence910426/ProgrammingII_FinalProject
0
18118
<filename>Reinforcement-Learning/Python-Model/venv/lib/python3.8/site-packages/tensorflow/core/protobuf/graph_debug_info_pb2.py # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: tensorflow/core/protobuf/graph_debug_info.proto import sys _b=sys.version_info[0]<3 and (lambda x:...
1.617188
2
tests/inferfaces_tests/test_people.py
jmolinski/traktpy
0
18119
<reponame>jmolinski/traktpy import pytest from tests.test_data.lists import LIST from tests.test_data.people import MOVIE_CREDITS, PERSON, SHOW_CREDITS from tests.utils import mk_mock_client from trakt.core.exceptions import ArgumentError from trakt.core.json_parser import parse_tree from trakt.core.models import Perso...
2.375
2
batch_score.py
Lufedi/reaper
106
18120
<reponame>Lufedi/reaper #!/usr/bin/env python3 import argparse import os import sys import traceback from lib import core, utilities, run from lib.attributes import Attributes from lib.database import Database def process_arguments(): """ Uses the argparse module to parse commandline arguments. Returns...
2.765625
3
behave/reporter/summary.py
fluendo/behave
0
18121
# -*- coding: UTF-8 -*- """ Provides a summary after each test run. """ from __future__ import absolute_import, division, print_function import sys from time import time as time_now from behave.model import Rule, ScenarioOutline # MAYBE: Scenario from behave.model_core import Status from behave.reporter.base import R...
2.125
2
tests/common/bridgecrew/vulnerability_scanning/conftest.py
vangundy-jason-pfg/checkov
1
18122
from typing import Dict, Any import pytest from checkov.common.bridgecrew.bc_source import SourceType from checkov.common.bridgecrew.platform_integration import BcPlatformIntegration, bc_integration @pytest.fixture() def mock_bc_integration() -> BcPlatformIntegration: bc_integration.bc_api_key = "<KEY>" bc_...
1.984375
2
image_matting/modules/trimap_generator/trimap_generator_application.py
image-matting/backend
1
18123
import argparse from pathlib import Path from cv2 import cv2 from trimap import generate_trimap from trimap_output_utils import save_trimap_output def main(): args = parse_args() image_path = args.image output_directory_path = args.output image_path = Path(image_path) if not image_path.is_file(...
3.28125
3
tests/test_views.py
Siecje/graphene-django-sentry
20
18124
#!/usr/bin/env python # -*- coding: utf-8 -*- from http.client import OK from unittest.mock import MagicMock, patch from urllib.parse import urlencode import graphene_django.views as views from django.urls import reverse from graphql import GraphQLError from graphql.error import GraphQLLocatedError class CustomExce...
2.25
2
spacy/lang/nl/stop_words.py
cedar101/spaCy
12
18125
# coding: utf8 from __future__ import unicode_literals # The original stop words list (added in f46ffe3) was taken from # http://www.damienvanholten.com/downloads/dutch-stop-words.txt # and consisted of about 100 tokens. # In order to achieve parity with some of the better-supported # languages, e.g., English, French,...
2.359375
2
liv_covid19/web/artic/opentrons_thread.py
neilswainston/liv-covid19
2
18126
''' (c) University of Liverpool 2020 Licensed under the MIT License. To view a copy of this license, visit <http://opensource.org/licenses/MIT/>.. @author: neilswainston ''' # pylint: disable=broad-except import os.path import tempfile from liv_covid19.web.artic import opentrons from liv_covid19.web.job import JobT...
1.859375
2
futuquant/common/ft_logger.py
hxhxhx88/futuquant
0
18127
<reponame>hxhxhx88/futuquant import logging from datetime import datetime import os logger = logging.getLogger('FT') log_level = logging.INFO is_file_log = True # 设置logger的level为DEBUG logger.setLevel(log_level) # 创建一个输出日志到控制台的StreamHandler hdr = logging.StreamHandler() formatter = logging.Formatter( '%(asctime)s...
2.375
2
image_classification/cifar10/cifar10/networking/cifar10_vgg16_model.py
poncos/deeplearning
0
18128
# Copyright 2018 <NAME>. # # Licensed under the MIT License import tensorflow as tf DEFAULT_VARIABLE_NAMES = ['conv1', 'conv2', 'conv3', 'conv4', 'fc1', 'fc2', 'softmax_linear'] BATCH_SIZE = 200 IMAGE_WIDTH = 32 IMAGE_HEIGHT = 32 IMAGE_DEPTH = 3 NUM_CLASSES = 10 INPUT_PLACEHOLDER = 'X_INPUT' LABELS_PLACEHOLDER = 'Y...
2.5
2
wrappers/Python/sbmlsolver/__init__.py
gitter-badger/sbmlsolver
0
18129
<reponame>gitter-badger/sbmlsolver<gh_stars>0 """ The LibRoadRunner SBML Simulation Engine, (c) 2009-2014 <NAME> and <NAME> LibRoadRunner is an SBML JIT compiler and simulation engine with a variety of analysis functions. LibRoadRunner is a self contained library which is designed to be integrated into existing simula...
1.195313
1
classification/tests/test_evidence_mixin.py
SACGF/variantgrid
5
18130
from classification.models import EvidenceMixin from classification.models.evidence_mixin import VCStore class BasicEvidence(EvidenceMixin): def __init__(self, evidence: VCStore): self.evidence = evidence @property def _evidence(self) -> VCStore: return self.evidence # doesn't work with...
2.328125
2
scronsole/widgets/main_screen.py
bastianh/screeps_console_mod
2
18131
import urwid from scronsole.config_manager import ConfigManager from scronsole.plugin_manager import PluginManager from scronsole.widgets.main_menu import MainMenu from scronsole.widgets.server_screen import ServerScreen class MainScreen(urwid.WidgetPlaceholder): def __init__(self): super().__init__(urwi...
2
2
sql/language.py
skylarkgit/sql2java
2
18132
import re from csv import reader def splitEscaped(str, by, escapeChar): infile = [str] return reader(infile, delimiter=by, quotechar=escapeChar) def removeComments(text): p = r'/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|\'(\\.|[^\'\\])*\'|.[^/"\'\\]*)' return ''.join(m.group(2) for m in re.finditer...
3.34375
3
easy_ArrayAdditionI.py
GabrielGhe/CoderbyteChallenges
1
18133
<reponame>GabrielGhe/CoderbyteChallenges import itertools ################################################# # This function will see if there is any # # possible combination of the numbers in # # the array that will give the largest number # ################################################# def ArrayAd...
3.90625
4
SVM.py
JAMJU/KernelMethod
0
18134
<reponame>JAMJU/KernelMethod<filename>SVM.py import numpy as np import quadprog def quadprog_solve_qp(P, q, G=None, h=None, A=None, b=None): """ Solve a QP of the form min 1/2xTPx + qTx st Gx < h st Ax=b""" #qp_G = .5 * (P + P.T) # make sure P is symmetric qp_G = P qp_a = -q if A is not None: ...
2.6875
3
util/MalShare.py
cclauss/ph0neutria
0
18135
#!/usr/bin/python from ConfigUtils import getBaseConfig from LogUtils import getModuleLogger from StringUtils import isValidUrl, randomString from urlparse import urlparse import json import os import requests import sys cDir = os.path.dirname(os.path.realpath(__file__)) rootDir = os.path.abspath(os.path.join(cDir,...
2.515625
3
attempt/runner.py
prstolpe/rrc_simulation
0
18136
from attempt.ddpg import HERDDPG, DDPG import gym import os import matplotlib.pyplot as plt import numpy as np from tqdm import tqdm if __name__ == "__main__": os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' env = gym.make('FetchReach-v1') agent = HERDDPG(env) for epoch in range(2): for cycle in tq...
2.3125
2
src/shogun/base/class_list.cpp.py
srgnuclear/shogun
1
18137
#!/usr/bin/env python # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # Written (W) 2008-2009 <NAME> # Copyright (C) ...
2.21875
2
script/solr_unauthorized_access.py
5up3rc/Vxscan
2
18138
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- # project = https://github.com/Xyntax/POC-T # author = <EMAIL> """ Apache Solr 未授权访问PoC (iterate_path函数使用场景示例) Usage python POC-T.py -s solr-unauth -iF target.txt python POC-T.py -s solr-unauth -aZ "solr country:cn" """ from lib.verify import verify ...
2.28125
2
conanfile.py
midurk/conan-rapidxml
0
18139
<reponame>midurk/conan-rapidxml #!/usr/bin/env python # -*- coding: utf-8 -*- from conans import ConanFile, tools import os class RapiXMLConan(ConanFile): name = "rapidxml" version = "1.13" description = "RapidXml is an attempt to create the fastest XML parser possible" url = "https://github.com/binc...
2.03125
2
src_2d/help/compute_dice.py
xzluo97/MvMM-RegNet
19
18140
<gh_stars>10-100 """ Compute Dice between test ground truth and predictions from groupwise registration. """ import os import nibabel as nib import glob import numpy as np from core import utils_2d from core.metrics_2d import OverlapMetrics def one_hot_label(label, label_intensity): gt = np.around...
2.265625
2
farmos_ext/farm.py
applecreekacres/farmos.py.ext
0
18141
"""Main farm access.""" from __future__ import annotations import os from datetime import datetime from typing import Dict, Iterable, Iterator, List, Type, Union from farmos_ext.area import Area from farmos_ext.asset import Asset, Equipment, Planting from farmos_ext.log import (Activity, Birth, Harvest, Input, Log, ...
2.484375
2
tests/io/v3/base/test_csv_iterator.py
alpesh-te/pyTenable
0
18142
<reponame>alpesh-te/pyTenable ''' Testing the CSV iterators ''' import responses from tenable.io.v3.base.iterators.explore_iterator import CSVChunkIterator USERS_BASE_URL = r'https://cloud.tenable.com/api/v3/assets/search' CSV_TEXT = ( 'created,display_ipv4_address,first_observed,id,' 'ipv4_addresses,ipv6_a...
2.21875
2
import_new_tournaments/process_hh_files/process/hands/extract/position_info/extract_stack_from_seat_line.py
michaelcukier/Poker-Hand-Tracker
5
18143
<filename>import_new_tournaments/process_hh_files/process/hands/extract/position_info/extract_stack_from_seat_line.py def extract_stack_from_seat_line(seat_line: str) -> float or None: # Seat 3: PokerPete24 (40518.00) if 'will be allowed to play after the button' in seat_line: return None return fl...
2.703125
3
startt.py
OnyyMexicanCat/RinkoglionitoBot
0
18144
from telegram.ext import * from telegram import * import time def start(update, context): context.bot.send_message(chat_id=update.effective_chat.id, text="Hi 👋 I'm Rinkoglionito and I'm here because @OnyyTheBest had nothing to do ;-;. \n that said do the /cmds command to see the available commands") cha...
2.421875
2
server/config.py
nikitinivan/Crypton
0
18145
<reponame>nikitinivan/Crypton import os class Configuration: APPLICATION_DIR = os.path.dirname(os.path.realpath(__file__)) DEBUG = True SECRET_KEY = 'thisissecretkeyforcrypton' # change it in production !!! MONGO_DBNAME = 'cryptondb'
1.796875
2
nbviewerbot/__main__.py
JohnPaton/nbviewerbot
7
18146
<gh_stars>1-10 import nbviewerbot if __name__ == "__main__": nbviewerbot.cli()
1.046875
1
fetch_data.py
ASabryMazroua/Arabic-Dialect-Classification
1
18147
import json import math import requests import pandas as pd def fetch_data(ids): ''' A function to fetch data from the API. Parameters: ids (list): A list of ids (integrs) to fetch Returns: text (dict): A dictionary where keys are the ids and values are the...
3.609375
4
tests/test.py
daniel-sasu/roadwatch-data-processor
0
18148
<gh_stars>0 # tests/test.py from rw_data_proc.core import * import unittest def _dummyModifierFunction(row): row['adr'] = 'modified' return row['adr'] class TableTest(unittest.TestCase): def test_init(self): tb = Table('tests/test_file.csv') self.assertIsNotNone(tb) def test_add_mo...
2.578125
3
booking_spaces/booking/forms.py
pvlvnk/booking
0
18149
from booking.models import Schedule, ParkingSpace from datetime import datetime as dt from django import forms class ReservingForm(forms.ModelForm): reserving_dates = forms.ModelMultipleChoiceField( queryset=Schedule.objects.filter(reserving_date__gte=dt.today()), widget=forms.CheckboxSelectMult...
2.03125
2
tests/unit/aiplatform/test_matching_engine_index_endpoint.py
kthytang/python-aiplatform
0
18150
# -*- coding: utf-8 -*- # Copyright 2022 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 o...
1.617188
2
vrc_log_viewer.py
27Cobalter/vrc_log_viewer
2
18151
<gh_stars>1-10 import glob import os import re import sys import time import yaml def tail(thefile, past): if not past: thefile.seek(0, 2) while True: line = thefile.readline() if not line: time.sleep(0.5) continue line = line.rstrip("\n").rstrip("\r") ...
2.5
2
src/intermediate_representation/sem2sql/infer_from_clause.py
brunnurs/proton
0
18152
<reponame>brunnurs/proton<gh_stars>0 def infer_from_clause(table_names, graph, columns): tables = list(table_names.keys()) if len(tables) == 1: # no JOINS needed - just return the simple "FROM" clause. return f"FROM {tables[0]} " else: # we have to deal with multiple tables - and find the shortes...
2.65625
3
test.py
AlanFnz/profiles-rest-api
0
18153
<reponame>AlanFnz/profiles-rest-api print('Test script')
1.101563
1
src/markdown_storage/folder.py
stephanpoetschner/markdown_storage
0
18154
<gh_stars>0 import os from .exceptions import MarkdownError, MetadataError from .file import ContentFile class ContentFolder(object): def __init__(self, path): path = os.path.abspath(path) self._path = path self._files = [] self._folders = [] for filename in os.listdir(s...
2.578125
3
test/test_session.py
Sunmxt/UESTC-EAMS
1
18155
#! /usr/bin/python ''' Test for session module ''' import unittest import uestc_eams from .mock_server import LoginMockServer from .utils import HookedMethod, MakeResponse mock_login = LoginMockServer() class TestSession(unittest.TestCase): @mock_login.Patch def test_Session(self): self.__s...
2.703125
3
Asignacion2/App/main.py
HarambeGeek/uip-iq-pc3
0
18156
<filename>Asignacion2/App/main.py from App.numeros import numeros if __name__ == "__main__": x = int(input("Ingrese el número que desea evaluar: \n")) pi = numeros(x) pi.parImpar()
2.953125
3
tensorflow/python/distribute/test_util.py
TL-Rubick/tensorflow
11
18157
# Copyright 2020 The TensorFlow 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 # # Unless required by applica...
1.734375
2
experiment_data_handler.py
grdddj/Diploma-Thesis---Inverse-Heat-Transfer
2
18158
import csv class ExperimentDataCannotBeParsedError(Exception): """ Defining custom exception type that will be thrown when something fails here """ def __init__(self, msg: str = "ERROR"): self.message = msg def __str__(self): """ Defines what to show when exception is pri...
3.890625
4
hybrideb/_bineb.py
beckermr/hybrideb
0
18159
import sys import numpy as np import scipy.integrate import scipy.special from ._dblquad import dblquad HAVE_PYGSL = False try: import pygsl.integrate import pygsl.sf HAVE_PYGSL = True except ImportError: pass class BinEB(object): def __init__( self, tmin, tmax, Nb, windows=None, linear...
2.15625
2
test_fast_ndimage.py
grlee77/skimage_accel_demos
0
18160
<gh_stars>0 import numpy as np from numpy.testing import assert_allclose, run_module_suite from fast_ndimage import ( median_filter, sobel, convolve, correlate, gaussian_filter, gaussian_filter1d, uniform_filter, uniform_filter1d) def test_median_filter(): rtol = atol = 1e-7 shape = (63, 64) rstat...
1.898438
2
RecamanSequence/recaman_sequence.py
urosjevremovic/Recamans-Sequence
0
18161
<filename>RecamanSequence/recaman_sequence.py import sys from itertools import count, islice def sequence(): """Generate Recaman's sequence""" seen = set() a = 0 for n in count(1): yield a seen.add(a) c = a - n if c < 0 or c in seen: c = a + n a = c ...
3.96875
4
2018/aoc/d8/test.py
lukaselmer/adventofcode
1
18162
import unittest from unittest.mock import mock_open, patch from aoc.d8.main import metadata_sum, supervalue DATA = "2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2\n" class TestCase(unittest.TestCase): def test_metadata_sum(self): with patch("builtins.open", mock_open(read_data=DATA)): self.assertEqual(...
2.921875
3
tests/calculators/openbabel/test_obabel_calculators.py
stevenbennett96/stko
0
18163
import stko import pytest try: from openbabel import openbabel except ImportError: openbabel = None def test_open_babel_energy(unoptimized_mol): if openbabel is None: with pytest.raises(stko.WrapperNotInstalledException): calculator = stko.OpenBabelEnergy('uff') else: ca...
2.109375
2
psono/restapi/views/membership_decline.py
dirigeant/psono-server
48
18164
from rest_framework import status from rest_framework.response import Response from rest_framework.generics import GenericAPIView from ..permissions import IsAuthenticated from django.core.cache import cache from django.conf import settings from ..authentication import TokenAuthentication from ..app_settings import (...
1.84375
2
tests/data/samplers/bucket_batch_sampler_test.py
MSLars/allennlp
11,433
18165
<gh_stars>1000+ from allennlp.common import Params from allennlp.data import Instance, Token, Batch from allennlp.data.fields import TextField from allennlp.data.samplers import BucketBatchSampler from allennlp.data.data_loaders import MultiProcessDataLoader from .sampler_test import SamplerTest class TestBucketSamp...
2.03125
2
tests/test_sphere.py
dkirkby/batoid
0
18166
import batoid import numpy as np import math from test_helpers import timer, do_pickle, all_obj_diff @timer def test_properties(): import random random.seed(5) for i in range(100): R = random.gauss(0.7, 0.8) sphere = batoid.Sphere(R) assert sphere.R == R do_pickle(sphere) ...
2.171875
2
site_stats/middlewares.py
ganlvtech/blueking-django-startup-project
1
18167
from django.http.response import HttpResponseForbidden from .models import Counter, VisitLog from .utils import get_client_ip class SiteStatistics(object): visit_log = None def process_request(self, request): if request.path_info.startswith('/admin/'): return counter = Counter.o...
2.171875
2
gpu_bdb/bdb_tools/q24_utils.py
VibhuJawa/gpu-bdb
62
18168
# # Copyright (c) 2019-2022, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
2.0625
2
tests/test_compare.py
mys-lang/mys
59
18169
from .utils import TestCase from .utils import build_and_test_module from .utils import transpile_source class Test(TestCase): def test_compare(self): with self.assertRaises(SystemExit): build_and_test_module('compare') def test_assert_between(self): self.assert_transpile_raises(...
2.515625
3
epidemioptim/environments/cost_functions/costs/__init__.py
goodhamgupta/EpidemiOptim
0
18170
from epidemioptim.environments.cost_functions.costs.death_toll_cost import DeathToll from epidemioptim.environments.cost_functions.costs.gdp_recess_cost import GdpRecess
1.109375
1
BFS/70.py
wilbertgeng/LintCode_exercise
0
18171
<reponame>wilbertgeng/LintCode_exercise """70 · Binary Tree Level Order Traversal II""" """ Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: A tree @return: buttom-up level order a lis...
3.578125
4
yuque_py/clients/client.py
kingJiaYouwen/yuque-py
0
18172
<filename>yuque_py/clients/client.py<gh_stars>0 import typing import requests from urllib.parse import urlencode from .abstract_client import AbstractClient from yuque_py.exceptions.request_error import RequestError class Client(AbstractClient): api_host: str user_token: str def __init__(self, api_host...
2.5625
3
results/views/sports.py
JukkaKarvonen/sal-kiti
1
18173
<gh_stars>1-10 from dry_rest_permissions.generics import DRYPermissions from rest_framework import viewsets from results.models.sports import Sport from results.serializers.sports import SportSerializer class SportViewSet(viewsets.ModelViewSet): """API endpoint for sports. list: Returns a list of all th...
2.1875
2
tests/pvsystemprofiler/test_equation_of_time.py
slacgismo/pv-system-profiler
4
18174
<reponame>slacgismo/pv-system-profiler import unittest import os from pathlib import Path import numpy as np path = Path.cwd().parent.parent os.chdir(path) from pvsystemprofiler.utilities.equation_of_time import eot_da_rosa, eot_duffie class TestEquationOfTime(unittest.TestCase): # importing input for both eot t...
2.234375
2
raiden/tests/unit/transfer/test_node.py
gasparmedina/raiden
0
18175
<reponame>gasparmedina/raiden from raiden.constants import EMPTY_MERKLE_ROOT from raiden.tests.utils.factories import HOP1, HOP2, UNIT_SECRETHASH, make_block_hash from raiden.transfer.events import ContractSendChannelBatchUnlock from raiden.transfer.node import is_transaction_effect_satisfied from raiden.transfer.state...
2.15625
2
tfx/utils/channel_test.py
HassanDayoub/tfx
2
18176
# Copyright 2019 Google LLC. 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 a...
2.09375
2
lyrics.py
samiraafreen/lyrics-generator
0
18177
<filename>lyrics.py import configparser import requests from bs4 import BeautifulSoup def getAccessToken(): config = configparser.ConfigParser() config.read('config.ini') return config['Client_Access_Token']['token'] token = getAccessToken() def searchMusicArtist(name): api_url = "https://api.genius....
3.171875
3
src/slack/slack_json_factories/dialog_json/comment.py
yejingyu/jama-slack-integration
1
18178
<filename>src/slack/slack_json_factories/dialog_json/comment.py def comment_dialog(data=None): """ Function takes in a JSON object, and uses the following format: https://api.slack.com/dialogs Returns created JSON object, then is sent back to Slack. """ text = "" state = "" project_holde...
2.75
3
tests/hahm/test_config_flow.py
Voxxie/custom_homematic
0
18179
"""Test the HaHomematic config flow.""" from typing import Any from unittest.mock import patch from homeassistant import config_entries from homeassistant.components.hahm.config_flow import ( ATTR_BICDOS_RF_ENABLED, ATTR_BICDOS_RF_PORT, ATTR_HMIP_RF_ENABLED, ATTR_HOST, ATTR_HS485D_ENABLED, ATTR...
2.28125
2
komapy/decorators.py
bpptkg/komapy
0
18180
from functools import partial class counter: """ A counter decorator to track how many times a function is called. """ def __init__(self, func): self.func = func self.count = 0 def __call__(self, *args, **kwargs): self.count += 1 return self.func(*args, **kwargs) ...
3.546875
4
Applications/Examples/python/market_price_authentication.py
Refinitiv/websocket-api
36
18181
#|----------------------------------------------------------------------------- #| This source code is provided under the Apache 2.0 license -- #| and is provided AS IS with no warranty or guarantee of fit for purpose. -- #| See the project's LICENSE.md for details. -- ...
2.65625
3
cardDao.py
Blueredemption/Inventory
0
18182
<reponame>Blueredemption/Inventory #!/usr/bin/python3 class CardDao(): def __init__(self): # constructor super().__init__() self.create() self.return() self.update() self.delete() self.populate() def create(self): # there will be create for cards ...
2.96875
3
test_kmethods.py
quinlan-lab/kmertools
1
18183
from unittest import TestCase from eskedit.kmethods import * class Test(TestCase): def test_generate_kmers(self): print('Testing %s' % 'test_generate_kmers') for i in range(1, 8): self.assertEqual(len(generate_kmers(i)), 4 ** i) def test_gen_random_sequence(self): print('...
2.8125
3
distributed_social_network/users/views.py
leevtori/CMPUT404-project
0
18184
from django.urls import reverse_lazy, reverse from django.shortcuts import get_object_or_404, render, HttpResponse, HttpResponseRedirect from requests.auth import HTTPBasicAuth from .models import User, Node from .forms import CustomUserCreationForm, UserCreationForm from django.views.generic import ListView from djan...
2.140625
2
util.py
reckenrode/ParanoiaCharGen
1
18185
#from weakref import WeakValueDictionary import random, operator, weakref def format_service_group(group): """pretty prints the group""" rstr = '%s [%s]' if group.cover != None: # Spy for IntSec return rstr % (group.cover, group.cover.firm) elif group.spyon != None: return rstr % (group.spyon, group.spyon.firm...
2.71875
3
moex/tests/test_service.py
ChanTerelLy/broker-account-analist
0
18186
<filename>moex/tests/test_service.py import asyncio import unittest from moex.service import Cbr, Moex class CbrTest(unittest.TestCase): def setUp(self) -> None: self.cbr = Cbr('01.01.2021') def test_usd(self): self.assertEqual(self.cbr.USD, 73.88) def test_euro(self): self.ass...
2.5
2
streamlit_app.py
guim4dev/education-cv
0
18187
import streamlit as st import pandas as pd import numpy as np import plotly.express as px st.title("Relatório de Aula") df = pd.read_csv('data/emocoes.csv') agg = pd.read_csv('data/agg.csv') Engajado = df[df['emocao'] == 'Engajado'] Engajado_agg = Engajado.groupby(['emocao', 'pessoa']).size().reset_index(name='size')...
3.375
3
other_nominate/register_other_nominate.py
kondounagi/japanese_movies_dataset
1
18188
import argparse import json import os from os import listdir from os.path import isfile, join class RegisterOtherNominate: # Register the prize winners of each award to the formatting style. def __init__(self): parser = argparse.ArgumentParser() parser.add_argument("-d", "--directory", ...
3.109375
3
PC6/table.py
ReneCapella/pythonTinkering
0
18189
class Table: # Constructor # Defauls row and col to 0 if less than 0 def __init__(self, col_count, row_count, headers = [], border_size = 0): self.col_count = col_count if col_count >= 0 else 0 self.row_count = row_count if row_count >= 0 else 0 self.border_size = border_size if ...
3.453125
3
api/db/models/child_datum.py
peuan-testai/opentestdata-api
15
18190
from .. import db from .base import BaseModel class ChildDatum(BaseModel): __tablename__ = 'child_data' # fields parent_id = db.Column(db.Integer, db.ForeignKey('data.id'), nullable=False) datum_id = db.Column(db.Integer, db.ForeignKey('data.id'), nullable=False) name = db.Column(db.String(length...
2.953125
3
mate3/devices.py
kodonnell/mate3
0
18191
import dataclasses as dc from typing import Any, Dict, Iterable, List, Optional from loguru import logger from mate3.field_values import FieldValue, ModelValues from mate3.read import AllModelReads from mate3.sunspec.fields import IntegerField from mate3.sunspec.model_base import Model from mate3.sunspec.models impor...
2.21875
2
catkin_ws/src/ros_python/function_ws/srv_sub_pub/src/srv_server.py
min-chuir-Park/ROS_Tutorials
1
18192
#!/usr/bin/env python import rospy from srv_sub_pub.srv import * NAME = "add_two_ints_server" def add_two_ints(req): print("Returning [%s + %s = %s]" % (req.a, req.b, (req.a + req.b))) return AddTwoIntsResponse(req.a + req.b) def add_two_ints_server(): rospy.init_node(NAME) s = rospy.Service('add_t...
2.6875
3
app/captcha/handlers/verify.py
huioo/tornadoWeb
0
18193
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- import tornado.web class Handler(tornado.web.RequestHandler): def initialize(self): pass
1.734375
2
simplydomain/src/module_recursion.py
SimplySecurity/SimplyDomain-Old
17
18194
import multiprocessing as mp class ModuleRecursion(object): """Class to handle recursion. Simple class to handle tracking and storing prior sub-domains discovred. """ def __init__(self): """class init. """ self.recursion_queue = mp.Queue() def add_subdomain(self, domain): """add subdomain to Q. ...
3.140625
3
python/tests/spatial_operator/test_polygon_range.py
Maxar-Corp/GeoSpark
1
18195
import os from pyspark import StorageLevel from geospark.core.SpatialRDD import PolygonRDD from geospark.core.enums import IndexType, FileDataSplitter from geospark.core.geom.envelope import Envelope from geospark.core.spatialOperator import RangeQuery from tests.test_base import TestBase from tests.tools import test...
2.015625
2
river/compose/renamer.py
online-ml/creme
1,105
18196
<filename>river/compose/renamer.py from typing import Dict from river import base __all__ = ["Renamer", "Prefixer", "Suffixer"] class Renamer(base.Transformer): """Renames features following substitution rules. Parameters ---------- mapping Dictionnary describing substitution rules. Keys in...
3.078125
3
open_publishing/catalog/catalog_types.py
open-publishing/open-publishing-api
0
18197
from open_publishing.core import FieldGroup from open_publishing.core import FieldDescriptor from open_publishing.core.enums import CatalogType, VLBCategory, AcademicCategory from open_publishing.core import SimpleField from open_publishing.extendable_enum_field import ExtendableEnumField from open_publishing.genre im...
1.804688
2
app/request.py
aenshtyn/News-Update
0
18198
import urllib.request,json from .models import Source,Article # Getting Api Key api_key = None #Getting the base urls source_base_url = None article_base_url = None def configure_request(app): global api_key,source_base_url,article_base_url api_key = app.config['SOURCE_API_KEY'] source_base_url = app.conf...
2.78125
3
corai_util/finance/src/param_iv.py
Code-Cornelius/python_libraries
1
18199
<filename>corai_util/finance/src/param_iv.py # normal libraries import math import numpy as np # priv_libraries from corai_util.finance.src.financials import compute_price, compute_integral from corai_util.finance.src.implied_vol import implied_volatility_newton, total_implied_vol_newton phi_heston = lambda xx: (1 - ...
2.15625
2