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
pyxdsm/tests/test_xdsm.py
yqliaohk/pyXDSM
0
7500
import unittest import os from pyxdsm.XDSM import XDSM, __file__ from numpy.distutils.exec_command import find_executable def filter_lines(lns): # Empty lines are excluded. # Leading and trailing whitespaces are removed # Comments are removed. return [ln.strip() for ln in lns if ln.strip() and not ln....
2.328125
2
wecom_sdk/base/callback.py
quanttide/wecom-sdk-py
9
7501
# -*- coding: utf-8 -*- from wecom_sdk.base.crypt import encrypt_msg, decrypt_msg class WeChatWorkCallbackSDK(object): """ 企业微信回调SDK基本类,用于实现内部系统和企业微信客户端的双向通信 详细说明:https://work.weixin.qq.com/api/doc/90000/90135/90930 """ def __init__(self, token, encoding_aes_key): self.token = token ...
2.328125
2
scripts/get-table-schemas.py
numankh/GRE-Vocab-Helper
0
7502
<gh_stars>0 import psycopg2 from decouple import config import pandas as pd import dbconnect cursor, connection = dbconnect.connect_to_db() sql = """ SELECT "table_name","column_name", "data_type", "table_schema" FROM INFORMATION_SCHEMA.COLUMNS WHERE "table_schema" = 'public' ORDER BY table_name """ df = pd.read_sql...
2.921875
3
tests/test_table/test_pivot.py
andriyor/agate
663
7503
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf8 -*- import sys try: from cdecimal import Decimal except ImportError: # pragma: no cover from decimal import Decimal from agate import Table from agate.aggregations import Sum from agate.computations import Percent from agate.data_types import Numbe...
2.21875
2
external/pyTorchChamferDistance/chamfer_distance/__init__.py
chengzhag/DeepPanoContext
52
7504
import os os.makedirs(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'build')), exist_ok=True) from .chamfer_distance import ChamferDistance
1.75
2
test_impartial.py
georg-wolflein/impartial
0
7505
<filename>test_impartial.py from functools import partial from impartial import impartial def f(x: int, y: int, z: int = 0) -> int: return x + 2*y + z def test_simple_call_args(): assert impartial(f, 1)(2) == f(1, 2) def test_simple_call_kwargs(): assert impartial(f, y=2)(x=1) == f(1, 2) def test_s...
3.078125
3
manager.py
smilechaser/screeps-script-caddy
2
7506
<reponame>smilechaser/screeps-script-caddy ''' Python script for uploading/downloading scripts for use with the game Screeps. http://support.screeps.com/hc/en-us/articles/203022612-Commiting-scripts-using-direct-API-access Usage: # # general help/usage # python3 manager.py --help # # retrie...
2.84375
3
contact.py
Nemfeto/python_training
0
7507
<gh_stars>0 class Contact: def __init__(self, first_name, last_name, nickname, address, mobile, email): self.first_name = first_name self.last_name = last_name self.nickname = nickname self.address = address self.mobile = mobile self.email = email
2.421875
2
integreat_cms/cms/views/dashboard/admin_dashboard_view.py
Integreat/cms-v2
21
7508
<filename>integreat_cms/cms/views/dashboard/admin_dashboard_view.py import logging from django.views.generic import TemplateView from ...models import Feedback from ..chat.chat_context_mixin import ChatContextMixin logger = logging.getLogger(__name__) class AdminDashboardView(TemplateView, ChatContextMixin): "...
1.976563
2
src/tangled_up_in_unicode/tangled_up_in_unicode_14_0_0.py
bhumikapahariapuresoftware/tangled-up-in-unicode
2
7509
<filename>src/tangled_up_in_unicode/tangled_up_in_unicode_14_0_0.py from typing import Optional import bisect from tangled_up_in_unicode.u14_0_0_data.prop_list_to_property import prop_list_to_property from tangled_up_in_unicode.u14_0_0_data.blocks_to_block_start import blocks_to_block_start from tangled_up_in_unicode...
1.546875
2
to_display.py
namib-project/weatherstation-image
0
7510
from PIL import Image from PIL import ImageDraw from PIL import ImageFont import sys import ST7735 # Create ST7735 LCD display class object and set pin numbers and display hardware information. disp = ST7735.ST7735( dc=24, cs=ST7735.BG_SPI_CS_BACK, rst=25, port=0, width=122, height=160, ro...
3.296875
3
Smart User Targeted Advertising/MinorPro/FINALPROJECT/Resources/testInsert.py
saransh808/Projects
0
7511
import sqlite3 conn=sqlite3.connect('Survey.db') fo=open('insertcommand.txt') str=fo.readline() while str: str="INSERT INTO data VALUES"+str conn.execute(str) #print(str) str=fo.readline() conn.commit() conn.close() fo.close()
3.640625
4
cdp/headless_experimental.py
HyperionGray/python-chrome-devtools-protocol
42
7512
# DO NOT EDIT THIS FILE! # # This file is generated from the CDP specification. If you need to make # changes, edit the generator and regenerate all of the modules. # # CDP domain: HeadlessExperimental (experimental) from __future__ import annotations from cdp.util import event_class, T_JSON_DICT from dataclasses impo...
2.015625
2
tests/test_geometry.py
resurtm/wvflib
1
7513
<filename>tests/test_geometry.py import unittest from wvflib.geometry import Face class TestGeometry(unittest.TestCase): def test_constructor(self): f = Face() self.assertTrue(len(f.vertices) == 0) if __name__ == '__main__': unittest.main()
2.515625
3
tests/test_core.py
d066y/detectem
0
7514
import pytest from detectem.core import Detector, Result, ResultCollection from detectem.plugin import Plugin, PluginCollection from detectem.settings import INDICATOR_TYPE, HINT_TYPE, MAIN_ENTRY, GENERIC_TYPE from detectem.plugins.helpers import meta_generator class TestDetector(): HAR_ENTRY_1 = { 'requ...
1.929688
2
twitter-clone/twitter/views.py
Mlitwin98/twitter-clone
0
7515
<filename>twitter-clone/twitter/views.py from django.dispatch.dispatcher import receiver from django.shortcuts import get_object_or_404, redirect, render from django.contrib.auth.decorators import login_required from django.http.response import HttpResponse from django.contrib.auth.models import User from django.contri...
2.3125
2
custom_app/custom_app/doctype/depart/test_depart.py
Amruthaohm/custom_app
0
7516
<gh_stars>0 # Copyright (c) 2022, momscode and Contributors # See license.txt # import frappe import unittest class Testdepart(unittest.TestCase): pass
1.1875
1
stix2/__init__.py
khdesai/cti-python-stix2
0
7517
<filename>stix2/__init__.py """Python APIs for STIX 2. .. autosummary:: :toctree: api confidence datastore environment equivalence exceptions markings parsing pattern_visitor patterns properties serialization utils v20 v21 versioning workbench """ # flake8: noqa D...
1.921875
2
0/1/1436/1436.py
chr0m3/boj-codes
3
7518
count = int(input()) title = 0 while count > 0: title += 1 if '666' in str(title): count -= 1 print(title)
3.484375
3
functions/source/GreengrassLambda/idna/uts46data.py
jieatelement/quickstart-aws-industrial-machine-connectivity
40
7519
<filename>functions/source/GreengrassLambda/idna/uts46data.py # This file is automatically generated by tools/idna-data # vim: set fileencoding=utf-8 : """IDNA Mapping Table from UTS46.""" __version__ = "11.0.0" def _seg_0(): return [ (0x0, '3'), (0x1, '3'), (0x2, '3'), (0x3, '3'), ...
1.398438
1
tests/kbcr/smart/test_smart.py
alex4321/ctp
0
7520
# -*- coding: utf-8 -*- import numpy as np import torch from torch import nn from kbcr.kernels import GaussianKernel from kbcr.smart import NeuralKB import pytest @pytest.mark.light def test_smart_v1(): embedding_size = 50 rs = np.random.RandomState(0) for _ in range(32): with torch.no_grad(...
1.984375
2
test.py
eseJiHeaLim/find_child
0
7521
import tkinter window=tkinter.Tk() window.title("YUN DAE HEE") window.geometry("640x400+100+100") window.resizable(True, True) image=tkinter.PhotoImage(file="opencv_frame_0.png") label=tkinter.Label(window, image=image) label.pack() window.mainloop()
3.140625
3
UMSLHackRestAPI/api/urls.py
trujivan/climate-impact-changes
1
7522
<reponame>trujivan/climate-impact-changes<gh_stars>1-10 from django.urls import path, include from .views import main_view, PredictionView #router = routers.DefaultRouter(trailing_slash=False) #router.register('years', YearView, basename='years') #router.register('predict', PredictionView, basename='predict') urlpat...
2.109375
2
ievv_opensource/utils/ievv_colorize.py
appressoas/ievv_opensource
0
7523
<reponame>appressoas/ievv_opensource<gh_stars>0 from django.conf import settings from termcolor import colored #: Red color constant for :func:`.ievv_colorize`. COLOR_RED = 'red' #: Blue color constant for :func:`.ievv_colorize`. COLOR_BLUE = 'blue' #: Yellow color constant for :func:`.ievv_colorize`. COLOR_YELLOW ...
2.53125
3
RSICompute.py
bluefin1986/tinyspark
3
7524
<reponame>bluefin1986/tinyspark # coding: utf-8 # In[1]: import baostock as bs import pandas as pd import numpy as np import talib as ta import matplotlib.pyplot as plt import KlineService import BaoStockUtil import math import datetime from scipy import integrate from RSI import DayRSI,WeekRSI,MonthRSI,SixtyMinRS...
2.28125
2
osnoise/conf/base.py
abousselmi/OSNoise
4
7525
<gh_stars>1-10 # Copyright 2016 Orange # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
1.828125
2
src/orionsensor/gui/sensors/proximitysensor.py
Ginkooo/ORION-sensor-visualizer
0
7526
<filename>src/orionsensor/gui/sensors/proximitysensor.py from kivy.properties import NumericProperty from gui.sensors.sensor import Sensor import config class ProximitySensor(Sensor): """Proximity sensor view""" # maximum possible reading max = NumericProperty(config.ProximitySensor.max) # minimum p...
2.1875
2
Cogs/HelpCommand.py
gudtldn/DiscordStockBot
1
7527
<reponame>gudtldn/DiscordStockBot #도움말 import discord from discord.ext import commands from discord.ext.commands import Context from define import * class HelpCommand_Context(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command(name="도움말", aliases=["명령어", "?"]) @Comma...
2.5625
3
test/test_model/cprofile_test.py
SupermeLC/PyNeval
12
7528
<filename>test/test_model/cprofile_test.py import cProfile import pstats import os # 性能分析装饰器定义 def do_cprofile(filename): """ Decorator for function profiling. """ def wrapper(func): def profiled_func(*args, **kwargs): # Flag for do profiling or not. DO_PROF = False ...
2.578125
3
renku/core/commands/providers/api.py
cyberhck/renku-python
0
7529
<filename>renku/core/commands/providers/api.py<gh_stars>0 # Copyright 2019 - Swiss Data Science Center (SDSC) # A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and # Eidgenössische Technische Hochschule Zürich (ETHZ). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may no...
1.976563
2
cattr/__init__.py
bluetech/cattrs
1
7530
<filename>cattr/__init__.py # -*- coding: utf-8 -*- from .converters import Converter, UnstructureStrategy __all__ = ('global_converter', 'unstructure', 'structure', 'structure_attrs_fromtuple', 'structure_attrs_fromdict', 'UnstructureStrategy') __author__ = '<NAME>' __email__ = '<EMAIL>' glob...
1.929688
2
vega/security/run_dask.py
zjzh/vega
0
7531
# -*- coding: utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. 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/LICENS...
2.03125
2
MISSGANvsStarGAN/core/solver.py
NoaBrazilay/DeepLearningProject
2
7532
""" StarGAN v2 Copyright (c) 2020-present NAVER Corp. This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, US...
1.867188
2
1. Algorithmic Toolbox/week2_algorithmic_warmup/4_lcm.py
vishweshwartyagi/Data-Structures-and-Algorithms-UCSD
0
7533
<reponame>vishweshwartyagi/Data-Structures-and-Algorithms-UCSD<filename>1. Algorithmic Toolbox/week2_algorithmic_warmup/4_lcm.py # Uses python3 import sys def lcm_naive(a, b): for l in range(1, a*b + 1): if l % a == 0 and l % b == 0: return l return a*b def gcd(a, b): if a%b == 0: ...
3.1875
3
guessing_game.py
JoviCastillo/TH-Project-1-guessing-game-
0
7534
import random highscore = [] def not_in_range(guess_it): """This is to check that the numbers inputted by the user are in range, and will let the user know. If the numbers are in range then it passes. """ if guess_it < 1: print('I am not thinking of negative numbers!') elif guess_it > 10:...
4.25
4
MAIL_SERVER.py
dastacy/gve_devnet_unity_unread_voicemail_notifier
0
7535
<reponame>dastacy/gve_devnet_unity_unread_voicemail_notifier #!/usr/bin/env python3 USER = r'server\user' PASSWORD = '<PASSWORD>' HOSTNAME = 'hostname.goes.here.com' DOMAIN = 'domain.goes.here.com' FROM_ADDR = '<EMAIL>'
1.007813
1
src/testrsscast/rss/ytconverter_example.py
anetczuk/rsscast
0
7536
#!/usr/bin/python3 # # MIT License # # Copyright (c) 2021 <NAME> <<EMAIL>> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
2
2
cli.py
palazzem/elmo-server
0
7537
<gh_stars>0 import click APP_YAML_TEMPLATE = """runtime: python37 env_variables: ELMO_BASE_URL: '{BASE_URL}' ELMO_VENDOR: '{VENDOR}' handlers: - url: /.* script: auto secure: always redirect_http_response_code: 301 """ @click.command() @click.argument("base_url") @click.argument("vendor") def generate_app...
2.9375
3
utils/data/dataset_catalog.py
rs9899/Parsing-R-CNN
289
7538
<gh_stars>100-1000 import os.path as osp # Root directory of project ROOT_DIR = osp.abspath(osp.join(osp.dirname(__file__), '..', '..')) # Path to data dir _DATA_DIR = osp.abspath(osp.join(ROOT_DIR, 'data')) # Required dataset entry keys _IM_DIR = 'image_directory' _ANN_FN = 'annotation_file' # Available datasets C...
1.742188
2
prepareDataSet.py
Dakewe-DS1000/LapRSNet
6
7539
# Prepare my dataset for Digital Pathology import os import math import cv2 import pdb rootFolder = "F:\DataBase\LymphnodePathology" trainFolder = rootFolder + "\\trainDataSet" testFolder = rootFolder + "\\testDataSet" srcTrainFilePath = trainFolder + "\\20X\\" dstTrainFilePath = trainFolder + "\\5X\\" srcTestFileP...
2.15625
2
sample_project/sample_content/serializers.py
zentrumnawi/solid-backend
1
7540
<gh_stars>1-10 from rest_framework import serializers from solid_backend.photograph.serializers import PhotographSerializer from solid_backend.media_object.serializers import MediaObjectSerializer from .models import SampleProfile class SampleProfileSerializer(serializers.ModelSerializer): media_objects = MediaO...
1.757813
2
tests/reshape_4/generate_pb.py
wchsieh/utensor_cgen
0
7541
# -*- coding: utf8 -*- import os from utensor_cgen.utils import save_consts, save_graph, save_idx import numpy as np import tensorflow as tf def generate(): test_dir = os.path.dirname(__file__) graph = tf.Graph() with graph.as_default(): x = tf.constant(np.random.randn(10), dtype=tf.floa...
2.234375
2
junn-predict/junn_predict/common/logging.py
modsim/junn
0
7542
"""Logging helpers.""" import logging import sys import colorlog import tqdm class TqdmLoggingHandler(logging.StreamHandler): """TqdmLoggingHandler, outputs log messages to the console compatible with tqdm.""" def emit(self, record): # noqa: D102 message = self.format(record) tqdm.tqdm.writ...
2.625
3
subpartcode/ultrasonic_basic_code.py
LesterYHZ/Automated-Bridge-Inspection-Robot-Project
1
7543
#Basic Ultrasonic sensor (HC-SR04) code import RPi.GPIO as GPIO #GPIO RPI library import time # makes sure Pi waits between steps GPIO.setmode(GPIO.BCM) #sets GPIO pin numbering #GPIO.setmode(GPIO.BOARD) #Remove warnings GPIO.setwarnings(False) #Create loop variable #loop = 1 #BCM TRIG = 23 #output pin - triggers t...
3.421875
3
Mentorama/Modulo 3 - POO/Retangulo.py
MOURAIGOR/python
0
7544
class Retangulo: # Atributos def __init__(self, comprimento, altura): self.setcomprimento(comprimento) self.setAltura(altura) # Métodos def setcomprimento(self, comprimento): self.comprimento = comprimento def getcomprimento(self): return self.comprimento def se...
3.859375
4
DEMs/denmark/download_dk_dem.py
PeterFogh/digital_elevation_model_use_cases
0
7545
<filename>DEMs/denmark/download_dk_dem.py """ Fetch all files from Kortforsyningen FTP server folder. Copyright (c) 2021 <NAME> See also command line alternative in `download_dk_dem.sh` """ from ftplib import FTP, error_perm import os from pathlib import Path import time import operator import functools import shutil...
2.921875
3
6_refin_widgets.py
jiaxinjiang2919/Refinance-Calculator
14
7546
<gh_stars>10-100 # -*- coding: utf-8 -*- """ Created on Sun Mar 24 15:02:37 2019 @author: <NAME> """ from tkinter import * import numpy as np class LoanCalculator: def __init__(self): window = Tk() window.title("Loan Calculator") Label(window, text="Loan Amount")...
3.234375
3
ndctl.py
davelarsen58/pmemtool
3
7547
<reponame>davelarsen58/pmemtool #!/usr/bin/python3 # # PMTOOL NDCTL Python Module # Copyright (C) <NAME> # Released under MIT License import os import json from common import message, get_linenumber, pretty_print from common import V0, V1, V2, V3, V4, V5, D0, D1, D2, D3, D4, D5 import common as c import time DEFAULT...
2.015625
2
tb/sources/__init__.py
DronMDF/manabot
1
7548
from .admin import ReviewListAdmin, SoAdminReviewIsOut, SoReviewForAdmin from .admin_commands import ( AdminCommands, AdminFilteredCommands, ReviewListByCommands, SoIgnoreReview, SoSubmitReview ) from .gerrit import ReviewOnServer, SoNewReview, SoOutReview, SoUpdateReview from .reaction import ( ReactionAlways, ...
1.046875
1
sdk/python/pulumi_gcp/accesscontextmanager/service_perimeter.py
sisisin/pulumi-gcp
121
7549
<gh_stars>100-1000 # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, over...
1.78125
2
core/swift3.1.1Action/swift3runner.py
ianpartridge/incubator-openwhisk-runtime-swift
2
7550
"""Python proxy to run Swift action. /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Ve...
2.21875
2
src/ychaos/utils/types.py
vanderh0ff/ychaos
8
7551
<filename>src/ychaos/utils/types.py from typing import Dict, List, TypeVar, Union JsonTypeVar = TypeVar("JsonTypeVar") JsonPrimitive = Union[str, float, int, bool, None] JsonDict = Dict[str, JsonTypeVar] JsonArray = List[JsonTypeVar] Json = Union[JsonPrimitive, JsonDict, JsonArray]
2.6875
3
yandex_market_language/models/promo.py
stefanitsky/yandex_market_language
7
7552
import typing as t from yandex_market_language import models from yandex_market_language.models.abstract import XMLElement, XMLSubElement class Promo(models.AbstractModel): """ Docs: https://yandex.ru/support/partnermarket/elements/promo-gift.html """ MAPPING = { "start-date": "start_date", ...
2.671875
3
src/testCmd.py
skogsbaer/check-assignments
0
7553
<filename>src/testCmd.py import shell from dataclasses import dataclass from utils import * from ownLogging import * from typing import * from ansi import * import re import os import testHaskell import testPython import testJava @dataclass class TestArgs: dirs: List[str] assignments: List[str] # take all if e...
2.703125
3
kipoi_containers/singularityhelper.py
kipoi/kipoi-containers
0
7554
<gh_stars>0 from collections import Counter from datetime import datetime import os import requests from subprocess import Popen, PIPE from pathlib import Path import json from typing import Dict, Union, TYPE_CHECKING from kipoi_utils.external.torchvision.dataset_utils import download_url if TYPE_CHECKING: import...
2.34375
2
policy/_cache.py
garenchan/policy
5
7555
# -*- coding: utf-8 -*- """ policy._cache ~~~~~~~~~~~~~~~ Cache for policy file. """ import os import logging LOG = logging.getLogger(__name__) # Global file cache CACHE = {} def read_file(filename: str, force_reload=False): """Read a file if it has been modified. :param filename: File name ...
2.890625
3
contrib/opencensus-ext-django/opencensus/ext/django/middleware.py
samn/opencensus-python
0
7556
<filename>contrib/opencensus-ext-django/opencensus/ext/django/middleware.py # Copyright 2017, OpenCensus Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/...
1.710938
2
codeblockCar/codingPage/tests.py
ICT2x01-p2-4/ICT2x01-p2-4
0
7557
from typing import Reversible from django.test import TestCase, Client from challenge.models import Challenge from codingPage.models import Command, Log from django.core.exceptions import ValidationError from django.urls import reverse class CodingPageTest(TestCase): def setUp(self) -> None: self.client = ...
2.5
2
app/hint/models.py
vigov5/oshougatsu2015
0
7558
<reponame>vigov5/oshougatsu2015<gh_stars>0 import os import datetime from app import app, db class Hint(db.Model): __tablename__ = 'hints' id = db.Column(db.Integer, primary_key=True) description = db.Column(db.Text) is_open = db.Column(db.Boolean) problem_id = db.Column(db.Integer, db.ForeignKey...
2.5
2
base/urls.py
almustafa-noureddin/Portfolio-website
0
7559
from django.urls import path from . import views app_name = "base" urlpatterns = [ path('', views.IndexView.as_view(), name="home"), path('contact/', views.ContactView.as_view(), name="contact"),]
1.757813
2
app/main/views/templates.py
cds-snc/notification-admin
16
7560
<filename>app/main/views/templates.py from datetime import datetime, timedelta from string import ascii_uppercase from dateutil.parser import parse from flask import abort, flash, jsonify, redirect, render_template, request, url_for from flask_babel import _ from flask_babel import lazy_gettext as _l from flask_login ...
1.992188
2
linearRegression_gradientDescent/linearRegression_gradientDescent.py
MarcelloVendruscolo/DeepLearningForImageAnalysis
0
7561
<filename>linearRegression_gradientDescent/linearRegression_gradientDescent.py import numpy as np from load_auto import load_auto import matplotlib.pyplot as plt import math def initialize_parameters(observation_dimension): # observation_dimension: number of features taken into consideration of the input # ret...
3.5
4
unit_tests/test_hr_calculations.py
mdholbrook/heart_rate_sentinel_server
0
7562
<filename>unit_tests/test_hr_calculations.py import pytest from functions.hr_calculations import * @pytest.mark.parametrize("candidate, database, expected", [ ('jack', [{'patient_id': 'jump'}, {'patient_id': 'jack'}], 1), ('jungle', [{'patient_id': 'jungle'}, {'patient_id': 'jack'}], 0), ('bo', [{'patient...
2.828125
3
selfdrive/boardd/tests/test_boardd_api.py
919bot/Tessa
114
7563
<reponame>919bot/Tessa import random import numpy as np import selfdrive.boardd.tests.boardd_old as boardd_old import selfdrive.boardd.boardd as boardd from common.realtime import sec_since_boot from cereal import log import unittest def generate_random_can_data_list(): can_list = [] cnt = random.randint(1, 64)...
2.359375
2
py_types/static/parse.py
zekna/py-types
5
7564
<gh_stars>1-10 import ast import inspect import sys import argparse from ..runtime.asserts import typecheck @typecheck def pretty_print_defs(defs: list) -> None: for d in defs: print("Function definition for {}".format(d["name"])) print("Arguments:") for arg in d["args"]: arg_...
3
3
example/example/urls.py
pmaccamp/django-tastypie-swagger
2
7565
<filename>example/example/urls.py<gh_stars>1-10 from django.conf.urls import include, url from django.contrib import admin from demo.apis import api urlpatterns = [ url(r'^api/', include(api.urls)), url(r'^api/doc/', include(('tastypie_swagger.urls', 'tastypie_swagger'), namespace...
1.78125
2
scrapy_framework/midwares/download_midware.py
savor007/scrapy_framework
0
7566
<gh_stars>0 from scrapy_framework.html.request import Request from scrapy_framework.html.response import Response import random def get_ua(): first_num=random.randint(55,69) third_num=random.randint(0,3200) forth_num=random.randint(0, 140) os_type = [ '(Windows NT 6.1; WOW64)', '(Windows NT ...
2.640625
3
tracardi/process_engine/action/v1/pro/scheduler/plugin.py
bytepl/tracardi
0
7567
from pydantic import BaseModel from tracardi.domain.entity import Entity from tracardi.domain.scheduler_config import SchedulerConfig from tracardi.domain.resource import ResourceCredentials from tracardi.service.storage.driver import storage from tracardi.service.plugin.runner import ActionRunner from tracardi.servic...
1.890625
2
tests/test_covid_daily.py
alvarobartt/covid-daily
13
7568
<filename>tests/test_covid_daily.py # Copyright 2020 <NAME>, alvarobartt @ GitHub # See LICENSE for details. import pytest import covid_daily def test_overview(): params = [ { 'as_json': True }, { 'as_json': False } ] for param in params: ...
2.34375
2
2021/HANFS/fence-agents/fence/agents/zvm/fence_zvmip.py
BryanWhitehurst/HPCCEA
10
7569
<gh_stars>1-10 #!@PYTHON@ -tt import sys import atexit import socket import struct import logging sys.path.append("@FENCEAGENTSLIBDIR@") from fencing import * from fencing import fail, fail_usage, run_delay, EC_LOGIN_DENIED, EC_TIMED_OUT #BEGIN_VERSION_GENERATION RELEASE_VERSION="" REDHAT_COPYRIGHT="" BUILD_DATE="" #...
2.1875
2
2.5.9/test_splash/test_splash/spiders/with_splash.py
feel-easy/myspider
1
7570
<filename>2.5.9/test_splash/test_splash/spiders/with_splash.py # -*- coding: utf-8 -*- import scrapy from scrapy_splash import SplashRequest # 使用scrapy_splash包提供的request对象 class WithSplashSpider(scrapy.Spider): name = 'with_splash' allowed_domains = ['baidu.com'] start_urls = ['https://www.baidu.com/s?wd=1...
2.71875
3
run.py
iudaichi/iu_linebot
0
7571
from main import app import os import uvicorn if __name__ == '__main__': port = int(os.getenv("PORT")) uvicorn.run(app, host="0.0.0.0", port=port, workers=1, reload=True)
1.796875
2
fastestimator/architecture/pytorch/unet.py
DwijayDS/fastestimator
57
7572
<reponame>DwijayDS/fastestimator # Copyright 2019 The FastEstimator 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/LICENS...
2.234375
2
generalfile/path.py
Mandera/generalfile
0
7573
<reponame>Mandera/generalfile import pathlib import os from generallibrary import VerInfo, TreeDiagram, Recycle, classproperty, deco_cache from generalfile.errors import InvalidCharacterError from generalfile.path_lock import Path_ContextManager from generalfile.path_operations import Path_Operations from generalfi...
1.984375
2
src/genui/models/models.py
Tontolda/genui
15
7574
<gh_stars>10-100 import os from django.db import models import uuid # Create your models here. from djcelery_model.models import TaskMixin from polymorphic.models import PolymorphicModel from genui.utils.models import NON_POLYMORPHIC_CASCADE, OverwriteStorage from genui.utils.extensions.tasks.models import TaskShort...
2.015625
2
projectroles/tests/test_views_api.py
bihealth/sodar_core
11
7575
<filename>projectroles/tests/test_views_api.py """REST API view tests for the projectroles app""" import base64 import json import pytz from django.conf import settings from django.core import mail from django.forms.models import model_to_dict from django.test import override_settings from django.urls import reverse f...
1.929688
2
src/model/model.py
kwasnydam/animal_disambiguation
0
7576
<filename>src/model/model.py """Contains the classification model I am going to use in my problem and some utility functions. Functions build_mmdisambiguator - build the core application object with the collaborators info Classes MMDisambiguator - core class of the application """ import pickle import os imp...
2.6875
3
v0.5.0/nvidia/submission/code/recommendation/pytorch/load.py
myelintek/results
44
7577
# Copyright (c) 2018, deepakn94. 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 ...
2.90625
3
rpython/jit/backend/llsupport/test/test_rewrite.py
jptomo/pypy-lang-scheme
1
7578
from rpython.jit.backend.llsupport.descr import get_size_descr,\ get_field_descr, get_array_descr, ArrayDescr, FieldDescr,\ SizeDescr, get_interiorfield_descr from rpython.jit.backend.llsupport.gc import GcLLDescr_boehm,\ GcLLDescr_framework from rpython.jit.backend.llsupport import jitframe from rpython...
1.875
2
hummingbot/client/command/history_command.py
sanchaymittal/hummingbot
0
7579
<filename>hummingbot/client/command/history_command.py from decimal import Decimal import pandas as pd from typing import ( Any, Dict, Set, Tuple, TYPE_CHECKING) from hummingbot.client.performance_analysis import PerformanceAnalysis from hummingbot.core.utils.exchange_rate_conversion import Exchang...
2.515625
3
scripts/bin2asm.py
sami2316/asm2vec-pytorch
0
7580
<reponame>sami2316/asm2vec-pytorch import re import os import click import r2pipe import hashlib from pathlib import Path import _pickle as cPickle def sha3(data): return hashlib.sha3_256(data.encode()).hexdigest() def validEXE(filename): magics = [bytes.fromhex('7f454c46')] with open(filename, 'rb') as f...
2.484375
2
6/4.py
Chyroc/homework
0
7581
import re def remove_not_alpha_num(string): return re.sub('[^0-9a-zA-Z]+', '', string) if __name__ == '__main__': print(remove_not_alpha_num('a000 aa-b') == 'a000aab')
3.515625
4
LazyAngus/Assets/Extensions/IOSDeploy/Scripts/Editor/post_process.py
DougLazyAngus/lazyAngus
0
7582
<reponame>DougLazyAngus/lazyAngus<gh_stars>0 import os from sys import argv from mod_pbxproj import XcodeProject #import appcontroller path = argv[1] frameworks = argv[2].split(' ') libraries = argv[3].split(' ') cflags = argv[4].split(' ') ldflags = argv[5].split(' ') folders = argv[6].split(' ') pri...
2.125
2
judge/migrations/0024_auto_20200705_0246.py
TheAvidDev/pnoj-site
2
7583
<gh_stars>1-10 # Generated by Django 3.0.8 on 2020-07-05 02:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('judge', '0023_auto_20200704_2318'), ] operations = [ migrations.AlterField( model_name='submission', ...
1.859375
2
src/badge_hub.py
stottlerhenke-seattle/openbadge-hub-py
0
7584
#!/usr/bin/env python from __future__ import absolute_import, division, print_function import os import re import shlex import subprocess import signal import csv import logging import json import time from datetime import datetime as dt from requests.exceptions import RequestException import glob import traceback i...
1.742188
2
python/compile.py
liamgam/gdkit
1
7585
import compileall compileall.compile_dir(".",force=1)
1.171875
1
saleor/product/migrations/0141_update_descritpion_fields.py
fairhopeweb/saleor
15,337
7586
# Generated by Django 3.1.5 on 2021-02-17 11:04 from django.db import migrations import saleor.core.db.fields import saleor.core.utils.editorjs def update_empty_description_field(apps, schema_editor): Category = apps.get_model("product", "Category") CategoryTranslation = apps.get_model("product", "CategoryT...
1.671875
2
local_search/sat_isfayer.py
arnaubena97/SatSolver-sat_isfayer
0
7587
#!/usr/bin/env python3 import sys import random def read_file(file_name): """File reader and parser the num of variables, num of clauses and put the clauses in a list""" clauses =[] with open(file_name) as all_file: for line in all_file: if line.startswith('c'): continue #ignore comment...
3.859375
4
torch/_VF.py
Hacky-DH/pytorch
60,067
7588
""" This makes the functions in torch._C._VariableFunctions available as torch._VF.<funcname> without mypy being able to find them. A subset of those functions are mapped to ATen functions in torch/jit/_builtins.py See https://github.com/pytorch/pytorch/issues/21478 for the reason for introducing torch._VF """ i...
2.515625
3
sparse_causal_model_learner_rl/annealer/threshold_projection.py
sergeivolodin/causality-disentanglement-rl
2
7589
<filename>sparse_causal_model_learner_rl/annealer/threshold_projection.py import gin import torch import logging from sparse_causal_model_learner_rl.metrics import find_value, find_key @gin.configurable def ProjectionThreshold(config, config_object, epoch_info, temp, adjust_every=100, metric_threshold=0...
1.984375
2
numpyro/contrib/control_flow/scan.py
ucals/numpyro
2
7590
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from collections import OrderedDict from functools import partial from jax import lax, random, tree_flatten, tree_map, tree_multimap, tree_unflatten import jax.numpy as jnp from jax.tree_util import register_pytree_node_class from nu...
1.992188
2
src/catalog/migrations/0003_remove_productattributevalue_name.py
earth-emoji/dennea
0
7591
<filename>src/catalog/migrations/0003_remove_productattributevalue_name.py # Generated by Django 2.2.12 on 2020-06-10 01:11 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('catalog', '0002_auto_20200610_0019'), ] operations = [ migrations.Remove...
1.539063
2
e2xgrader/preprocessors/overwritecells.py
divindevaiah/e2xgrader
2
7592
import json from nbformat.notebooknode import NotebookNode from nbconvert.exporters.exporter import ResourcesDict from typing import Tuple from nbgrader.api import MissingEntry from nbgrader.preprocessors import OverwriteCells as NbgraderOverwriteCells from ..utils.extra_cells import is_singlechoice, is_multiplechoi...
2.140625
2
tools/pdf2txt.py
ehtec/pdfminer.six
0
7593
<reponame>ehtec/pdfminer.six #!/usr/bin/env python3 """A command line tool for extracting text and images from PDF and output it to plain text, html, xml or tags.""" import argparse import logging import sys from typing import Any, Container, Iterable, List, Optional import pdfminer.high_level from pdfminer.layout imp...
2.9375
3
nython/nythonize.py
agungnasik57/nython
53
7594
"""Compile Nim libraries as Python Extension Modules. If you want your namespace to coexist with your pthon code, name this ponim.nim and then your import will look like `from ponim.nim import adder` and `from ponim import subtractor`. There must be a way to smooth that out in the __init__.py file somehow. Note that ...
2.390625
2
tests/contrib/test_util.py
lixinso/pyro
10
7595
<filename>tests/contrib/test_util.py from collections import OrderedDict import pytest import torch import pyro.distributions as dist from pyro.contrib.util import ( get_indices, tensor_to_dict, rmv, rvv, lexpand, rexpand, rdiag, rtril, hessian ) from tests.common import assert_equal def test_get_indices_sizes()...
2.109375
2
emodul/apps.py
HarisHijazi/mojarnik-server
0
7596
from django.apps import AppConfig class EmodulConfig(AppConfig): name = 'emodul'
1.0625
1
Diffnet++/class/DataModule.py
mIXs222/diffnet
0
7597
from __future__ import division from collections import defaultdict import numpy as np from time import time import random import tensorflow.compat.v1 as tf tf.disable_v2_behavior() # import tensorflow as tf class DataModule(): def __init__(self, conf, filename): self.conf = conf self.data_dict = ...
2.375
2
src/models/VanillaTransformer.py
iosurodri/annotated-transformer
0
7598
from xmlrpc.server import MultiPathXMLRPCServer import torch.nn as nn import torch.nn.functional as F import copy from src.layers.layers import Encoder, EncoderLayer, Decoder, DecoderLayer, PositionwiseFeedForward from src.layers.preprocessing import Embeddings, PositionalEncoding from src.layers.attention import Mult...
2.25
2
venv/lib/python3.8/site-packages/arch/tests/univariate/test_recursions.py
YileC928/finm-portfolio-2021
0
7599
import os import timeit from typing import List import numpy as np from numpy.random import RandomState from numpy.testing import assert_allclose, assert_almost_equal import pytest from scipy.special import gamma import arch.univariate.recursions_python as recpy CYTHON_COVERAGE = os.environ.get("ARCH_CYTHON_COVERAGE...
2.25
2