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
file.py
Tawfiq-MoonHacker/metis_video
0
15400
<gh_stars>0 file_forgot_password = ["""<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <style type...
1.835938
2
builder/schedule.py
MyConbook/datatool
0
15401
<gh_stars>0 import icalendar import urllib2 import hashlib import string import re import datetime from database import Database, TableHandler class Schedule(TableHandler): columns = [("Title", Database.C_TCN), "Description", ("Category", Database.C_TCN), ("Location", Database.C_TCN), ("StartDate", Database.C_D), ("E...
2.5625
3
src/OFS/CopySupport.py
MatthewWilkes/Zope
1
15402
<filename>src/OFS/CopySupport.py ############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. ...
1.625
2
Search in a Binary Search Tree.py
frank0215/Leetcode_python
0
15403
<reponame>frank0215/Leetcode_python class TreeNode: def __init__(self, val, left=None, right=None): self.val = val self.right = right self.left = left class Solution: def searchBST(self, root, val): # if not root: # return None # if root.val == val: ...
3.78125
4
src/data/process_HJ_data.py
simran-grewal/COVID-19-Data-Analysis
0
15404
<gh_stars>0 import subprocess import os import numpy as np import pandas as pd from datetime import datetime def store_relational_JH_data(): pd_raw = pd.read_csv('../data/raw/COVID-19/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv') pd_data_base = pd_raw.rename(columns=...
2.375
2
wasm-server.py
erique/pt2-clone
0
15405
<reponame>erique/pt2-clone<filename>wasm-server.py # Python 3 import sys import socketserver from http.server import SimpleHTTPRequestHandler class WasmHandler(SimpleHTTPRequestHandler): def __init__(self, *args, **kwargs): super().__init__(*args, directory="release/emscripten", **kwargs) def do_GET(s...
2.328125
2
stage.py
boularbahsmail/Asteroids-Game
2
15406
<filename>stage.py import pygame import sys import os from pygame.locals import * class Stage: # Set up the PyGame surface def __init__(self, caption, dimensions=None): pygame.init() # If no screen size is provided pick the first available mode if dimensions == None: dim...
3.15625
3
web/MicroservicesAsAservice/src/notes/app.py
NoXLaw/RaRCTF2021-Challenges-Public
0
15407
from flask import Flask, request, jsonify, render_template_string import redis import requests import re import json import sys app = Flask(__name__) @app.route('/getid/<username>') def getid(username): red = redis.Redis(host="redis_users") return red.get(username).decode() @app.route('/useraction', methods...
2.71875
3
divisiones.py
badgercl/scrappers-congreso-chile
0
15408
<filename>divisiones.py import requests from bs4 import BeautifulSoup import json import pprint url = 'https://www.bcn.cl/siit/divisionelectoral/index.htm' res = requests.get(url) soup = BeautifulSoup(res.text, 'html.parser') rows = soup.find_all('tbody')[1].find_all('tr') region = "" circunscripcion = "" distrito ...
2.8125
3
aws-auth-manager/src/awsauthmanager/app.py
zepplen/aws_tokens
0
15409
#################################################### # (C) <NAME>, 2016, All Rights Reserved # # File Name: app.py # # Creation Date: 28-12-2016 # # Created By: <NAME> # # Purpose: # #################################################### from __future__ import print_function from credentialfile import CredentialFile fro...
2.421875
2
setup.py
datamachines/classification-banner
0
15410
<reponame>datamachines/classification-banner #!/usr/bin/env python from setuptools import setup, find_packages setup(name='classification-banner', version='1.0.0', description='Classification banner compatable with GTK3 and X11.', author='<NAME>', author_email='<EMAIL>', url='https://www...
1.226563
1
synapyse/impl/activation_functions/linear.py
synapyse/synapyse
4
15411
<gh_stars>1-10 from synapyse.base.activation_functions.activation_function import ActivationFunction __author__ = '<NAME>' class Linear(ActivationFunction): def calculate_output(self): return self.x def calculate_derivative(self): return 1.0 def clone(self): clone = Linear() ...
2.40625
2
demo/app/libs/description.py
suenklerhaw/seoeffekt
1
15412
<reponame>suenklerhaw/seoeffekt<gh_stars>1-10 #check description from bs4 import BeautifulSoup import lxml.html def check_description(tree): description = "" xpath_meta = "//meta[@name='description']/@content" xpath_og_property = "//meta[@property='og:description']/@content" xpath_og_name = "//meta[@na...
2.984375
3
backend/projectfiles/GradleProjectFile.py
karllindmark/IsYourProjectUpToDate
0
15413
import re from backend.projectfiles.GenericProjectFile import GenericProjectFile QUOTE = r'(?:["|\'])' STRING = r'([\w\.\-\+]+)' GAV_REGEXP = QUOTE + '(?:' + ":".join([STRING, STRING, STRING]) + ')' + QUOTE class GradleProjectFile(GenericProjectFile): """ Gradle project file implementation to extract dependenc...
2.453125
2
python/rhinoscripts/example_csv_loading.py
tasbolat1/hmv-s16
1
15414
<gh_stars>1-10 """Example code for importing a single rigid body trajectory into Rhino from a Optitrack CSV file. Copyright (c) 2016, <NAME>. All rights reserved. Licensed under the terms of the BSD 3-clause license as included in LICENSE. Example code for generating a path of Rhino 'planes' (e.g. coordinate frame) ...
2.828125
3
4_Nback/Nback_practice_lastrun.py
Brinks0211/cognitive_paradigms_patients
2
15415
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This experiment was created using PsychoPy3 Experiment Builder (v2020.1.3), on 六月 15, 2020, at 09:02 If you publish work using this script the most relevant publication is: <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>. (2019) ...
2.359375
2
pysal/contrib/geotable/utils.py
cubensys/pysal
0
15416
<reponame>cubensys/pysal<gh_stars>0 from ...cg import asShape as pShape from ...common import requires as _requires from warnings import warn @_requires('geopandas') def to_df(df, geom_col='geometry', **kw): """ Convert a Geopandas dataframe into a normal pandas dataframe with a column containing PySAL sha...
2.796875
3
torrent/torrent_tracker/whitelist_api/urls.py
projectpai/paipass
3
15417
from django.urls import path from whitelist_api.views import AddTorrentInfoHash, RemoveTorrentInfoHash app_name = 'whitelist_api' urlpatterns = [ path('add-torrent-info-hash/', AddTorrentInfoHash.as_view()), path('del-torrent-info-hash/', RemoveTorrentInfoHash.as_view()), ]
1.710938
2
vega/core/metrics/pytorch/flops_and_params.py
qixiuai/vega
0
15418
<gh_stars>0 # -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; witho...
2.265625
2
Projects/project04/pop_shrink.py
tonysulfaro/CSE-331
2
15419
from Stack import Stack def main(): stack = Stack() stack.push(0) stack.push(1) stack.push(2) stack.push(3) assert stack.data == [0, 1, 2, 3] assert stack.capacity == 4 assert stack.size == 4 popped = stack.pop() assert popped == 3 popped = stack.pop() assert popped =...
3.6875
4
pycache/__init__.py
HuiiBuh/pycache
1
15420
__version__ = '0.3.2' # noinspection PyUnresolvedReferences from ._cache._cache import cache # noinspection PyUnresolvedReferences from ._scheduler._scheduler import add_schedule, schedule, ScheduleSubscription
1.171875
1
bender/tests/test_predict_pipeline.py
otovo/bender
2
15421
import numpy as np import pytest from pandas.core.frame import DataFrame from bender.importers import DataImporters from bender.model_loaders import ModelLoaders from bender.model_trainer.decision_tree import DecisionTreeClassifierTrainer from bender.split_strategies import SplitStrategies pytestmark = pytest.mark.as...
2.5
2
gbot/libs/helper.py
dgw/goshu
5
15422
#!/usr/bin/env python3 # Goshu IRC Bot # written by <NAME> <<EMAIL>> # licensed under the ISC license """extends several builtin functions and provides helper functions The default Python library is extensive and well-stocked. There are some times however, you wish a small task was taken care of for you. This module i...
2.4375
2
ptf/lib/runner.py
opennetworkinglab/tassen
4
15423
#!/usr/bin/env python2 # Copyright 2013-present Barefoot Networks, Inc. # SPDX-FileCopyrightText: 2018-present Open Networking Foundation # # SPDX-License-Identifier: Apache-2.0 import Queue import argparse import json import logging import os import re import subprocess import sys import threading import time from c...
2.15625
2
rsebs/__init__.py
gabrielperezs/recycling-snapshots
1
15424
from .snapshots import set_client from .snapshots import get_snapshots from .snapshots import tag_snapshot from .snapshots import set_drymode from .snapshots import unset_drymode
1.054688
1
predict_form.py
HuginnM/UsedCarsUA
0
15425
from flask_wtf import FlaskForm from wtforms import SubmitField, SelectField, IntegerField, FloatField, StringField from wtforms.validators import DataRequired import pandas as pd uniq_vals = pd.read_csv("data/unique_cat_vals.csv", index_col=0) class InputData(FlaskForm): car = SelectField(label="Car", choices=u...
2.96875
3
color.py
laplacetw/color-codes-bot
1
15426
#!usr/bin/env python3 color_chart = { '1C1':[13.24, 88.89, 228.98, 0.], '1N1':[14.2, 95.37, 233.82, 0.], '1N2':[12.95, 91.79, 219.5, 0.], '1W1':[14.67, 103.64, 229.41, 0.], '1W2':[14.69, 106.34, 227.28, 0.], '2C0':[15.73, 134.68, 222.32, 0.], '2C1':[14.57, 125.89, 220.69, 0.], '2C3':[13.7, 103.72, 199.4...
2.078125
2
leetCode/algorithms/easy/occurrences_after_bigram.py
ferhatelmas/algo
25
15427
from typing import List class Solution: def findOcurrences(self, text: str, first: str, second: str) -> List[str]: ls = text.split() return [c for a, b, c in zip(ls, ls[1:], ls[2:]) if a == first and b == second]
3.5625
4
src/pyuwds3/utils/egocentric_spatial_relations.py
LAAS-HRI/uwds3
2
15428
import math from scipy.spatial.distance import euclidean from ..types.bbox import BoundingBox def is_left_of(bb1, bb2): _, _, bb1_max, _, _ = bb1 bb2_min, _, _, _, _ = bb2 return bb1_max < bb2_min def is_right_of(bb1, bb2): bb1_min, _, _, _, _ = bb1 _, _, bb2_max, _, _ = bb2 return bb1_min ...
3.109375
3
machine_replacement_action_probs.py
dsbrown1331/broil
1
15429
<reponame>dsbrown1331/broil<filename>machine_replacement_action_probs.py import bayesian_irl import mdp_worlds import utils import mdp import numpy as np import scipy import random import generate_efficient_frontier from machine_replacement import generate_posterior_samples if __name__=="__main__": seed = 1234 ...
2.25
2
sequential/seq_smnist/train_args_seq_smnist.py
mariacer/cl_in_rnns
26
15430
<gh_stars>10-100 #!/usr/bin/env python3 # Copyright 2019 <NAME>, <NAME> # # 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 b...
2.5
2
examples/compare.py
guo-yong-zhi/wordcloud2
0
15431
from wordcloud2 import wordcloud as W import os from PIL import Image stwords = {"us", "will"} print("==Obama's==") cs = W.randomscheme() #:Set1_8 as_ = W.randomangles() #(0,90,45,-45) dens = 0.5 #not too high wca = W.wordcloud( W.processtext(open(W.pkgdir(W.WordCloud)+"/res/Barack Obama's First Inaugural Address...
3.140625
3
modules/insight/nbCurvesLevelSet.py
chrisidefix/devide
25
15432
# Copyright (c) <NAME>, TU Delft # All rights reserved. # See COPYRIGHT for details. import itk import module_kits.itk_kit as itk_kit from module_base import ModuleBase from module_mixins import ScriptedConfigModuleMixin class nbCurvesLevelSet(ScriptedConfigModuleMixin, ModuleBase): def __init__(self, module_man...
2.03125
2
setup.py
ThomasChiroux/ejabberd_external_auth_jwt
0
15433
<reponame>ThomasChiroux/ejabberd_external_auth_jwt # # Copyright 2018-2019 Happineo # """setuptools installer for zamita.""" import os import uuid from setuptools import find_packages from setuptools import setup from setuptools.command.build_py import build_py # local imports from build_scripts.version import Versi...
1.820313
2
Analysis/Feb2021/common_plotting.py
TimChild/dat_analysis
2
15434
""" Sep 21 -- A few of the plots used in analysis, very far from a complete list, and probably most are too specific to be useful again. Moved useful functions from here. """ from __future__ import annotations from typing import List, Callable, Optional, Union, TYPE_CHECKING import numpy as np from dat_analysis.anal...
2.65625
3
Code/sphero_learn.py
rvarga601/IER
0
15435
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 10 23:54:16 2021 @author: rolandvarga """ import gym import numpy as np import matplotlib.pyplot as plt import time from scipy.signal import savgol_filter import pickle #%matplotlib qt #%matplotlib inline # Set to 1 to repeat SARSA learning (With...
2.625
3
HW7/kernel_eigenface.py
joycenerd/Machine_Learning_2021
1
15436
<gh_stars>1-10 from scipy.spatial.distance import cdist from numpy.linalg import eig, norm, pinv import matplotlib.pyplot as plt from PIL import Image import numpy as np import argparse import ntpath import glob import os parser = argparse.ArgumentParser() parser.add_argument("--option", type=str, default="PCA", ...
2.515625
3
duqo/optimization/predict.py
canbooo/pyRDO
11
15437
# -*- coding: utf-8 -*- """ Created on Fri Aug 9 15:33:47 2019 @author: Bogoclu """ import typing import multiprocessing as mp import warnings import numpy as np from scipy import stats from .space import FullSpace from duqo.proba import DS, MC, SUSE, ISPUD, FORM from duqo.doe.lhs import make_doe def _check_obj_w...
2.40625
2
mymodule/twitter_json_parsing.py
sobkovych/TwitterFriendsMap
0
15438
<filename>mymodule/twitter_json_parsing.py<gh_stars>0 """Parse json files.""" import json import re def search_for_key(final_key: str, tree: dict, space: list = []): """Search all data for a key. :param final_key: the key :param tree: the data :param space: found values :return: all found values ...
3.578125
4
meet/migrations/0001_initial.py
bjones-tech/speedy-meety
0
15439
<reponame>bjones-tech/speedy-meety # -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-03-17 02:58 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import meet.models class Migration(migrations.Migration): initial = True dependencies ...
1.585938
2
setup.py
jrspruitt/pyfa_gpio
0
15440
<gh_stars>0 #!/usr/bin/env python from setuptools import setup,find_packages version = '0.1' setup( name='pyfa_gpio', version=version, description='', author='<NAME>', url='https://github.com/jrspruitt/pyfa_gpio', license='MIT', packages = find_packages(), )
0.996094
1
dps/env/basic/path_discovery.py
alcinos/dps
0
15441
import tensorflow as tf import numpy as np from dps.register import RegisterBank from dps.env import TensorFlowEnv from dps.utils import Param, Config def build_env(): return PathDiscovery() config = Config( build_env=build_env, curriculum=[ dict(shape=(2, 2), threshold=6), dict(shape=(...
2.515625
3
utils/github/query.py
malkfilipp/ClickHouse
1
15442
# -*- coding: utf-8 -*- import requests class Query: '''Implements queries to the Github API using GraphQL ''' def __init__(self, token, max_page_size=100, min_page_size=5): self._token = token self._max_page_size = max_page_size self._min_page_size = min_page_size self.a...
2.9375
3
mortgage/mortgage.py
roelbertens/mortgages
1
15443
from typing import List import matplotlib.pyplot as plt class Mortgage: """ A mortgage overview of the total burden (incl. interest) and the monthly fees per fixed period """ def __init__(self, mortgage_amount, burden, periods, monthly_fees, name): self.mortgage_amount = int(mortgage_amount)...
3.609375
4
training/wml_train.py
corvy/MAX-Object-Detector
1
15444
#!/usr/bin/env python # # Copyright 2018-2019 IBM Corp. 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 requ...
1.867188
2
tests/unit/sim_client/__init__.py
rkm/bluebird
8
15445
<filename>tests/unit/sim_client/__init__.py """ Module contains tests for the sim_client package """
1.132813
1
glog.py
leoll2/python-glog
0
15446
"""A simple Google-style logging wrapper.""" import logging import time import traceback import os import sys import gflags as flags FLAGS = flags.FLAGS def format_message(record): try: record_message = "%s" % (record.msg % record.args) except TypeError: record_message = record.msg retu...
2.921875
3
ref_rna.py
entn-at/warp-rna
39
15447
<reponame>entn-at/warp-rna<filename>ref_rna.py """ Python reference implementation of the Recurrent Neural Aligner. Author: <NAME> Based on the papers: - "Recurrent Neural Aligner: An Encoder-Decoder Neural Network Model for Sequence to Sequence Mapping" <NAME>, et al., 2017 - "Extending Recurrent Neural Align...
2.53125
3
tests/coretests.py
thomasms/coiny
0
15448
import unittest from typing import Any from coiny.core import CoinPrice, CoinyQueue, CoinySession, price_now_url, price_task from coiny.utils import NullCoinPrice class HasJson: def __init__(self, data) -> None: self.data = data async def __aenter__(self): return self async def __aexit_...
2.71875
3
legacy/dx/simulator/simulator_diagnoser/test/graph/traversal/forward_test.py
GaloisInc/adapt
2
15449
<gh_stars>1-10 import unittest from simulator_diagnoser.graph import InmemoryGraph from simulator_diagnoser.graph.traversal import ForwardAnalysis class ForwardAnalysisTest(unittest.TestCase): def setUp(self): # Graph = # 9 # / | \ # 6 7 8 # \ / \ / # ...
2.703125
3
SONOS/sonos-fadein-alarm.py
tksunw/IoT
1
15450
<reponame>tksunw/IoT #!/usr/bin/python # -*- coding: utf-8 -*- ''' sonos-fadein-alarm.py - a gentle alarm using Sonos Favorites. This module allows a user to choose a SONOS favorite channel to play for a gentle alarm. Select the maximum desired volume, the number of minutes over which to ramp volume from 0 to the chos...
3.078125
3
Agent5_a_0_5_knots_512_d_0_02/step_node_Agent6_rewards.py
schigeru/Bachelorarbeit_Code
0
15451
#!/usr/bin/env python import math import os import numpy as np import time import sys import copy import rospy import moveit_msgs.msg import geometry_msgs.msg import random import csv from sensor_msgs.msg import JointState from gazebo_msgs.msg import LinkStates from gazebo_msgs.msg import LinkState from std_msgs.msg i...
2.390625
2
pwnlib/elf/corefile.py
jdsecurity/binjitsu
5
15452
<reponame>jdsecurity/binjitsu<filename>pwnlib/elf/corefile.py import collections import ctypes import elftools from elftools.common.utils import roundup, struct_parse from elftools.common.py3compat import bytes2str from elftools.construct import CString from ..context import context from ..log import getLogger from ....
2.09375
2
kNN.py
skywind3000/ml
9
15453
<filename>kNN.py from __future__ import print_function import numpy as np import operator import os import sys if sys.version_info[0] >= 3: xrange = range def createDataSet(): group = np.array([[1.0,1.1], [1.0,1.0], [0,0], [0,0.1]]) labels = ['A', 'A', 'B', 'B'] return group, labels # k...
2.859375
3
simfin/revenue/personal_taxes.py
CREEi-models/simfin
1
15454
<filename>simfin/revenue/personal_taxes.py from simfin.tools import account class personal_taxes(account): ''' Classe permettant d'intégrer l'impôt des particuliers. ''' def set_align(self,pop,eco): earnings = pop.multiply(eco['emp']*eco['earn_c']+eco['taxinc'],fill_value=0.0) value =...
2.546875
3
pandaserver/brokerage/PandaSiteIDs.py
rybkine/panda-server
1
15455
<reponame>rybkine/panda-server # !!!!!!! This file is OBSOLETE. Its content has been absorbed into pilotController.py in the autopilot repository. # !!!!!!! Questions to <NAME>. PandaSiteIDs = { 'AGLT2' : {'nickname':'AGLT2-condor','status':'OK'}, 'ALBERTA-LCG2' : {'nickname':'ALBERTA...
1.460938
1
tools/scenario-player/scenario_player/exceptions.py
karlb/raiden
8
15456
<reponame>karlb/raiden class ScenarioError(Exception): pass class ScenarioTxError(ScenarioError): pass class TokenRegistrationError(ScenarioTxError): pass class ChannelError(ScenarioError): pass class TransferFailed(ScenarioError): pass class NodesUnreachableError(ScenarioError): pass ...
1.617188
2
explain.py
jcsalterego/gh-contest
1
15457
#!/usr/bin/env python from pprint import pprint from matchmaker.database import * import sys def main(argv): if len(argv) == 1: return line = argv[1] if line[0] in '+-': line = line[1:] user, repos = line.split(":") user = int(user) repos = [int(r) for r in repos.split(",")] ...
2.453125
2
qiskit/pulse/commands/command.py
EnriqueL8/qiskit-terra
2
15458
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
2.484375
2
data_loader/data_loaders.py
brendanwallison/birds
0
15459
<filename>data_loader/data_loaders.py from torchvision import datasets, transforms from torchvision.transforms import functional as TF from base import BaseDataLoader from six.moves import urllib from parse_config import ConfigParser # downloads import requests import json from collections import Counter import os im...
2.234375
2
stockscanner/model/portfolio/portfolio.py
adityazagade/StockScanner
0
15460
<gh_stars>0 from datetime import date from typing import List from stockscanner.model.asset.asset_type import AssetType from stockscanner.model.exceptions.exceptions import AssetNotFoundException from stockscanner.model.asset.asset import Asset from stockscanner.model.asset.cash import Cash from stockscanner.model.ass...
2.5
2
python/zdl/error_logger/error_logger/url_rules/report.py
wjiec/packages
0
15461
#!/usr/bin/env python # # Copyright (C) 2017 import json import time from error_logger.url_rules import _base_url_rule # from error_logger.net import sms_notification, email_notification from error_logger.utils import generic class Report(_base_url_rule.BaseUrlRule): __url__ = '/report' __methods__ = ['POST...
2.21875
2
cli/commands/update.py
gamesbrainiac/cli
0
15462
<gh_stars>0 # -*- coding: utf-8 -*- import click from .. import cli @cli.cli.command(hidden=True) def update(): """ Look for new version updates to CLI """ # TODO create update command click.echo('Sorry, command not programmed yet.')
2.046875
2
test/test_sl/test_model/test_data.py
jlaumonier/mlsurvey
0
15463
import unittest import numpy as np import pandas as pd import mlsurvey as mls class TestData(unittest.TestCase): def test_to_dict_dict_should_be_set(self): """ :test : mlsurvey.model.Data.to_dict() :condition : x,y, y_pred data are filled. :main_result : the dictionary generated...
3.1875
3
baidu_verify_response.py
CodingDogzxg/Verifycode_ocr
0
15464
# encoding:utf-8 import requests import base64 import time ''' 通用文字识别 ''' request_url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic" access_token = '' # 百度AI的token access 详情请去看文档 request_url = request_url + "?access_token=" + access_token headers = {'content-type': 'application/x-www-form-urlencoded'} f...
2.890625
3
nets/efficientdet_training.py
BikesSaver/efficientdet-pytorch
1
15465
from random import shuffle import numpy as np import torch import torch.nn as nn import math import torch.nn.functional as F import cv2 from matplotlib.colors import rgb_to_hsv, hsv_to_rgb from PIL import Image from .RepulsionLoss.my_repulsion_loss import repulsion def preprocess_input(image): image /= 255 ...
2.25
2
project/wsgi.py
devluci/django-rest-base-boilerplate
0
15466
import os from django.core.wsgi import get_wsgi_application from rest_base.utils import dotenv os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') dotenv.load(os.path.join(os.path.dirname(__file__), '../.env')) application = get_wsgi_application()
1.382813
1
tests/test_coco_dataset.py
petersiemen/CVND---Image-Captioning-Project
0
15467
from .context import CoCoDataset import os from torchvision import transforms import torch.utils.data as data from src.data_loader import get_loader from context import COCO_SMALL from context import clean_sentence def test_coco_dataset(): transform_train = transforms.Compose([ transforms.Resize(256), # ...
2.609375
3
test/retro-fuse-test.py
jaylogue/retro-fuse
28
15468
#!/usr/bin/env python3 # # Copyright 2021 <NAME> # # 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...
2.1875
2
docker/app.py
dramasamy/kubernetes_training
1
15469
<filename>docker/app.py #! /bin/python from flask import Flask app = Flask(__name__) @app.route('/') def hello(): return "Hello World! - v1" @app.route('/<name>') def hello_name(name): return "Hello {}! - v1".format(name) @app.route('/audio') def audio(): return "Audio - v1" @app.route('/video') def...
2.375
2
creme/cluster/k_means.py
tweakyllama/creme
0
15470
<filename>creme/cluster/k_means.py import collections import numpy as np from sklearn import utils from .. import base __all__ = ['KMeans'] def euclidean_distance(a, b): return sum((a.get(k, 0) - b.get(k, 0)) ** 2 for k in set([*a.keys(), *b.keys()])) class KMeans(base.Clusterer): """Incremental k-means...
3.703125
4
fasttrips/TAZ.py
pedrocamargo/fast-trips
3
15471
<gh_stars>1-10 from __future__ import print_function from __future__ import division from builtins import str from builtins import object __copyright__ = "Copyright 2015 Contributing Entities" __license__ = """ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in ...
2.296875
2
tests/test_stardist2D.py
ianbgroves/stardist
1
15472
import numpy as np from stardist import star_dist, relabel_image_stardist import pytest from utils import random_image, real_image2d, check_similar, circle_image @pytest.mark.parametrize('img', (real_image2d()[1], random_image((128, 123)))) @pytest.mark.parametrize('n_rays', (4, 16, 32)) def test_types(img, n_rays): ...
2.3125
2
all_call/infer_new.py
jbudis/dante
4
15473
import math import functools from scipy.stats import binom import numpy as np import itertools import sys import matplotlib.pyplot as plt import matplotlib.patheffects as PathEffects from copy import copy def combine_distribs(deletes, inserts): """ Combine insert and delete models/distributions :param de...
2.734375
3
createbag.py
axfelix/moveit
0
15474
""" GUI tool to create a Bag from a filesystem folder. """ import sys import os import shutil import bagit import platform import random import string import re from time import strftime import subprocess from paramiko import SSHClient from paramiko import AutoAddPolicy from paramiko import AuthenticationException fro...
2.765625
3
code/python-neo/neo/core/basesignal.py
qniksefat/macaque_brain_causality_test
0
15475
<reponame>qniksefat/macaque_brain_causality_test<filename>code/python-neo/neo/core/basesignal.py<gh_stars>0 # -*- coding: utf-8 -*- ''' This module implements :class:`BaseSignal`, an array of signals. This is a parent class from which all signal objects inherit: :class:`AnalogSignal` and :class:`IrregularlySampledS...
1.992188
2
Morocco model/scripts/cropland_processing.py
KTH-dESA/FAO
3
15476
import sys sys.path.append("..") #this is to add the avobe folder to the package directory import geopandas as gpd import pandas as pd import numpy as np import os from nexustool.gis_tools import download_data, create_time_data, get_area_share, get_zonal_stats from nexustool.weap_tools import reproject_raster, sample_r...
2
2
dl_data_validation_toolset/framework/report_gen/group.py
kwierman/dl_data_validation_toolset
1
15477
<reponame>kwierman/dl_data_validation_toolset from .file import FileGenerator from ..report.group import GroupReport import logging import asyncio import os class GroupGenerator(object): logger = logging.getLogger("ddvt.rep_gen.grp") def __init__(self, group): self.meta = group async def generate(self, pa...
2.015625
2
glanceclient/common/exceptions.py
citrix-openstack-build/python-glanceclient
1
15478
# This is here for compatability purposes. Once all known OpenStack clients # are updated to use glanceclient.exc, this file should be removed from glanceclient.exc import *
0.898438
1
api/scpca_portal/views/filter_options.py
AlexsLemonade/scpca-portal
0
15479
<filename>api/scpca_portal/views/filter_options.py from django.http import JsonResponse from rest_framework import status, viewsets from scpca_portal.models import Project class FilterOptionsViewSet(viewsets.ViewSet): def list(self, request): dicts = ( Project.objects.order_by() ....
2.34375
2
cords/selectionstrategies/SL/__init__.py
krishnatejakk/AUTOMATA
0
15480
<filename>cords/selectionstrategies/SL/__init__.py from .craigstrategy import CRAIGStrategy from .dataselectionstrategy import DataSelectionStrategy from .glisterstrategy import GLISTERStrategy from .randomstrategy import RandomStrategy from .submodularselectionstrategy import SubmodularSelectionStrategy from .gradmatc...
1.148438
1
pycost/rocch.py
tfawcett/pycost
1
15481
""" Metrics to calculate and manipulate the ROC Convex Hull on a classification task given scores. """ # Author: <NAME> <<EMAIL>> from collections import namedtuple from math import sqrt from typing import List, Dict, Tuple, Union # DESCRIPTION: # # This program computes the convex hull of a set of ROC points # (t...
3.5
4
all_raspi_code_backup/DriveTesting.py
lord-pradhan/SnowBot
2
15482
<reponame>lord-pradhan/SnowBot<gh_stars>1-10 """ Program: DriveTesting.py Revised On: 12/01/2019 """ ### Library Imports from DriveArduino import DriveArduino import numpy as np from time import sleep from sys import exit from signal import signal, SIGINT ### ### CTRL + C Signal Handler & Resource Cleanup def s...
2.65625
3
src/sentry/utils/strings.py
rogerhu/sentry
1
15483
def truncatechars(value, arg): """ Truncates a string after a certain number of chars. Argument: Number of chars to truncate after. """ try: length = int(arg) except ValueError: # Invalid literal for int(). return value # Fail silently. if len(value) > length: retu...
4.09375
4
setup.py
Ozencb/cli-pto
6
15484
import os import re from setuptools import find_packages, setup def get_version(package): path = os.path.join(os.path.dirname(__file__), package, "__init__.py") with open(path, "rb") as f: init_py = f.read().decode("utf-8") return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) ...
1.90625
2
users/models.py
scoremaza/church_alive_backend
0
15485
<filename>users/models.py import os import uuid from django.db import models from django.contrib.auth.models import User from django.db.models.base import Model from django.db.models.enums import Choices, ChoicesMeta from django.db.models.fields.related import ForeignKey from django.utils.deconstruct import deconstruct...
2.59375
3
format_errors.py
drupchen/correct-ewts
0
15486
<reponame>drupchen/correct-ewts import re from collections import defaultdict with open('input/errors-ewts.csv') as f: raw = f.read() #raw = raw.replace('`not expected', '` not expected') lines = raw.split('\n') data = [] for line in lines: columns = re.split(r'(?:^"|","|",,"|"$)', line) msgs = [a ...
2.875
3
exercise-django/user/views.py
theseana/goodfellas
0
15487
from django.shortcuts import render # Create your views here. from user.forms import UserForm def register(request): form = UserForm() if request.method == 'POST': form = UserForm(request.POST) if form.is_valid(): form.save() return render(request, 'user/registeration/register...
2.109375
2
shark/example/env/catch_ball_env.py
7starsea/shark
0
15488
<gh_stars>0 # -*- coding: utf-8 -*- import numpy as np import PIL import torch import torchvision.transforms as TF from types import SimpleNamespace from gym import spaces, Env from .SharkExampleEnv import CatchBallSimulate # internal_screen_h, internal_screen_w = 80, 140 class CatchBallEnvBase(Env): metadata ...
2.4375
2
examples/launch_tor_with_simplehttpd.py
kneufeld/txtorcon
0
15489
<filename>examples/launch_tor_with_simplehttpd.py #!/usr/bin/env python # -*- coding: utf-8 -*- '''Create a new tor node and add a simple http server to it, serving a given directory over http. The server is single-threaded and very limited. There are two arguments that can be passed via the commandline: -p\tThe i...
3.078125
3
homeroom/wsgi.py
openshift-labs/workshop-homeroom
14
15490
<reponame>openshift-labs/workshop-homeroom<filename>homeroom/wsgi.py import os import json import threading import time import yaml from flask import Flask from flask import render_template from kubernetes.client.rest import ApiException from kubernetes.client.configuration import Configuration from kubernetes.confi...
1.84375
2
rever/__init__.py
limecrayon/rever
2
15491
<reponame>limecrayon/rever<filename>rever/__init__.py import functools import time __all__ = ('ReachedMaxRetries', 'rever') class ReachedMaxRetries(Exception): def __init__(self, func): Exception.__init__(self, "Function {} raised exception due to max number of retries performed".format(func)) se...
2.796875
3
gui(12102018).py
hanhydro/T2H
0
15492
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'gui.ui' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! import os from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets imp...
1.90625
2
py/loadpage.py
katiehuang1221/onl_ds5_project_2
0
15493
<filename>py/loadpage.py from bs4 import BeautifulSoup import requests from IPython.core.display import display, HTML def get_soup(url): response = requests.get(url) page = response.text soup = BeautifulSoup(page, "lxml") return soup
2.984375
3
hard-gists/5409581/snippet.py
jjhenkel/dockerizeme
21
15494
<filename>hard-gists/5409581/snippet.py ''' rename_selected_relation_box.py Written by <NAME> (<EMAIL>) When executed, attempts to locate any selected box within any relation constraint in the scene. If a selected relation box is found, prompts the user to enter a new name for that box. Allows relation boxes to be giv...
2.546875
3
osu_scene_switcher.py
FunOrange/osu-scene-switcher
4
15495
<gh_stars>1-10 import os import time import obspython as obs initial_load = False status_file = '' idle_scene = '' playing_scene = '' def undb(db): return pow(10, db/20) def script_description(): return 'Automatically switch scenes upon entering osu! gameplay.\n\n' \ 'See github page for setup in...
2.421875
2
donkey_gym/envs/donkey_env.py
mint26/donkey_gym
5
15496
''' file: donkey_env.py author: <NAME> date: 2018-08-31 ''' import os from threading import Thread import numpy as np import gym from gym import error, spaces, utils from gym.utils import seeding from donkey_gym.envs.donkey_sim import DonkeyUnitySimContoller from donkey_gym.envs.donkey_proc import DonkeyU...
2.421875
2
tests/unit/backend/corpora/common/entities/datasets/test_revision.py
chanzuckerberg/dcp-prototype
2
15497
from tests.unit.backend.corpora.common.entities.datasets import TestDataset class TestDatasetRevision(TestDataset): def test__create_dataset_revision(self): dataset = self.generate_dataset_with_s3_resources(self.session, published=True) rev_dataset = dataset.create_revision("test_collection_id_rev...
2.25
2
main.py
parzibyte/login-flask
2
15498
""" ____ _____ _ _ _ | _ \ | __ \ (_) | | | | |_) |_ _ | |__) |_ _ _ __ _____| |__ _ _| |_ ___ | _ <| | | | | ___/ _` | '__|_ / | '_ \| | | | __/ _ \ | |_) | |_| | | | | (_| | | / /| | |_) | |_| | || __/ |____/ \__, | |_| ...
2.609375
3
events/kawacon2016/migrations/0003_auto_20160127_1924.py
jlaunonen/turska
0
15499
<gh_stars>0 # -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-01-27 17:24 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('kawacon2016', '0002_auto_20160127_1922'), ] operations = [ migra...
1.398438
1