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
Lesson5/srez.py
shinkai-tester/python_beginner
2
30700
<filename>Lesson5/srez.py a = [1, 2, 3, 4, 5] b = a[:3] print(b) print(a)
3.296875
3
regularize_charsets.py
sys-bio/temp-biomodels
0
30701
<reponame>sys-bio/temp-biomodels from charset_normalizer import from_path, normalize results = from_path('original\BIOMD0000000424\BIOMD0000000424_url.xml') best = str(results.best()) normalize('original\BIOMD0000000424\BIOMD0000000424_url.xml')
1.679688
2
accounts/forms.py
GDGSNF/My-Business
21
30702
<filename>accounts/forms.py import datetime import re from configparser import ConfigParser from smtplib import SMTPException from django import forms from django.conf import settings from django.contrib.auth import authenticate, login from django.contrib.auth.tokens import default_token_generator from django.core.mai...
2.4375
2
tests/st/model_zoo_tests/DeepFM/test_deepfm.py
HappyKL/mindspore
1
30703
<reponame>HappyKL/mindspore<filename>tests/st/model_zoo_tests/DeepFM/test_deepfm.py # Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://ww...
1.75
2
meterer/s3.py
dacut/meterer
0
30704
<gh_stars>0 #!/usr/bin/env python3.6 # pylint: disable=C0103 """ Metering client for S3. """ from .client import Meterer class S3Meterer(Meterer): """ Meter an S3 bucket. """ s3_url_prefix = "s3://" def __init__(self, cache, boto_session=None, cloudwatch_namespace=None): """ S3Met...
2.25
2
Python/3 kyu/Calculator/test_evaluate.py
newtonsspawn/codewars_challenges
3
30705
from unittest import TestCase from evaluate import Calculator calc = Calculator() class TestCalculator(TestCase): def test_evaluate_01(self): self.assertEqual(calc.evaluate(string='127'), 127) def test_evaluate_02(self): self.assertEqual(calc.evaluate(string='2 + 3'), 5) d...
3.671875
4
gfapy/line/__init__.py
ujjwalsh/gfapy
44
30706
<gh_stars>10-100 from .comment import Comment from .line import Line from .unknown import Unknown from .edge import Edge from .gap import Gap from .custom_record import CustomRecord from .fragment import Fragment from .header import Header from .segment import Segment from . import group
1.039063
1
preprocessing/parsing.py
bradhackinen/frdocs
0
30707
import os import lxml.etree as et import pandas as pd import numpy as np import regex as re def get_element_text(element): """ Extract text while -skipping footnote numbers -Adding a space before and after emphasized text """ head = element.text if element.tag != 'SU' else '' child = ' '....
2.859375
3
src/stopwords/create_stopword_list.py
prrao87/topic-modelling
3
30708
""" Script to generate a custom list of stopwords that extend upon existing lists. """ import json import spacy from urllib.request import urlopen from itertools import chain def combine(*lists): "Combine an arbitrary number of lists into a single list" return list(chain(*lists)) def get_spacy_lemmas(): ...
3.453125
3
main.py
carl-andersson/impest
0
30709
<filename>main.py ''' @author: <NAME> ''' import sys import numpy as np import tensorflow as tf import processdata import time import scipy.io # Preformfs a custom matrix multiplication for all matrices in a batch def batchMatMul(x: tf.Tensor, y: tf.Tensor, scope="batchMatMul"): return tf.map_fn(lambda inx: t...
3.015625
3
setup.py
Lzejie/DynamicPool
1
30710
# -*- coding: utf-8 -*- # @Time : 18/12/10 上午10:27 # @Author : L_zejie # @Site : # @File : setup.py.py # @Software: PyCharm Community Edition from setuptools import setup, find_packages setup( name="DynamicPool", packages=find_packages(), version='0.14', description="动态任务阻塞线程/进程池", autho...
1.1875
1
testsuite/test_singly_linked_list.py
trycatchhorn/PyAlgDat
0
30711
#!/usr/bin/env py.test """ Test SinglyLinkedList class. """ import copy import unittest from py_alg_dat import singly_linked_list class TestSinglyLinkedList(unittest.TestCase): """ Test SinglyLinkedList class. """ def setUp(self): self.list1 = singly_linked_list.SinglyLinkedList() ...
3.640625
4
package/awesome_panel/application/services/message_service.py
Jhsmit/awesome-panel
179
30712
"""This module implements the MessageService The MessageService enables sending and receiving messages """ import param class MessageService(param.Parameterized): """The MessageService enables sending and receiving messages"""
2.21875
2
BitMEXAPIKeyAuthenticator.py
SaarasM/trading-algos
0
30713
import urllib.parse import time import hashlib import hmac from bravado.requests_client import Authenticator class APIKeyAuthenticator(Authenticator): """?api_key authenticator. This authenticator adds BitMEX API key support via header. :param host: Host to authenticate for. :param api_key: API key. ...
2.75
3
herokuapp/project_template/manage.py
urkonn/django-herokuapp
262
30714
<filename>herokuapp/project_template/manage.py #!/usr/bin/env python import os import sys if __name__ == "__main__": # Load the Heroku environment. from herokuapp.env import load_env load_env(__file__, "{{ app_name }}") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings"...
1.84375
2
packages/indextools/tests/test_cases/test_primes.py
zhihanyang2022/drqn
5
30715
<filename>packages/indextools/tests/test_cases/test_primes.py import unittest import indextools def is_prime(n): return n > 1 and all(n % i != 0 for i in range(2, n)) class PrimeTest(unittest.TestCase): def test_primes(self): int_space = indextools.RangeSpace(50) prime_space = indextools.Su...
3.421875
3
lascli/parser/users.py
LucidtechAI/las-cli
0
30716
<filename>lascli/parser/users.py import base64 import pathlib from las import Client from lascli.util import nullable, NotProvided def encode_avatar(avatar): return base64.b64encode(pathlib.Path(avatar).read_bytes()).decode() def list_users(las_client: Client, max_results, next_token): return las_client.l...
2.3125
2
labs/tony-monday-15-jg103/hello_hello.py
TonyJenkins/lbu-python-code
2
30717
#!/usr/bin/env python3 def hello(**kwargs): print(f'Hello') if __name__ == '__main__': hello(hello())
2.125
2
example/example/handlers.py
comynli/m
11
30718
from .models import db, User from m import Router from m.utils import jsonify router = Router(prefix='') @router.route('/', methods=['POST']) def home(ctx, request): name = request.json().get('name') user = User(name=name) db.session.add(user) try: db.session.commit() except Exception as ...
2.53125
3
scripts/touchup_for_web.py
BennZoll/roboto
3,933
30719
<reponame>BennZoll/roboto<gh_stars>1000+ #!/usr/bin/python # # Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/li...
2.15625
2
fact/looping2d.py
BicycleWalrus/slop
0
30720
<reponame>BicycleWalrus/slop #!/usr/bin/env python3 with open("dnsservers.txt", "r") as dnsfile: for svr in dnsfile: svr = svr.rstrip('\n') if svr.endswith('org'): with open("org-domain.txt", "a") as srvfile: srvfile.write(svr + "\n") elif svr.endswith('com'): ...
2.296875
2
src/controller/tower_controller.py
DockerTower/Tower
1
30721
<reponame>DockerTower/Tower from cement.core.controller import CementBaseController, expose class TowerController(CementBaseController): class Meta: label = 'base' stacked_on = 'base' stacked_type = 'nested' description = "Tower" @expose(hide=True) def default(self): ...
2.265625
2
download.py
reed-hackathon-2022/mc-bot
1
30722
<gh_stars>1-10 import io from google.oauth2.credentials import Credentials from googleapiclient.discovery import build from googleapiclient.http import MediaIoBaseDownload from google.oauth2 import service_account from oauth2client.service_account import ServiceAccountCredentials SCOPES = ['https://www.googleapis.com...
2.6875
3
lumbermill/output/Zabbix.py
dstore-dbap/LumberMill
15
30723
# -*- coding: utf-8 -*- import os import sys from pyzabbix import ZabbixMetric, ZabbixSender from lumbermill.BaseThreadedModule import BaseThreadedModule from lumbermill.utils.Buffers import Buffer from lumbermill.utils.Decorators import ModuleDocstringParser from lumbermill.utils.DynamicValues import mapDynamicValue ...
2.15625
2
communicate.py
IloveKanade/k3cgrouparch
0
30724
<filename>communicate.py #!/usr/bin/env python2 # coding: utf-8 import logging from collections import OrderedDict from geventwebsocket import Resource from geventwebsocket import WebSocketApplication from geventwebsocket import WebSocketServer import k3utfjson from k3cgrouparch import account global_value = {} lo...
2.03125
2
example/BEC.py
zhaofeng-shu33/ace_cream
6
30725
#!/usr/bin/python #author: zhaofeng-shu33 import numpy as np from ace_cream import ace_cream def pearson_correlation(X,Y): return (np.mean(X*Y, axis=0) -np.mean(X, axis = 0)* np.mean(Y, axis = 0)) / ( np.std(X, axis = 0) * np.std(Y, axis = 0)) if __name__ == '__main__': N_SIZE = 1000 ERROR_PROBABILITY = ...
3.09375
3
src/main.py
snaka0213/dot_converter
0
30726
<filename>src/main.py #!/usr/bin/env python3 import sys from converter import DotConverter filter_size = int(input("Filter size? >> ")) colors = int(input("Number of colors? >> ")) dtcv = DotConverter(filter_size=filter_size, colors=colors) path = input("File name? >> ") dtcv.load(path) dtcv.convert() dtcv.show() se...
3.484375
3
mahiru/rest/internal_client.py
SecConNet/proof_of_concept
4
30727
<reponame>SecConNet/proof_of_concept<filename>mahiru/rest/internal_client.py """Client for internal REST APIs.""" from copy import copy from pathlib import Path from urllib.parse import quote, urlparse import time import requests from mahiru.definitions.assets import Asset from mahiru.definitions.execution import Job...
2.265625
2
image_dataset.py
samlaf/self-ensemble-visual-domain-adapt-photo
76
30728
<reponame>samlaf/self-ensemble-visual-domain-adapt-photo import numpy as np import cv2 from sklearn.model_selection import StratifiedShuffleSplit, ShuffleSplit class ImageDataset (object): class ImageAccessor (object): def __init__(self, dataset): self.dataset = dataset def __len__(se...
2.75
3
tests/test_losses_config.py
blazejdolicki/vissl
2,512
30729
<reponame>blazejdolicki/vissl # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import unittest from collections import namedtuple from classy_vision.generic.distributed_util im...
1.835938
2
LossAug/OpticalFlowLoss.py
gexahedron/pytti
0
30730
<reponame>gexahedron/pytti from pytti.LossAug import MSELoss, LatentLoss import sys, os, gc import argparse import os import cv2 import glob import math, copy import numpy as np import torch from torch import nn from torch.nn import functional as F from PIL import Image import imageio import matplotlib.pyp...
1.882813
2
apps/track/migrations/0022_auto_20210319_1551.py
martinlehoux/django_bike
1
30731
# Generated by Django 3.1.7 on 2021-03-19 15:51 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("track", "0021_auto_20200915_1528"), ] operations = [ migrations.RemoveField( model_name="track", name="parser", ), ...
1.359375
1
solutions/404_sum_of_left_leaves.py
YiqunPeng/leetcode_pro
0
30732
class Solution: def sumOfLeftLeaves(self, root: TreeNode) -> int: if not root: return 0 res = 0 q = deque([root]) while q: node = q.popleft() if node.left: if not node.left.left and not node.left.right: res += no...
2.765625
3
dev_code/color_kmeans_vis.py
Computational-Plant-Science/plant_image_analysis
3
30733
''' Name: color_segmentation.py Version: 1.0 Summary: Extract plant traits (leaf area, width, height, ) by paralell processing Author: <NAME> Author-email: <EMAIL> Created: 2018-09-29 USAGE: python3 color_kmeans_vis.py -p /home/suxingliu/plant-image-analysis/sample_test/ -i 01.jpg -m 01_seg.jpg -c 5 ''' ...
2.65625
3
results/results_eval.py
eym55/power_grid_sim
1
30734
import pandas as pd import matplotlib.pyplot as plt import pickle df = pd.read_json('result.json',lines=True) print(df)
3.0625
3
fabfile/validation.py
b-cube/Response-Identification-Info
0
30735
<filename>fabfile/validation.py<gh_stars>0 # to run the metadata validation process via some ec2 and an rds connection
1.039063
1
papers_clf/tfidf_2_sentence.py
KellyShao/Writing-robots-vs.-Human
4
30736
<gh_stars>1-10 import csv import math import pandas as pd import numpy as np from sklearn import svm from sklearn.cross_validation import train_test_split from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction import text from sklearn import metrics from sklearn.metrics im...
2.734375
3
chat_manager_api/categories/account.py
lordralinc/chat_manager_api
0
30737
from chat_manager_api.categories.base import BaseAPICategory from chat_manager_api.models import account class AccountAPICategory(BaseAPICategory): def get_web_hook_info(self) -> account.GetWebHookInfo: return self.api.make_request("account.getWebHookInfo", dataclass=account.GetWebHookInfo) async de...
2.234375
2
apps/health/views.py
dtisza1/bluebutton-web-server
0
30738
import logging from django.core.exceptions import ImproperlyConfigured from rest_framework.exceptions import APIException from rest_framework.views import APIView from rest_framework.response import Response from .checks import ( internal_services, external_services, ) logger = logging.getLogger('hhs_server.%s...
2.328125
2
tripleohelper/ovb_baremetal.py
redhat-openstack/python-tripleo-helper
2
30739
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2016 Red Hat, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
1.734375
2
main.py
soup-bowl/lu-jubilee-btn
0
30740
from machine import Pin import time from led import LED tube_btn = Pin(21, Pin.IN, Pin.PULL_UP) sys_led = Pin(25, Pin.OUT) print('Blinking LED to power check (no LED? Check LED batteries and/or script).') LED.led_blink(5) print('Blink code finish - Listening for presses.') while True: first = tube_btn.value() ...
3.5
4
trampolino/workflows/dsi_trk.py
matteomancini/trampolino
3
30741
from nipype.interfaces import utility as util from nipype.pipeline import engine as pe from .interfaces import dsi_studio as dsi import nipype.interfaces.diffusion_toolkit as dtk from nipype.algorithms.misc import Gunzip import os.path def create_pipeline(name="dsi_track", opt="", ensemble=""): parameters = {'nos...
2.109375
2
sponge-examples-projects/sponge-examples-project-spring-boot/sponge/remote_api_security.py
mnpas/sponge
9
30742
""" Sponge Knowledge Base Remote API security """ def configureAccessService(): # Configure the RoleBasedAccessService. # Simple access configuration: role -> knowledge base names regexps. remoteApiServer.accessService.addRolesToKb({ "ROLE_ADMIN":[".*"], "ROLE_ANONYMOUS":["boot", "python"]}) # Simple...
2.3125
2
ConsecutiveCharacters.py
vanigupta20024/Programming-Challenges
14
30743
<filename>ConsecutiveCharacters.py ''' Given a string s, the power of the string is the maximum length of a non-empty substring that contains only one unique character. Return the power of the string. Example 1: Input: s = "leetcode" Output: 2 Explanation: The substring "ee" is of length 2 with the character 'e' only...
4.21875
4
tests/ocr/test_suggestion_medication_administration.py
lifeomic/phc-sdk-py
1
30744
import pandas as pd from phc.easy.ocr.suggestion import (expand_array_column, expand_medication_administrations, frame_for_type) sample = expand_array_column( pd.DataFrame( [ { "suggestions": [ ...
2.546875
3
spacing/json_load.py
Pixir/Pixir
0
30745
<gh_stars>0 import json from bs4 import BeautifulSoup import re for i in range(0, 39): with open(f'./KorQuAD/korquad2.1_train_{i}.json', 'r', encoding='utf-8') as f: js = json.load(f) texts = [] for i in range(len(js['data'])): text = js['data'][i]['raw_html'] soup = BeautifulSoup(text, 'html5lib'...
2.4375
2
auction/admin.py
AnthonyNicklin/newage-auctions
1
30746
from django.contrib import admin from .models import Auction, Lot, Bid class BidAdmin(admin.ModelAdmin): readonly_fields = ( 'user', 'auction', 'bid_amount', 'bid_time', ) admin.site.register(Auction) admin.site.register(Lot) admin.site.register(Bid, BidAdmin)
1.570313
2
scale/source/apps.py
kaydoh/scale
121
30747
<gh_stars>100-1000 """Defines the application configuration for the source application""" from __future__ import unicode_literals from django.apps import AppConfig class SourceConfig(AppConfig): """Configuration for the source app """ name = 'source' label = 'source' verbose_name = 'Source' ...
2.015625
2
aim/web/api/views.py
admariner/aim
1
30748
import os from aim.web.api.utils import APIRouter # wrapper for fastapi.APIRouter from fastapi.responses import FileResponse from aim.web.api.projects.project import Project general_router = APIRouter() @general_router.get('/static-files/{path:path}/') async def serve_static_files(path): from aim import web ...
2.3125
2
merceedge/core.py
merceedge/MerceEdge
6
30749
import threading import enum import os import sys import copy import json import asyncio import attr import uuid import functools import datetime import multiprocessing from time import monotonic import time import copy from collections import deque from concurrent.futures import ThreadPoolExecutor from async_timeout i...
1.710938
2
trinitee/manage.py
chaosk/trinitee
1
30750
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory" " containing %r. It appears you've customized things.\n" "You'll have to...
2.296875
2
src/storage.py
stivenramireza/images-resizer-app
0
30751
import os import sys import shutil import asyncio import aioboto3 from glob import glob from PIL import Image from fnmatch import fnmatch from src.secrets import ( SPACES_REGION, SPACES_BUCKET, SPACES_PREFIX, SPACES_ENDPOINT_URL, SPACES_ACCESS_KEY, SPACES_SECRET_KEY ) from src.format import (...
2.421875
2
sdbms/core/_parser.py
xSkyripper/simple-fs-dbms
0
30752
import re import operator from collections import namedtuple SCHEMA_TYPES = {'str', 'int', 'bool'} ROWID_KEY = '_rowid' class Literal(namedtuple('Literal', 'value')): @classmethod def eval_value(cls, value): if not isinstance(value, str): raise ValueError(f"Parameter {value} must be a str...
3.140625
3
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ipv4_telnet_mgmt_cfg.py
tkamata-test/ydk-py
0
30753
<reponame>tkamata-test/ydk-py """ Cisco_IOS_XR_ipv4_telnet_mgmt_cfg This module contains a collection of YANG definitions for Cisco IOS\-XR ipv4\-telnet\-mgmt package configuration. This module contains definitions for the following management objects\: telnet\: Global Telnet configuration commands Copyright (c) ...
1.835938
2
projects/solutions/sa/distance.py
vibbits/gentle-hands-on-python
0
30754
""" A module for calculating the relationship (or distance) between 2 strings. Namely: - edit_distance() - needleman_wunsch() - align() - coverage() """ from typing import Callable, Tuple, List from enum import IntEnum from operator import itemgetter from functools import lru_cache import unittest cl...
3.421875
3
indicator17.py
nkzhengwt/Spyder_cta
13
30755
# -*- coding: utf-8 -*- import pandas as pd import numpy as np import math import datetime import time import matplotlib.pyplot as plt import warnings warnings.filterwarnings("ignore") class Indicators(): def __init__(self, dataframe, params = []): self.dataframe = dataframe self.params = params ...
2.765625
3
colour/examples/io/examples_ies_tm2714.py
BPearlstine/colour
2
30756
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Showcases input / output *IES TM-27-14* spectral data XML files related examples. """ import os import colour from colour.utilities import message_box RESOURCES_DIRECTORY = os.path.join(os.path.dirname(__file__), 'resources') message_box('"IES TM-27-14" Spectral Data "XML"...
2.578125
3
ISA/Util/__init__.py
tumido/FIT-VUT-projects
0
30757
from .Announce import get_announce, announce_to_txt from .Torrent import get_torrent_file, parse_torrent_file from .Tracker import get_peerlist, save_peerlist
1.15625
1
python-sdk/odi/client/storage/s3.py
Project-OpenBytes/odi
5
30758
# Copyright 2021 The OpenBytes Team. 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 appl...
1.90625
2
Chapter14/c14_11_rainbow_callMaxOn2_viaSimulation.py
John-ye666/Python-for-Finance-Second-Edition
236
30759
""" Name : c14_11_rainbow_callMaxOn2_viaSimulation.py Book : Python for Finance (2nd ed.) Publisher: Packt Publishing Ltd. Author : <NAME> Date : 6/6/2017 email : <EMAIL> <EMAIL> """ import scipy as sp from scipy import zeros, sqrt, shape # sp.random.seed(123) # fix our ra...
3.1875
3
loudblog_just_for_git_purposes/yatraWebPageAutomation.py
hodlerfolyf/MobileSatyagraha_Backend_aws
2
30760
<filename>loudblog_just_for_git_purposes/yatraWebPageAutomation.py<gh_stars>1-10 from db_repo import * mydb=database_flaskr() rows=mydb.yatraWPA()
1.21875
1
python/constants.py
cbilstra/FATE
0
30761
import os from os.path import join INVESTIGATE = False # Records coverages and saves them. Generates a plot in the end. Do not use with automate. TEST_OUTSIDE_FUZZER = False # Runs FATE as standalone (1+1) EA BLACKBOX = True and TEST_OUTSIDE_FUZZER # Disables white-box information such as thresholds and feat imp. F...
1.875
2
tests/test_cli.py
sthagen/python-xmllint_map_html
0
30762
# -*- coding: utf-8 -*- # pylint: disable=missing-docstring,unused-import,reimported import io import json import pytest # type: ignore import xmllint_map_html.cli as cli import xmllint_map_html.xmllint_map_html as xmh def test_main_ok_minimal(capsys): job = [''] report_expected = '' assert cli.main(arg...
1.90625
2
mat3json.py
tienhaophung/poseval
0
30763
<gh_stars>0 import os # import json from scipy.io import loadmat import argparse import mat4py import h5py import json_tricks as json parser = argparse.ArgumentParser(description="Convert .mat to .json file") parser.add_argument("-ddir", "--data_dir", type=str, default="", help="Data directory of ....
2.78125
3
easy/calculate_distance.py
Amin-Abouee/code_eval
0
30764
<filename>easy/calculate_distance.py import sys import re import math with open(sys.argv[1]) as test_cases: for test in test_cases: t = re.findall("[+-]?\d+", test) nums = [int(x) for x in t] print int(math.sqrt((nums[0]-nums[2]) * (nums[0]-nums[2]) + (nums[1]-nums[3]) * (nums[1]-nums[3])))
3.296875
3
airflow_provider_kafka/operators/produce_to_topic.py
astronomer/airflow-provider-kafka
3
30765
<gh_stars>1-10 import logging from functools import partial from typing import Any, Callable, Dict, Optional, Sequence, Union from airflow.exceptions import AirflowException from airflow.models import BaseOperator from airflow_provider_kafka.hooks.producer import KafkaProducerHook from airflow_provider_kafka.shared_u...
2.40625
2
tests/models/boundary/test_is_boundary_concave_to_y.py
EderVs/Voronoi-Diagrams
3
30766
"""Test is_boundary_not_x_monotone method in WeightedPointBoundary.""" # Standard from typing import List, Any from random import randint # Models from voronoi_diagrams.models import ( WeightedSite, WeightedPointBisector, WeightedPointBoundary, ) # Math from decimal import Decimal class TestWeightedPoin...
2.90625
3
src/core/models/classsification.py
romanovacca/detectioncollection
0
30767
<gh_stars>0 import os import torchvision import torchvision.models as models from src.core.config import config class Model(): def __init__(self, model=None, classes=None, device=None): """ Initializes a model that is predefined or manually added. Most models are taked from Pytorch's torchvision....
3.125
3
flash/core/data/io/input_transform.py
ar90n/lightning-flash
0
30768
<reponame>ar90n/lightning-flash # Copyright The PyTorch Lightning team. # # 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 ...
1.804688
2
scripts/ranger/system_requests.py
scil/ansible-ambari-manager
10
30769
<reponame>scil/ansible-ambari-manager<gh_stars>1-10 #!/usr/bin/env python ''' 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 u...
1.890625
2
europython-2018/code/simple_bind/run.py
svenstaro/talks
5
30770
from europython import hello hello("Alisa")
1.15625
1
describe.py
Antip003/logistic_regression
0
30771
#!/usr/bin/env python3 import sys import csv import datetime import math from tabulate import tabulate import scipy.stats as st from tqdm import tqdm import numpy as np np.seterr(all='ignore') def isfloat(val): try: val = float(val) if math.isnan(val): return False return ...
2.59375
3
package.py
wolfogre/notify-github-release
1
30772
import os import shutil from modulefinder import ModuleFinder def main(): temp_dir = "package_temp" if os.path.exists(temp_dir): shutil.rmtree(temp_dir) os.makedirs(temp_dir) for py in ["index.py", "notifier.py"]: src, dst = py, os.path.join(temp_dir, py) print("copy '%s' to '...
2.453125
2
dataset_loaders/test/data_augmentation/_verify_flip_axis.py
dendisuhubdy/fc-drn
9
30773
import numpy as np def flip_axis(x_in, axis): x_out = np.zeros(x_in.shape, dtype=x_in.dtype) for i, x in enumerate(x_in): x = np.asarray(x).swapaxes(axis, 0) x = x[::-1, ...] x_out[i] = x.swapaxes(0, axis) return x_out def flip_axis_fra(x, flipping_axis): pattern = [flipping_...
2.984375
3
maya/Tests/joint_test.py
ryu-sw/alembic
921
30774
<reponame>ryu-sw/alembic ##-***************************************************************************** ## ## Copyright (c) 2009-2011, ## <NAME> Imageworks, Inc. and ## Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd. ## ## All rights reserved. ## ## Redistribution and use in source and ...
1.039063
1
airflow/contrib/hooks/gcp_pubsub_hook.py
diggzhang/airflow-dingit
6
30775
# -*- coding: utf-8 -*- # # 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 writing, software ...
2.09375
2
src/repositories/note.py
notalab/api
0
30776
""" Defines the Note repository """ import random import string import time import bcrypt from sqlalchemy.orm import load_only from werkzeug.exceptions import Forbidden, UnprocessableEntity from models import Note class NoteRepository: @staticmethod def create(user, notebook_id, title, content): ""...
2.59375
3
src/main/resources/pytz/zoneinfo/Africa/Ndjamena.py
TheEin/swagger-maven-plugin
65
30777
'''tzinfo timezone information for Africa/Ndjamena.''' from pytz.tzinfo import DstTzInfo from pytz.tzinfo import memorized_datetime as d from pytz.tzinfo import memorized_ttinfo as i class Ndjamena(DstTzInfo): '''Africa/Ndjamena timezone definition. See datetime.tzinfo for details''' zone = 'Africa/Ndjamena' ...
3.0625
3
code_analyzer/core.py
draihal/code_analyzer
0
30778
import logging import os import shutil import tempfile from git import Repo from .ast_analysis import _get_all_names, _get_all_func_names, _generate_trees from .ntlk_analysis import _get_verbs_from_function_name, _get_nouns_from_function_name from .utils import _get_count_most_common, _get_converted_names, _convert_t...
2.53125
3
sort_file.py
ask-santosh/Document-Matching
0
30779
<filename>sort_file.py import pandas as pd from fuzzywuzzy import process import Levenshtein as lev import numpy as np import openpyxl # -----------------------code for first csv file------------------------------------------- buyer_df = pd.read_csv("./results/CD_21_05/final2.csv", usecols=['PRODUCTS','UNITS', 'BATCHE...
2.984375
3
utils.py
mitchelljy/battleships_ai
8
30780
<reponame>mitchelljy/battleships_ai import numpy as np # Place a random ship on the given board of the given length, making sure it does not intersect # with anything in no_intersect def place_random_ship(board, length, no_intersect): placed = False while not placed: vertical = bool(np.random.randint(...
4.40625
4
assemblyline_ui/security/ldap_auth.py
CybercentreCanada/assemblyline-ui
11
30781
<reponame>CybercentreCanada/assemblyline-ui import base64 import hashlib import ldap import logging import time from assemblyline.common.str_utils import safe_str from assemblyline_ui.config import config, CLASSIFICATION from assemblyline_ui.helper.user import get_dynamic_classification from assemblyline_ui.http_excep...
2.046875
2
tangos/scripts/writer.py
TobiBu/tangos
15
30782
<gh_stars>10-100 #!/usr/bin/env python2.7 from __future__ import absolute_import import sys def run_dbwriter(argv): from tangos import parallel_tasks, core from tangos.tools.property_writer import PropertyWriter writer = PropertyWriter() writer.parse_command_line(argv) parallel_tasks.launch(writer...
2.453125
2
flask_app/models/pet.py
MapleLeo/PawFosterFamily
0
30783
from flask_app.config.mysqlconnection import connectToMySQL from flask import flash from base64 import b64encode class Pet: db = 'pawfosterfamily' def __init__(self,data): self.id = data['id'] self.img = data['img'] self.name = data['name'] self.age = data['age'] self.f...
2.921875
3
garecovery/mnemonic.py
LeoComandini/garecovery
61
30784
import wallycore as wally from . import exceptions from gaservices.utils import h2b wordlist_ = wally.bip39_get_wordlist('en') wordlist = [wally.bip39_get_word(wordlist_, i) for i in range(2048)] def seed_from_mnemonic(mnemonic_or_hex_seed): """Return seed, mnemonic given an input string mnemonic_or_hex_se...
2.75
3
notebooks/Computational Seismology/Summation-by-Parts/1d/rate.py
krischer/seismo_live_build
3
30785
def elastic_rate( hv, hs, v, s, rho, mu, nx, dx, order, t, y, r0, r1, tau0_1, tau0_2, tauN_1, tauN_2, type_0, forcing, ): # we compute rates that will be used for Runge-Kutta time-stepping # import first_derivative_sbp_operators ...
2.328125
2
probability_kernels.py
jessebmurray/polygenic
2
30786
<reponame>jessebmurray/polygenic import numpy as np import matplotlib.pyplot as plt import scipy.stats as st # Basic model functions def pdf(x_i, sigma_i=1, mu=0): """Returns the marginal (population) pdf of X_i ~ Normal(mu, sigma_i^2).""" return st.norm.pdf(x_i, scale=sigma_i, loc=mu) def stable_rs(r): ...
2.96875
3
main/part1/utils.py
YerbaPage/KnowledgeGraph
2
30787
<reponame>YerbaPage/KnowledgeGraph # coding: UTF-8 import torch from tqdm import tqdm import time from datetime import timedelta import torch.nn as nn from torch.autograd import Variable import numpy as np import torch.nn.functional as F PAD, CLS = '[PAD]', '[CLS]' # padding符号, bert中综合信息符号 class FocalLoss(nn.Module)...
2.5
2
tools/improve_8105.py
dophist/pinyin-data
823
30788
<reponame>dophist/pinyin-data # -*- coding: utf-8 -*- """补充 8105 中汉字的拼音数据""" from collections import namedtuple import re import sys from pyquery import PyQuery import requests re_pinyin = re.compile(r'拼音:(?P<pinyin>\S+) ') re_code = re.compile(r'统一码\w?:(?P<code>\S+) ') re_alternate = re.compile(r'异体字:\s+?(?P<alterna...
2.9375
3
src/olympia/blocklist/tests/test_cron.py
CSCD01/addons-server-team02
3
30789
import datetime import json import os from unittest import mock from django.conf import settings from django.core.files.storage import default_storage as storage from freezegun import freeze_time from waffle.testutils import override_switch from olympia.amo.tests import addon_factory, TestCase, user_factory from oly...
1.835938
2
PuLP/magic_sqare.py
yunzhang599/Python3_Package_Examples
1
30790
from pulp import * prob = LpProblem("PULPTEST", LpMinimize) # model variables XCOORD = [0, 1, 2] YCOORD = [0, 1, 2] NUMBERS = [1, 2, 3, 4, 5, 6, 7, 8, 9] # variable is a 3 x 3 x 9 matrix of binary values allocation = LpVariable.dicts("square", (XCOORD, YCOORD, NUMBERS), 0, 1, LpInteger) # target function prob += 0...
3.625
4
api/features/exceptions.py
SolidStateGroup/Bullet-Train-API
126
30791
from rest_framework import status from rest_framework.exceptions import APIException class FeatureStateVersionError(APIException): status_code = status.HTTP_400_BAD_REQUEST class FeatureStateVersionAlreadyExistsError(FeatureStateVersionError): status_code = status.HTTP_400_BAD_REQUEST def __init__(self...
2.34375
2
ai_economist/real_business_cycle/rbc/cuda_manager.py
tljstewart/ai-economist
1
30792
<reponame>tljstewart/ai-economist # Copyright (c) 2021, salesforce.com, inc. # All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # For full license text, see the LICENSE file in the repo root # or https://opensource.org/licenses/BSD-3-Clause import itertools import os import random from pathlib import Path ...
2.125
2
tests/test_transforms/test_encoders/test_categorical_transform.py
Pacman1984/etna
96
30793
import numpy as np import pandas as pd import pytest from etna.datasets import TSDataset from etna.datasets import generate_ar_df from etna.datasets import generate_const_df from etna.datasets import generate_periodic_df from etna.metrics import R2 from etna.models import LinearPerSegmentModel from etna.transforms imp...
1.984375
2
platform/core/polyaxon/db/migrations/0017_auto_20190104_2032.py
hackerwins/polyaxon
0
30794
<gh_stars>0 # Generated by Django 2.1.3 on 2019-01-04 20:32 import django.contrib.postgres.fields.jsonb from django.db import migrations, models import libs.spec_validation class Migration(migrations.Migration): dependencies = [ ('db', '0016_experimentjob_sequence_and_deleted_flag_tpu_resources'), ]...
1.8125
2
validate.py
AVturbine/mapmaker
3
30795
<reponame>AVturbine/mapmaker<gh_stars>1-10 MAP_HEIGHT_MIN = 20 MAP_HEIGHT_MAX = 50 MAP_WIDTH_MIN = 20 MAP_WIDTH_MAX = 50 MAP_KARBONITE_MIN = 0 MAP_KARBONITE_MAX = 50 ASTEROID_ROUND_MIN = 10 ASTEROID_ROUND_MAX = 20 ASTEROID_KARB_MIN = 20 ASTEROID_KARB_MAX = 100 ORBIT_FLIGHT_MIN = 50 ORBIT_FLIGHT_MAX = 200 ROUND_LIMIT = ...
2.703125
3
webserver/testserver/main/urls.py
frankovacevich/aleph
0
30796
from django.urls import path from . import views urlpatterns = [ path('', views.index, name='index'), path('home', views.home, name='home'), path('login', views.ulogin, name='login'), path('logout', views.ulogout, name='logout'), path('password_change', views.password_change, name='password_change...
1.765625
2
exporter.py
mrDoctorWho/VK-Exporter
9
30797
<filename>exporter.py #!/usr/bin/env python2 # coding: utf-8 # based on the vk4xmpp gateway, v2.25 # © simpleApps, 2013 — 2014. # Program published under MIT license. import gc import json import logging import os import re import signal import sys import threading import time import urllib core = getattr(sys.module...
1.953125
2
rmidi/math/functions.py
rushike/rmidipy
5
30798
<filename>rmidi/math/functions.py import math def fibonacci(nth): return int(1 / math.sqrt(5) * (math.pow((1 + math.sqrt(5)) / 2, nth + 1) - math.pow((1 - math.sqrt(5)) / 2, nth + 1)))
3.953125
4
bot.py
Olegt0rr/calendar-telegram
4
30799
<filename>bot.py #!/usr/bin/python3 import telebot from telebot import types import datetime from telegramcalendar import create_calendar bot = telebot.TeleBot("") current_shown_dates={} @bot.message_handler(commands=['calendar']) def get_calendar(message): now = datetime.datetime.now() #Current date chat_id ...
2.921875
3