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
topicextractor/__init__.py
kjchung495/topicextractor
0
31900
<gh_stars>0 import nltk from nltk.tokenize import word_tokenize #nltk.download('punkt') #nltk.download('averaged_perceptron_tagger') from collections import Counter def extract_noun_counts(doc_list): nouns_pdoc = [] for i in range(len(doc_list)): pos = nltk.pos_tag(nltk.word_tokenize(doc_li...
2.734375
3
src/finn/transformation/streamline/absorb.py
SpontaneousDuck/finn
0
31901
# Copyright (c) 2020, Xilinx # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the follow...
1.40625
1
examples/static_content.py
kjosib/kale
0
31902
""" <html><body> <p> You'll probably want to supply a stylesheet. Perhaps some javascript library. Maybe even some images. One way or another, it's handy to be able to point at a directory full of static content and let the framework do its job. </p> <p> This example exercises that facility by presenting the examples ...
2.921875
3
Hello_world/hello_world2.py
elsuizo/Kivy_work
0
31903
#= ------------------------------------------------------------------------- # @file hello_world2.py # # @date 02/14/16 13:29:22 # @author <NAME> # @email <EMAIL> # # @brief # # @detail # # Licence: # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public Li...
2.84375
3
libs/validators/iban.py
Sparklingx/nzbhydra
674
31904
import re from .utils import validator regex = ( r'^[A-Z]{2}[0-9]{2}[A-Z0-9]{13,30}$' ) pattern = re.compile(regex) def char_value(char): """A=10, B=11, ..., Z=35 """ if char.isdigit(): return int(char) else: return 10 + ord(char) - ord('A') def modcheck(value): """Check if...
3.484375
3
Multiples of 3 and 5.py
ahmedharbi197/Project-Euler
1
31905
<gh_stars>1-10 import sys t = int(input().strip()) for a0 in range(t): n = int(input().strip()) def preSum(q): return (q*(1+q) //2 ) result = 3*preSum(int((n-1)//3)) + 5*preSum(int((n-1)//5)) - 15*preSum(int((n-1)//15)) print(int(result))
2.765625
3
home/models.py
davidkiama/Foto-Moto-
0
31906
from statistics import mode from django.db import models from cloudinary.models import CloudinaryField # Create your models here. class Image(models.Model): # image = models.ImageField( # upload_to='uploads/', default='default.jpg') image = CloudinaryField('image') title = models.CharField(max_l...
2.3125
2
mozillians/users/tests/__init__.py
justinpotts/mozillians
1
31907
<reponame>justinpotts/mozillians<filename>mozillians/users/tests/__init__.py from django.contrib.auth.models import Group, User from django.utils import timezone import factory from factory import fuzzy from mozillians.geo.models import City, Country, Region from mozillians.users.models import Language class UserFa...
2.25
2
tests/_utils.py
tsuyukimakoto/physaliidae
2
31908
import os import shutil from contextlib import ( contextmanager, ) from pathlib import Path import pytest @pytest.fixture(scope='function', autouse=True) def cleanup(): test_generate_dir = (Path('.') / 'tests' / 'biisan_data') if test_generate_dir.exists(): shutil.rmtree(test_generate_dir) yi...
2.03125
2
christmasflix/tests.py
jbettenh/last_christmas
0
31909
<reponame>jbettenh/last_christmas from django.test import TestCase from django.shortcuts import reverse from .models import MovieList from christmasflix import omdbmovies class MovieListIndexViewTests(TestCase): def test_no_lists(self): response = self.client.get(reverse('christmasflix:index')) s...
2.28125
2
errors.py
zofy/crawler
0
31910
from asyncio import CancelledError, TimeoutError from requests.exceptions import Timeout, ConnectionError from aiohttp.client_exceptions import ClientHttpProxyError, ClientProxyConnectionError, ClientOSError class CaptchaError(Exception): pass ProxyErrors = (CaptchaError, ClientOSError, ClientProxyConn...
2.515625
3
holdingsparser/scrape.py
mhadam/holdingsparser
9
31911
<filename>holdingsparser/scrape.py import json import logging import re from itertools import chain from json import JSONDecodeError from typing import Iterable, Optional, Mapping import requests import untangle from bs4 import BeautifulSoup, PageElement, Tag from holdingsparser.file import Holding, VotingAuthority, ...
2.703125
3
scripts/settings.py
jugoodma/reu-2018
5
31912
# DEFAULT SETTINGS FILE import json import requests mturk_type = "sandbox" data_type = "temporal" data_path = "../data/" input_path = "../input/" template_path = "../templates/" result_path = "../results/" max_results = 10 approve_all = False # you must have a YouTube API v3 key # your key must be in a json file titl...
2.765625
3
synapse-prometheus-connector/src/main.py
microsoft/azure-synapse-spark-metrics
8
31913
<reponame>microsoft/azure-synapse-spark-metrics # coding=utf-8 # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import json import os import signal import time import traceback import requests import access_token import config import metrics import model import spark_pools def write_string...
2.09375
2
stanCode_projects/pedestrian_removing/stanCodoshop.py
shihjames/sc-projects
0
31914
""" File: stanCodoshop.py Name: <NAME> ---------------------------------------------- SC101_Assignment3 Adapted from <NAME>'s Ghost assignment by <NAME>. ----------------------------------------------- Remove people or abnormal objects in a certain photo. """ import os import sys import time from simpleimage import S...
4.0625
4
src/search/views/author.py
ResearchHub/ResearchHub-Backend-Open
18
31915
<reponame>ResearchHub/ResearchHub-Backend-Open from rest_framework import viewsets from elasticsearch_dsl import Search from elasticsearch_dsl.connections import connections from search.filters import ElasticsearchFuzzyFilter from search.documents import AuthorDocument from search.serializers import AuthorDocumentSeri...
2.140625
2
MPNet/data_loader.py
sbaktha/MPNet
0
31916
<reponame>sbaktha/MPNet import torch import torch.utils.data as data import os import pickle import numpy as np import nltk from PIL import Image import os.path import random from torch.autograd import Variable import torch.nn as nn import math # Environment Encoder class Encoder(nn.Module): def __init__(self): su...
2.375
2
qclib/backend/state.py
dylanljones/qclib
2
31917
# coding: utf-8 # # This code is part of qclib. # # Copyright (c) 2021, <NAME> import numpy as np from ..math import apply_statevec, apply_density, density_matrix from .measure import measure_qubit, measure_qubit_rho class DensityMatrix: def __init__(self, mat): self._data = np.asarray(mat) def __l...
2.546875
3
Upwelling_project_noCFM.py
gmarmin10/Theoretical_Coastal_Model
0
31918
#!/usr/bin/env python # coding: utf-8 # #### Modeling the elemental stoichiometry of phytoplankton and surrounding surface waters in and upwelling or estuarine system # >Steps to complete project: # >1. Translate matlab physical model into python # >2. Substitute Dynamic CFM into model for eco component # >3. Analyze ...
3.171875
3
run.py
UNIFUZZ/getcvss
2
31919
import requests sess = requests.session() import gzip import json import time import os def downloadyear(year): print("fetching year", year) url = "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-{year}.json.gz".format(year=year) req = sess.get(url, stream=True) return gzip.open(req.raw)....
3
3
src/enumerator.py
darkarnium/perimeterator
56
31920
#!/usr/bin/env python3 ''' Perimeterator Enumerator. This wrapper is intended to allow for simplified AWS based deployment of the Perimeterator enumerator. This allows for a cost effective method of execution, as the Perimeterator poller component only needs to execute on a defined schedule in order to detect changes....
2.4375
2
script/diffsel_script_utils.py
vlanore/COPTR
0
31921
<gh_stars>0 # Copyright or Copr. Centre National de la Recherche Scientifique (CNRS) (2017/11/27) # Contributors: # - <NAME> <<EMAIL>> # This software is a computer program whose purpose is to provide small tools and scripts related to phylogeny and bayesian # inference. # This software is governed by the CeCILL-B li...
2.109375
2
test/test_PointSource/test_point_source.py
guoxiaowhu/lenstronomy
1
31922
<reponame>guoxiaowhu/lenstronomy import pytest import numpy as np import numpy.testing as npt from lenstronomy.PointSource.point_source import PointSource from lenstronomy.LensModel.lens_model import LensModel from lenstronomy.LensModel.Solver.lens_equation_solver import LensEquationSolver import lenstronomy.Util.para...
1.960938
2
invenio_rdm_pure/utils.py
utnapischtim/invenio-rdm-pure
0
31923
# -*- coding: utf-8 -*- # # Copyright (C) 2021 Technische Universität Graz # # invenio-rdm-pure is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Utility methods.""" import smtplib from datetime import datetime from os.path import di...
1.929688
2
examples/project-sourcecode/c.py
wheatdog/guildai
694
31924
<gh_stars>100-1000 from subproject import d print("c")
0.988281
1
cookiecutterassert/rules/run_script.py
yangzii0920/cookiecutterassert
3
31925
# Copyright 2020 Ford Motor Company # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or ag...
2.078125
2
neutron/services/loadbalancer/plugin.py
CingHu/neutron-ustack
0
31926
<reponame>CingHu/neutron-ustack<filename>neutron/services/loadbalancer/plugin.py # # Copyright 2013 Radware 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.320313
1
awsFunctions.py
jmontoyac/disk-space
0
31927
<reponame>jmontoyac/disk-space import boto3 from botocore.exceptions import NoCredentialsError ACCESS_KEY = '' SECRET_KEY = '' def upload_to_aws(local_file, bucket, s3_file): s3 = boto3.client('s3', aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY) try: s3.upload_...
2.75
3
src/db_writer.py
lofmat/kafka_project
0
31928
<filename>src/db_writer.py from psycopg2 import connect, DatabaseError, OperationalError, ProgrammingError import logging import sys logging.getLogger().setLevel(logging.INFO) def query_exec(query: str, conn) -> list: query_ok = False with conn.cursor() as cursor: logging.info(f'Executing query: {que...
3.015625
3
sample/metropolis_sampler.py
shuiruge/little_mcmc
0
31929
<reponame>shuiruge/little_mcmc #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Description --------- Class of sampler by Metropolis algorithm. Documentation --------- C.f. `../doc/metropolis_sampler.tm`. """ import random from math import log from copy import deepcopy as copy class MetropolisSampler: """ ...
2.96875
3
Desafios/Desafio048.py
vaniaferreira/Python
0
31930
#Faça um programa que calcule a soma entre todos os números ímpares que são múltiplos de 3 e que se encontram # no intervalo de 1 até 500. soma = 0 cont = 0 for c in range(1,501,2): if c % 3 == 0: cont = cont + 1 soma = soma + c print('A soma dos números solicitados {} são {}'.format(cont, soma))
3.796875
4
main.py
JiahongChen/FRAN
6
31931
<reponame>JiahongChen/FRAN import os import argparse import tqdm import os import argparse import numpy as np import tqdm from itertools import chain from collections import OrderedDict import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import transforms from...
1.976563
2
sums-of-numbers-game/prepare_sum_objects.py
babyrobot-eu/core-modules
1
31932
<gh_stars>1-10 import pickle from random import shuffle sums = [(5, 105) , (205, 305), (405, 1005), (1105, 1205), (1305, 1405)] shuffle(sums) a = {'sums': sums, 'current_sum': 0} with open('child_data/child1.pkl', 'wb') as f: pickle.dump(obj=a, file=f) print(a) shuffle(sums) b = {'sums': sums, 'current_sum': 0} w...
2.703125
3
tests/weighted/test_pathcensus.py
sztal/pathcensus
0
31933
"""Test weighted path counting methods.""" # pylint: disable=redefined-outer-name,too-few-public-methods # pylint: disable=too-many-branches import pytest from pytest import approx import numpy as np import pandas as pd from pathcensus.definitions import PathDefinitionsWeighted from pathcensus import PathCensus @pyte...
2.25
2
menuparser.py
tomjaspers/vubresto-server
2
31934
#!/usr/bin/env python27 import io import os import json import logging import datetime import requests import lxml.html from lxml.cssselect import CSSSelector from multiprocessing.dummy import Pool as ThreadPool # Path where the JSONs will get written. Permissions are your job. SAVE_PATH = '.' # Urls of the pages t...
2.609375
3
server/recommendation_system.py
Igor-SeVeR/Recommendation-system-for-offering-related-products
0
31935
<reponame>Igor-SeVeR/Recommendation-system-for-offering-related-products import numpy as np from utils import check_integer_values from gensim.models import KeyedVectors from config import PATH_TO_SAVE_DATA, WORD2VEC_FILE_NAME, STOCKCODE_FILE_NAME # =========== TECHNICAL FUNCTIONS =========== def aggregate_vectors(...
2.734375
3
src/wav2vec2/spec_augment.py
janlight/gsoc-wav2vec2
40
31936
<reponame>janlight/gsoc-wav2vec2 # following code is largly adapted from `here <https://github.com/huggingface/transformers/blob/f2c4ce7e339f4a2f8aaacb392496bc1a5743881f/src/transformers/models/wav2vec2/modeling_tf_wav2vec2.py#L206>__` import tensorflow as tf import numpy as np def tf_multinomial_no_replacement(dis...
2.171875
2
livereload/__init__.py
Fantomas42/django-livereload
63
31937
<reponame>Fantomas42/django-livereload """django-livereload""" __version__ = '1.7' __license__ = 'BSD License' __author__ = 'Fantomas42' __email__ = '<EMAIL>' __url__ = 'https://github.com/Fantomas42/django-livereload'
0.835938
1
utils_data.py
vkola/peds2019
13
31938
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 8 16:05:54 2019 @author: <NAME> (Kolachalama's Lab, BU) """ from torch.utils.data import Dataset # true if gapped else false vocab_o = { True: ['-'] + ['A', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W',...
2.234375
2
fairmlhealth/__fairness_metrics.py
masino-lab/fairMLHealth
19
31939
""" Custom Fairness Metrics Note that ratio and difference computation is handled by AIF360's sklearn.metrics module. As of the V 0.4.0 release, these are calculated as [unprivileged/privileged] and [unprivileged - privileged], respectively """ from typing import Callable from aif360.sklearn.metrics import...
2.609375
3
tests/portstat/test_portstat.py
xwjiang2021/sonic-mgmt
2
31940
<reponame>xwjiang2021/sonic-mgmt import logging import pytest from tests.common.helpers.assertions import pytest_assert from tests.common.portstat_utilities import parse_portstat from tests.common.utilities import wait logger = logging.getLogger('__name__') pytestmark = [ pytest.mark.topology('any') ] @pytest...
2.265625
2
src/bxcommon/utils/crypto.py
dolphinridercrypto/bxcommon
12
31941
<filename>src/bxcommon/utils/crypto.py from hashlib import sha256 from nacl.secret import SecretBox from nacl.utils import random # Length of a SHA256 double hash SHA256_HASH_LEN = 32 KEY_SIZE = SecretBox.KEY_SIZE def bitcoin_hash(content): return sha256(sha256(content).digest()).digest() def double_sha256(co...
2.71875
3
src/PyMIPS/tests/memory_test.py
shenganzhang/Py-MI-PS
3
31942
<gh_stars>1-10 try: from src.PyMIPS.Datastructure.memory import Memory except: from PyMIPS.Datastructure.memory import Memory import unittest class TestMemory(unittest.TestCase): def test_storage(self): Memory.store_word(16, 2214) Memory.store_word(17, 2014) self.assertEqual(Memo...
2.125
2
experimentum/Storage/Migrations/Schema.py
PascalKleindienst/experimentum
0
31943
<gh_stars>0 """The :py:class:`.Schema` class provides a database agnostic way of manipulating tables. Tables ====== Creating Tables --------------- To create a new database table, the :py:meth:`~.Schema.create` method is used. The :py:meth:`~.Schema.create` method accepts a table name as its argument and returns a :p...
3.453125
3
custom_components/kostal/sensor.py
zittix/kostalpiko-sensor-homeassistant
0
31944
"""The Kostal piko integration.""" import logging import xmltodict from datetime import timedelta from homeassistant.const import ( CONF_USERNAME, CONF_PASSWORD, CONF_HOST, CONF_MONITORED_CONDITIONS, ) from homeassistant.components.sensor import SensorEntity from homeassistant.helpers...
2.234375
2
kaskopy/items.py
aspirin1988/KASKO
0
31945
<reponame>aspirin1988/KASKO # -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy from kaskopy.models import Car, RawData class CarItem(scrapy.Item): brand = scrapy.Field() model = scrapy.Field() ...
2.6875
3
6 - Python/Introduction/2 - Raw Input.py
Terence-Guan/Python.HackerRank
88
31946
<reponame>Terence-Guan/Python.HackerRank<gh_stars>10-100 line = input() print(line)
2.28125
2
GameLogServer/GameLogServer/log_reader.py
Frankity/IW4M-Admin
0
31947
import re import os import time class LogReader(object): def __init__(self): self.log_file_sizes = {} # (if the file changes more than this, ignore ) - 1 MB self.max_file_size_change = 1000000 # (if the time between checks is greater, ignore ) - 5 minutes self.max_file_time_...
3
3
python/defaultdict-tutorial/main.py
shollingsworth/HackerRank
0
31948
#!/usr/bin/env python # -*- coding: utf-8 -*- import __future__ import sys import json def banner(): ban = '====' * 30 print("{}\nSAMPLE INP:\n{}\n{}".format(ban,ban,open(ip, 'r').read())) print("{}\nSAMPLE OUT:\n{}\n{}".format(ban,ban,open(op, 'r').read())) print("{}\nSTART:\n{}".format(ban,ban)) ...
3.0625
3
EpikCord/interactions.py
Conchbot-Development/EpikCord.py
0
31949
from .embed import Embed from .file import Attachment from .member import GuildMember, User from .slash import SlashCommandOptionChoice, AnyOption from .commands import MessageButton, MessageSelectMenu, MessageTextInput, MessageSelectMenuOption from typing import Optional, List, Union class BaseInteraction: def __...
2.1875
2
satchmo/contact/views.py
sankroh/satchmo
1
31950
from django import http from django.contrib.auth import REDIRECT_FIELD_NAME from django.contrib.auth.decorators import login_required from django.core import urlresolvers from django.shortcuts import render_to_response from django.template import RequestContext from django.utils.translation import ugettext_lazy as _ fr...
2.125
2
slackbuilder/blocks.py
kbeauregard/slackbuilder
0
31951
<gh_stars>0 DEFAULT_TEXT_TYPE = "mrkdwn" class BaseBlock: def generate(self): raise NotImplemented("Subclass missing generate implementation") class TextBlock(BaseBlock): def __init__(self, text, _type=DEFAULT_TEXT_TYPE): self._text = text self._type = _type def __repr__(self): ...
2.515625
3
lopy_gateway/config.py
haroal/choco-lora
0
31952
<filename>lopy_gateway/config.py """ LoPy LoRaWAN Nano Gateway configuration options """ import machine import ubinascii WIFI_MAC = ubinascii.hexlify(machine.unique_id()).upper() # Set the Gateway ID to be the first 3 bytes of MAC address + 'FFFE' + last 3 bytes of MAC address GATEWAY_ID = '30aea4fffe4e5638' #WIFI_...
2.421875
2
1-python-basico (Logica de programacao)/desafio-validador-cpf/desafio-cpf.py
Leodf/projetos-python
0
31953
<gh_stars>0 """ CPF = 079.004.419-64 ---------------------- 0 * 10 = 0 # 0 * 11 = 0 7 * 9 = 63 # 7 * 10 = 70 9 * 8 = 72 # 9 * 9 = 81 0 * 7 = 0 # 0 * 8 = 0 0 * 6 = 0 # 0 * 7 = 0 4 * 5 = 20 # 4 * 6 = 24 4 * 4 = 16 ...
3.078125
3
HW6/mashavskih/2.py
kolyasalubov/Lv-677.PythonCore
0
31954
<reponame>kolyasalubov/Lv-677.PythonCore<filename>HW6/mashavskih/2.py import math def rectangle(lenght_rectangle, breadth_rectangle): area_rectangle = lenght_rectangle*breadth_rectangle print(f'The area of rectangle is {area_rectangle}.') def triangle(base_triangle, height_triangle): area_triangle = 0.5 * ...
4.28125
4
examples/constraints.py
jbarberia/PFNET.py
3
31955
#***************************************************# # This file is part of PFNET. # # # # Copyright (c) 2015, <NAME>. # # # # PFNET is released under the BSD 2-clause license. # #***********...
2.171875
2
src/transbigdata/getbusdata.py
anitagraser/transbigdata
1
31956
<gh_stars>1-10 import pandas as pd import numpy as np import geopandas as gpd from shapely.geometry import Polygon,LineString import urllib.request import json from .CoordinatesConverter import gcj02towgs84,bd09towgs84,bd09mctobd09 from urllib import parse def getadmin(keyword,ak,subdistricts = False): ''' Inp...
3.03125
3
user/apps.py
salimking/movepass
0
31957
<reponame>salimking/movepass<gh_stars>0 from django.apps import AppConfig class userConfig(AppConfig): name = 'user'
1.125
1
banner4.py
KingNasirul/BHBVirus
0
31958
<reponame>KingNasirul/BHBVirus import time import sys # Set color R = '\033[31m' # Red N = '\033[1;37m' # White G = '\033[32m' # Green O = '\033[0;33m' # Orange B = '\033[1;34m' #Blue def delay_print(s): for c in s: sys.stdout.write(c) sys.stdout.flush() time.sleep(0.01) delay_print delay_...
2.609375
3
flod_facilities_backend/app.py
Trondheim-kommune/Bookingbasen
1
31959
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from logging import StreamHandler, INFO from flask import Flask from flask.ext.mail import Message, Mail from api import create_api from database import init_db API_VERSION = "v1" def check_environment(app): file_backend = os.environ.get('FILE_BACKEND', '...
2.015625
2
aioneo4j4/client.py
zhangmoon/aioneo4j4
0
31960
<filename>aioneo4j4/client.py<gh_stars>0 import asyncio import collections from yarl import URL from .transport import Transport class Client: def __init__( self, url='http://127.0.0.1:7474/', auth=None, transport=Transport, request_timeout=..., *, loop=None ...
2.453125
2
a.5.4.py
AmanMishra148/python-repo
0
31961
#Script to calc. area of circle. print("enter the radius") r= float(input()) area= 3.14*r**2 print("area of circle is",area)
4.15625
4
examples/jet_substructure/syn.py
juliovicenzi/logicnets
0
31962
<reponame>juliovicenzi/logicnets # Copyright (C) 2021 Xilinx, 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 required ...
1.945313
2
Test.py
ashmoreinc/IP-Scanner
4
31963
<filename>Test.py from Scanner import * from threading import Thread Scanner = Scan_Handler(verbose=False, verbosity="high", threads=50, ports=[80, 443]) Scanner.Start_Scanner("192.168.0.1", "192.168.0.5") def Background (): for data in Scanner.Get_Outputs_Realtime(): print(str(data)) bg = Thread(targe...
2.671875
3
tests/views/test_ping.py
Eldies/image_storage
0
31964
# -*- coding: utf-8 -*- import unittest from app import app class TestPingView(unittest.TestCase): def setUp(self): app.config['TESTING'] = True self.client = app.test_client() def test_ping(self): response = self.client.get('/ping') assert response.data.decode('utf-8') == 'p...
2.859375
3
DailyAssingments/Week1/Day2Assignments2.py
smooth-dasilva/Smoothstack-Workload
0
31965
<reponame>smooth-dasilva/Smoothstack-Workload #doc4 #1. print([1, 'Hello', 1.0]) #2 print([1, 1, [1,2]][2][1]) #3. out: 'b', 'c' print(['a','b', 'c'][1:]) #4. weekDict= {'Sunday':0,'Monday':1,'Tuesday':2,'Wednesday':3,'Thursday':4,'Friday':5,'Saturday':6, } #5. out: 2 if you replace D[k1][1] with D['k1][1] D={'...
2.59375
3
10/14/solve.py
juancroldan/tuenti-challenge
0
31966
<reponame>juancroldan/tuenti-challenge from threading import Thread from time import sleep from socket import socket, AF_INET, SOCK_STREAM from re import compile HOST = ('172.16.17.32', 2092) MAX_BUFFER = 2**15 MSGS = compile(r'^ROUND (\d+): (\d+) -> (\w+) \{(.+?)\}( no_proposal)?( \(ROUND FINISHED\))?$').search LEARN...
2.671875
3
tests/test_packages/test_skills/test_registration_aw1/test_behaviours.py
bryanchriswhite/agents-aea
126
31967
<gh_stars>100-1000 # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may ob...
1.75
2
anopool/pool.py
willtrnr/anopool
0
31968
<filename>anopool/pool.py """Generic object pool""" from __future__ import annotations __all__ = [ "Manager", "Pool", ] import contextlib import dataclasses import logging import queue import threading from abc import ABCMeta from typing import Generator, Generic, Optional, TypeVar from ._common import DEFA...
2.890625
3
deepab/util/get_bins.py
antonkulaga/DeepAb
67
31969
import math def get_dist_bins(num_bins, interval=0.5): bins = [(interval * i, interval * (i + 1)) for i in range(num_bins - 1)] bins.append((bins[-1][1], float('Inf'))) return bins def get_dihedral_bins(num_bins, rad=False): first_bin = -180 bin_width = 2 * 180 / num_bins bins = [(first_bin ...
2.734375
3
tests/test_manifest.py
markfinger/python-webpack
66
31970
<filename>tests/test_manifest.py import unittest import os import json import mock import hashlib from webpack.conf import Conf from webpack.manifest import generate_manifest, generate_key, write_manifest, read_manifest, populate_manifest_file from webpack.compiler import webpack from .settings import ConfigFiles, OUTP...
2.515625
3
commonware/response/middleware.py
Osmose/commonware
0
31971
<reponame>Osmose/commonware import inspect import time from django.conf import settings class _statsd(object): def incr(s, *a, **kw): pass def timing(s, *a, **kw): pass try: from statsd import statsd except ImportError: statsd = _statsd() class FrameOptionsHeader(object): """...
2.140625
2
tests/test_btc_rawtx_zcash.py
VDamas/app-cryptoescudo
0
31972
import pytest from dataclasses import dataclass, field from functools import reduce from typing import List, Optional from helpers.basetest import BaseTestBtc, LedgerjsApdu, TxData, CONSENSUS_BRANCH_ID from helpers.deviceappbtc import DeviceAppBtc, CommException # Test data below is from a Zcash test log from Live te...
2.078125
2
test.py
sguzman/duo-service-ready
0
31973
import atexit import grpc import logging import os import server_pb2 import server_pb2_grpc port: str = None def init_env() -> None: global port port = os.environ['PORT'] logging.info('Found PORT at %s', port) def init_atexit() -> None: def end(): logging.info('bye') atexit.register...
2.453125
2
tests/dummy_project/spiders/dummy_spider.py
zack-wilson/scrapy-statsd
0
31974
<reponame>zack-wilson/scrapy-statsd<filename>tests/dummy_project/spiders/dummy_spider.py # -*- coding: utf-8 -*- import datetime as dt import uuid import scrapy class DummySpiderSpider(scrapy.Spider): name = "dummy_spider" allowed_domains = ["example.com"] start_urls = ["http://example.com/"] def pa...
2.546875
3
library_management/library_management/doctype/customer_account/customer_account.py
jcgurango/library_management
0
31975
<gh_stars>0 # Copyright (c) 2021, JC and contributors # For license information, please see license.txt # import frappe from frappe.model.document import Document class CustomerAccount(Document): pass
1.023438
1
neural_compressor/experimental/common/optimizer.py
kevinintel/neural-compressor
100
31976
<filename>neural_compressor/experimental/common/optimizer.py #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2021 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Licens...
2.125
2
curation_validator.py
FlashpointProject/Curation-Validation-Bot
5
31977
import base64 import shutil import json import re from enum import Enum, auto from typing import Optional import py7zr from cachetools import TTLCache, cached from ruamel.yaml import YAML, YAMLError from logger import getLogger import os import tempfile import zipfile import requests from bs4 import BeautifulSoup l ...
2.296875
2
authentication/urls.py
thestackcoder/notifao_app
0
31978
# -*- encoding: utf-8 -*- """ License: MIT Copyright (c) 2019 - present AppSeed.us """ from django.urls import path from .views import login_view, register_user, reset_password from django.contrib.auth.views import LogoutView from .views import * urlpatterns = [ path('login/', login_view, name="login"), path(...
1.75
2
examples/get_tiles.py
cytomine/Cytomine-python-client
23
31979
<reponame>cytomine/Cytomine-python-client<gh_stars>10-100 # -*- coding: utf-8 -*- # * Copyright (c) 2009-2018. Authors: see NOTICE file. # * # * 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 ...
2.1875
2
info/modules/admin/__init__.py
gxz987/Dynamic_movie
0
31980
from flask import Blueprint admin_blu = Blueprint("admin", __name__, url_prefix="/admin") from .views import * @admin_blu.before_request def admin_identification(): """ 进入后台之前的校验 :return: """ # 我先从你的session获取下is_admin 如果能获取到 说明你是管理员 # 如果访问的接口是/admin/login 那么可以直接访问 is_login = request.ur...
2.34375
2
mitmproxy/contentviews/auto.py
KarlParkinson/mitmproxy
24,939
31981
<filename>mitmproxy/contentviews/auto.py from mitmproxy import contentviews from . import base class ViewAuto(base.View): name = "Auto" def __call__(self, data, **metadata): # TODO: The auto view has little justification now that views implement render_priority, # but we keep it around for no...
2.1875
2
code/services/synergy_services.py
EdsonECM17/DS_Proyecto_02_Synergy_Logistics
0
31982
from typing import List from processing.sl_filters import SynergyLogisticsFilters class Service(SynergyLogisticsFilters): """ Clase que contine servicios para el analisis de la tabla de Synergy Logistics. """ def get_routes_list(self, direction:str or None = None) -> List: """Genera una lista...
2.828125
3
src/bspline-insert.py
kaykayehnn/geometric_design
2
31983
<reponame>kaykayehnn/geometric_design from sympy import init_printing, Rational from classes.BSpline import BSpline init_printing() # INPUT DATA HERE knots = [ 0, 0, 0, Rational(2, 5), Rational(1, 2), Rational(3, 5), 1, 1, 1, ] # fmt: off control_points = [ [2,2], [0,2], [0,0...
3.1875
3
app/recipe/tests/test_tag_apis.py
NhatHox23/nhat-recipe-backend
0
31984
from django.contrib.auth import get_user_model from django.urls import reverse from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from recipe.models import Tag from recipe.serializers import TagSerializer from core.tests.utils import sample_tag, sample_user ...
2.4375
2
tests/test_toolkit.py
eng-tools/sfsidb
1
31985
from sfsidb import load as sload from sfsidb import toolkit from sfsidb import checking_tools as ct from sfsidb import sensor_file_reader as sfr from tests.conftest import TEST_DATA_DIR def test_get_depth_from_sensor_code(): sensor_ffp = TEST_DATA_DIR + "test-sensor-file.json" si = sfr.read_json_sensor_file(...
2.25
2
nhoods/setup.py
MSLADevServGIS/NhoodProfiles
0
31986
# Setup procedures -- WIP import os import re import arcpy arcpy.env.workspace = "in_memory" # TODO: out_gdb = "//cityfiles/DEVServices/WallyG/projects/NhoodProfiles/nhoods/data/NhoodAmenities.gdb/MtStatePlane" # DATA PROCESSING # Nhood_buffers: arcpy.Buffer_analysis("Nhoods", "nhood_buffers", ...
2.015625
2
Gathered CTF writeups/ptr-yudai-writeups/2019/Facebook_CTF_2019/babylist/solve.py
mihaid-b/CyberSakura
1
31987
from ptrlib import * import re import time def create(name): sock.recvuntil("> ") sock.sendline("1") sock.sendline(name) def add(index, value): sock.recvuntil("> ") sock.sendline("2") sock.sendline(str(index)) sock.sendline(str(value)) def view(index, pos): sock.recvuntil("> ") so...
2.25
2
container_service_extension/lib/pksclient/api/profile_api.py
arunmk/container-service-extension
81
31988
# coding: utf-8 """ PKS PKS API # noqa: E501 OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import # python 2 and python 3 compatibility library import six from container_service_extension.lib.pksclient.api_cl...
1.992188
2
tests/test_utils.py
tesera/shclassify
0
31989
import os import pytest import pandas as pd import numpy as np from shclassify.utils import (inverse_logit, choose_from_multinomial_probs, choose_from_binary_probs) def test_inverse_logit(): assert inverse_logit(0) == 0.5 def test_choose_from_multinomia...
2.875
3
dbdaora/hash/query.py
dutradda/sqldataclass
21
31990
<filename>dbdaora/hash/query.py import dataclasses from typing import Any, ClassVar, List, Optional, Sequence, Tuple, Type, Union from dbdaora.keys import FallbackKey from dbdaora.query import BaseQuery, Query, QueryMany from .repositories import HashData, HashEntity, HashRepository @dataclasses.dataclass(init=Fals...
2.3125
2
pattoo_agents/snmp/snmp.py
palisadoes/pattoo-agents
0
31991
"""Module used polling SNMP enabled targets.""" import sys # PIP3 imports import easysnmp from easysnmp import exceptions # Import Pattoo libraries from pattoo_shared import log from pattoo_shared.variables import DataPoint from pattoo_shared.constants import ( DATA_INT, DATA_COUNT64, DATA_COUNT, DATA_STRING, DA...
2.234375
2
nicos_mlz/resi/setups/resi.py
jkrueger1/nicos
12
31992
<filename>nicos_mlz/resi/setups/resi.py description = 'Resi instrument setup' group = 'basic' includes = ['base']
1
1
flexget/plugins/metainfo/torrent_size.py
Crupuk/Flexget
0
31993
<gh_stars>0 from __future__ import unicode_literals, division, absolute_import import logging from flexget.plugin import priority, register_plugin log = logging.getLogger('torrent_size') class TorrentSize(object): """ Provides file size information when dealing with torrents """ @priority(200) d...
2.25
2
day23.py
ednl/aoc2015
0
31994
<reponame>ednl/aoc2015 import re cmd = re.compile(r'^(\w+) (\w)?(?:, )?((?:\+|-)\d+)?$') with open('input23.txt') as f: # Subtract 1 from jump (offset) to enable ip++ for every instruction mem = [(i, r, j if j is None else int(j) - 1) for s in f for i, r, j in [cmd.match(s.strip()).groups()]] def run(a: int) ...
3
3
src/summarization/metric/rouge_metric.py
youngerous/kobart-voice-summarization
8
31995
""" Ref: https://dacon.io/competitions/official/235673/talkboard/401911?page=1&dtype=recent """ import os import re import platform import itertools import collections import pkg_resources # pip install py-rouge from io import open if platform.system() == "Windows": try: from eunjeon import Mecab exc...
2.375
2
algorithm_web/admin/contest.py
KMU-algolab/algorithm
0
31996
from django.contrib import admin from .. import models @admin.register(models.Contest) class ContestAdmin(admin.ModelAdmin): """ 대회관리 """ list_display = ['contest_name', 'start_time', 'end_time', 'message', 'host_email', 'after_open'] class Meta: model = models.Contest @admin.register(...
2.15625
2
kubernetes_env/cpu_script.py
Kn99HN/tracing_env
0
31997
<reponame>Kn99HN/tracing_env<gh_stars>0 #!/usr/bin/env python3 import seaborn as sns import argparse import numpy as np import pandas as pd import matplotlib.pyplot as plt import pathlib import pathlib import kube_env import kube_util as util def graph(title, csv_path, output): old_to_new_names = {} df = pd.re...
2.5
2
predix/admin/cf/spaces.py
Saifinbox/predix
0
31998
import logging import predix.admin.cf.api import predix.admin.cf.orgs import predix.admin.cf.apps import predix.admin.cf.services class Space(object): """ Operations and data for Cloud Foundry Spaces. """ def __init__(self, *args, **kwargs): super(Space, self).__init__(*args, **kwargs) ...
2.28125
2
services/traction/api/endpoints/routes/v1/tenant/admin/issuer.py
bcgov/traction
12
31999
import logging from fastapi import APIRouter from starlette import status from api.endpoints.dependencies.tenant_security import get_from_context from api.endpoints.models.v1.tenant import TenantGetResponse from api.services.v1 import tenant_service router = APIRouter() logger = logging.getLogger(__name__) @rou...
2.203125
2