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 |
|---|---|---|---|---|---|---|
datasets.py | Confusezius/CVPR2020_PADS | 62 | 12770351 | """
Dataloaders for CUB200-2011, CARS196 and Stanford Online Products.
"""
"""==================================================================================================="""
################### LIBRARIES ###################
import warnings
warnings.filterwarnings("ignore")
import numpy as np, os, sys, pandas a... | 2.0625 | 2 |
src/btc/types_btc.py | wenqinchao/btc | 3 | 12770352 | from typing import NewType
RPCEndpoint = NewType("RPCEndpoint", str) | 1.570313 | 2 |
testcases/test_4_get_domain.py | evilbrave/REST_API_TESTCASES | 1 | 12770353 | <reponame>evilbrave/REST_API_TESTCASES
import requests
from signature import Signature
import common_data
import test_1_device_auth
from requests.utils import quote
url = common_data.oss_url
#url = "http://127.0.0.1:8888"
path = "/v1/domains/"
def init_headers(headers):
headers['X-Api-Key'] = common_data.x_api_ke... | 2.421875 | 2 |
rpeakdetection/Evaluation.py | Fabrizio1994/ECGClassification | 10 | 12770354 | from rpeakdetection.Utility import Utility
util = Utility()
class Evaluation:
def evaluate(self, rpeaks, name, evaluation_width, rule_based, test_index=None):
real_locations = util.remove_non_beat(name, rule_based)[0]
if test_index is not None:
real_locations = list(filter(lambda x: ... | 2.484375 | 2 |
backend/api/migrations/0011_annotation.py | cerob/bounswe2018group6 | 12 | 12770355 | # Generated by Django 2.1.2 on 2018-12-28 16:58
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name')... | 1.875 | 2 |
multivariate.py | ChaofanChen/ORCSimulator | 0 | 12770356 | <reponame>ChaofanChen/ORCSimulator
import matplotlib.pyplot as plt
from geothermal_orc_design import multivariate_optimization
from collections import OrderedDict
from znes_plotting import plot, shared
import pandas as pd
import numpy as np
import itertools
from matplotlib.ticker import MaxNLocator
import json
import s... | 2.234375 | 2 |
tests/test_directory.py | eightBEC/watson-visual-recognition-tooling | 0 | 12770357 | <gh_stars>0
# coding: utf-8
from unittest import TestCase
from .context import vrtool
import os
class DirectoryTest(TestCase):
def setUp(self):
path = os.path.join(os.path.dirname(__file__),'testfiles')
self.directory = vrtool.Directory(path)
def test_get_image_files(self):
path = os... | 2.65625 | 3 |
plugin.video.vstream/resources/sites/enstream.py | akuala/REPO.KUALA | 2 | 12770358 | <reponame>akuala/REPO.KUALA
#-*- coding: utf-8 -*-
# https://github.com/Kodi-vStream/venom-xbmc-addons
from resources.lib.gui.hoster import cHosterGui
from resources.lib.gui.gui import cGui
from resources.lib.handler.inputParameterHandler import cInputParameterHandler
from resources.lib.handler.outputParameterHandler i... | 2.0625 | 2 |
tests/api/v3_1_0/test_identity_groups.py | CiscoISE/ciscoisesdk | 36 | 12770359 | <reponame>CiscoISE/ciscoisesdk<filename>tests/api/v3_1_0/test_identity_groups.py
# -*- coding: utf-8 -*-
"""IdentityServicesEngineAPI identity_groups API fixtures and tests.
Copyright (c) 2021 Cisco and/or its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software an... | 1.6875 | 2 |
test_pyqt2.py | orange5rs/GPRPy | 0 | 12770360 | import sys
import matplotlib
matplotlib.use('Qt5Agg')
from PyQt5 import QtCore, QtGui, QtWidgets
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure
class MplCanvas(FigureCanvasQTAgg):
def __init__(self, parent=None, wi... | 2.78125 | 3 |
Ogrenciler/Burcu/05DATASTRUCTRE/nesnetaban.py | ProEgitim/Python-Dersleri-BEM | 1 | 12770361 | class Calisan():
def __init__(self,isim,maas):
print("Çalışan sınıfının init fonsksiy") | 1.929688 | 2 |
fridgeai/gui/mainwindow.py | PosaLusa24/fridgeai | 1 | 12770362 | import os
import sqlite3
from fridgeai import camera
from PyQt5 import QtCore, QtGui, QtWidgets
from fridgeai.gui.manual import Ui_Manual
from fridgeai.gui.predict import Ui_predict
from fridgeai.gui.testing import Ui_List
from fridgeai.gui.learn import Ui_Learn
from datetime import date
class Ui_MainWindow(object):
... | 2.03125 | 2 |
tests/core/test_templating.py | AurelienLourot/charm-helpers | 15 | 12770363 | import pkg_resources
import shutil
import tempfile
import unittest
import jinja2
import os.path
import pwd
import grp
import mock
from charmhelpers.core import templating
TEMPLATES_DIR = pkg_resources.resource_filename(__name__, 'templates')
class TestTemplating(unittest.TestCase):
def setUp(self):
sel... | 2.390625 | 2 |
doc/source/EXAMPLES/kmpfit_ODRsinus.py | kapteyn-astro/kapteyn | 3 | 12770364 | #!/usr/bin/env python
#------------------------------------------------------------
# Purpose: Program finds best-fit pararameters of a model
# a*sin(bx+c) with data with errors in both variables
# x and y. It uses the effective variance method for
# kmpfit and the results are compared with S... | 3.40625 | 3 |
inventory/migrations/0001_initial.py | balexander85/inventory | 0 | 12770365 | <reponame>balexander85/inventory
# Generated by Django 2.1 on 2018-08-18 20:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Item",
... | 1.867188 | 2 |
kerastools/layers/horde_layers.py | gyfastas/ICCV2019-Horde | 84 | 12770366 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Layer
from kerastools.initializers import RandomMaclaurin
class CompactKOrderPooling(Layer):
""" Keras layer to compute K-th order moments representation. In the non-trainable case, the Ra... | 3.09375 | 3 |
setup.py | bastiendonjon/sanic-jwt | 0 | 12770367 | <filename>setup.py
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
tests_require = [
"coverage",
"freezegun",
# 'pytest-cache',
"pytest-cov",
"pytest-flakes",
"pytest-pep8",
# 'pytest-sanic',
"pytest-asyncio",
"pytest",
... | 1.53125 | 2 |
customExceptions.py | spark-156/python-playbook | 0 | 12770368 | instrument_familes = {
'Strings': ['Guitar', 'Banjo', 'Sitar'],
'Percussion': ['Conga', 'Cymbal', 'Cajon'],
'woodwinds': ['Flute', 'Oboe', 'Clarinet']
}
class KeyError(Exception):
def __init__(self, key):
self.key = key
def __str__(self) -> str:
return f"Key {self.key} does not exist"
def print... | 3.609375 | 4 |
shuffleindex/utils.py | escudocloud/distributed-shuffleindex | 1 | 12770369 | <reponame>escudocloud/distributed-shuffleindex
from six.moves import xrange
import struct
ENC = 'UTF-16LE' # we use little endian (LE) to remove the BOM character
FMT = '60s' # format is a string of 60 characters
def encode(data, fmt=FMT, enc=ENC):
"""Encode data with specified format and encoding"""
data... | 2.703125 | 3 |
src/luh3417/replace/__main__.py | WithIO/luh3417 | 0 | 12770370 | from argparse import ArgumentParser
from typing import Optional, Sequence, Text
from luh3417.serialized_replace import walk
from luh3417.utils import make_doer, run_main, setup_logging
doing = make_doer("luh3417.replace")
def parse_args(argv: Optional[Sequence[Text]] = None):
parser = ArgumentParser(description... | 3.421875 | 3 |
to_move/streamlit-simple/app.py | PietroAnsidei/examples | 5 | 12770371 | <filename>to_move/streamlit-simple/app.py
__copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import streamlit as st
from util import get_results, render_results
st.title("South Park Search")
st.write("Who said what?")
st.sidebar.title("Search with Jina")
query = st... | 2.78125 | 3 |
03_zhihu/start.py | GongkunJiang/MySpider | 0 | 12770372 | # coding=utf-8
from scrapy import cmdline
# cmdline.execute('scrapy crawl itcast'.split())
cmdline.execute('scrapy crawl zhihuSpider'.split()) | 1.625 | 2 |
Code/MQTT_thing_client_94/src/TimeResource.py | tobiasritscher/SmartHumidor | 0 | 12770373 | <reponame>tobiasritscher/SmartHumidor
#!/usr/bin/env python3
'''
___ ___ ___
___ /\__\ /\ \ /\ \
/\ \ /::| | /::\ \ /::\ \
\:\ \ /:|:| | /:/\:\ \ /:/\ \ \
/::\__\ /:/|:| |_... | 2.328125 | 2 |
__init__.py | MattDavies01/Rocket.PY | 1 | 12770374 | # -*- coding: utf-8 -*-
"""
RocketPy is a trajectory simulation for High-Power Rocketry built by
<NAME>. The code allows for a complete 6 degrees of freedom simulation
of a rocket's flight trajectory, including high fidelity variable mass effects
as well as descent under parachutes. Weather conditions, such as... | 2.515625 | 3 |
projects/webptspy/webpts/celery.py | codelieche/testing | 2 | 12770375 | <reponame>codelieche/testing
# -*- coding:utf-8 -*-
from __future__ import absolute_import
import os
import django
from celery import Celery
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'webpts.settings')
# django.setup()
# 可以在实例化Celery的时候传入broker、backend参数。也可以在settings中配置BROKER_... | 1.914063 | 2 |
schema.py | jfjallid/GreenIoT-GraphQL-Demo | 0 | 12770376 | <reponame>jfjallid/GreenIoT-GraphQL-Demo
from graphene import ObjectType, Field, String, Float, DateTime, List, Int, Boolean
from collections import namedtuple
import json
from elasticsearch import Elasticsearch
from dateutil.parser import parse
import datetime
import os
elastic_host = os.environ.get('ELASTIC_HOST')
i... | 2.609375 | 3 |
nndet/core/boxes/anchors.py | joeranbosma/nnDetection | 242 | 12770377 | <reponame>joeranbosma/nnDetection
"""
Parts of this code are from torchvision and thus licensed under
BSD 3-Clause License
Copyright (c) <NAME> 2016,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
*... | 1.515625 | 2 |
output/models/nist_data/list_pkg/int_pkg/schema_instance/nistschema_sv_iv_list_int_length_3_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 12770378 | <filename>output/models/nist_data/list_pkg/int_pkg/schema_instance/nistschema_sv_iv_list_int_length_3_xsd/__init__.py<gh_stars>1-10
from output.models.nist_data.list_pkg.int_pkg.schema_instance.nistschema_sv_iv_list_int_length_3_xsd.nistschema_sv_iv_list_int_length_3 import NistschemaSvIvListIntLength3
__all__ = [
... | 1.078125 | 1 |
aula4_19oct/Greates_Number.py | JessHV/LabADA_GrupoC | 0 | 12770379 | <gh_stars>0
#Ejercicio 1
'''
Ejemplo del profesor
Convertir esta funsión de O(n^2) a una funsión de O(n)
'''
def greatestNumber(array):
for i in array:
isIValTheGreatest = True
for j in array:
if j > i:
isIValTheGreatest = False
if isIValTheGreatest:
... | 3.734375 | 4 |
common/env_wrapper.py | Frager/Deep-Neuroevolution-In-SC2LE | 1 | 12770380 | from common.preprocessor import Preprocessor
class EnvWrapper:
# Wrapper class for SC2Env.
# Used to fit the data coming from SC2Env to the agents model and vice versa
def __init__(self, env, model_config):
self.env = env
self.model_config = model_config
self.preprocesso... | 2.703125 | 3 |
w3resource/Basics-Part II/Example029.py | DanielPascualSenties/pythonw3 | 0 | 12770381 | def intersection(l1, l2):
res = [v for v in l1 if v in l2]
return res
def divide_into_primes(num, base=2, seq=None):
if seq is None:
seq = []
if num == 1:
return seq
for i in range(base, num+1):
if not num % i:
seq.append(i)
return divide_into_primes... | 3.5 | 4 |
py/rest/convert.py | woodrow/pyoac | 1 | 12770382 | import py
from py.__.process.cmdexec import ExecutionFailed
# utility functions to convert between various formats
format_to_dotargument = {"png": "png",
"eps": "ps",
"ps": "ps",
"pdf": "ps",
}
def ps2eps(ps):
# X... | 2.421875 | 2 |
apps/shortener/migrations/0009_auto_20200824_2124.py | ShAlireza/Yektanet | 0 | 12770383 | # Generated by Django 3.1 on 2020-08-24 21:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('shortener', '0008_auto_20200824_1342'),
]
operations = [
migrations.AlterField(
model_name='short... | 1.6875 | 2 |
scattertext/termcompaction/ClassPercentageCompactor.py | shettyprithvi/scattertext | 1,823 | 12770384 | <reponame>shettyprithvi/scattertext
import numpy as np
from scattertext.termranking import AbsoluteFrequencyRanker
class ClassPercentageCompactor(object):
def __init__(self,
term_ranker=AbsoluteFrequencyRanker,
term_count=2):
'''
Limit terms to ones that make up a minimum percentage
... | 2.90625 | 3 |
build/PureCloudPlatformClientV2/models/evaluation.py | MyPureCloud/platform-client-sdk-python | 10 | 12770385 | # coding: utf-8
"""
Copyright 2016 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applica... | 1.734375 | 2 |
Image checker/fileHasher.py | subhrapaladhi/File-Data-Change-Detector | 0 | 12770386 | <gh_stars>0
import hashlib
from pymongo import MongoClient
import uuid
import os
class FileHasher:
def __init__(self, filename):
self.filename = filename
def readFileData(self):
file = open(self.filename,"rb")
self.fileData = file.read()
# print('filedata = \n',self.fileDa... | 2.65625 | 3 |
SPC_trendanalysis/SPC_rules.py | Ann19941118/SPC_trendanalysis | 0 | 12770387 | #-*- coding:utf-8 -*-
"""
Main class that provides SPC analysis. It detects SPC rules violations.
It can draw charts using matplotlib.
:arguments:
data
user data as flat array/list
"""
from utils import *
import numpy as np
import pandas as pd
RULE_1_BEYOND_3SIGMA = '1个点落在A区以外'
RULE_2_OF_3_BEYOND_2S... | 2.625 | 3 |
addons/pythonscript_repl/plugin.py | matheus2740/godot-python | 0 | 12770388 | <filename>addons/pythonscript_repl/plugin.py
from godot import exposed, export, EditorPlugin
from godot import *
BASE_RES = str(ProjectSettings.localize_path(__file__)).rsplit("/", 1)[0]
PYTHON_REPL_RES = ResourceLoader.load(f"{BASE_RES}/python_repl.tscn")
@exposed(tool=True)
class plugin(EditorPlugin):
def _en... | 2.1875 | 2 |
Python/Zelle/Chapter10_DefiningClasses/ProgrammingExercises/6_GPACalculatorImproved/gpaCalculatorLetterGrade.py | jeffvswanson/CodingPractice | 0 | 12770389 | <filename>Python/Zelle/Chapter10_DefiningClasses/ProgrammingExercises/6_GPACalculatorImproved/gpaCalculatorLetterGrade.py
# gpaCalculatorLetterGrade.py
# A program to calculate a student's GPA using letter grades as input.
"""Extend Chapter 10 Programming Exercise 5 by implementing an addLetterGrade
method. This is si... | 4.5625 | 5 |
tests/integration/test_encrypted_disk/test.py | thealexjo/ClickHouse | 1 | 12770390 | import pytest
from helpers.cluster import ClickHouseCluster
from helpers.client import QueryRuntimeException
FIRST_PART_NAME = "all_1_1_0"
@pytest.fixture(scope="module")
def cluster():
try:
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance("node",
... | 2.125 | 2 |
lfs/catalog/migrations/0007_auto_20210405_1816.py | michael-hahn/django-lfs | 0 | 12770391 | # Generated by Django 3.1.2 on 2021-04-05 18:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalog', '0006_auto_20210405_1803'),
]
operations = [
migrations.AddField(
model_name='deliverytime',
name='synthes... | 1.679688 | 2 |
users/management/commands/load_report_evidence.py | maverick-labs-pune/wikirumours | 0 | 12770392 | import csv
import os
import datetime
from typing import re
from django.core.files import File
from django.core.management import BaseCommand
from django.db import transaction
from django.utils.encoding import force_text
from django.utils.functional import keep_lazy_text
from report.models import Report, WatchlistedRe... | 2.25 | 2 |
pyytdata/util/__init__.py | princekrroshan01/youtube-api-wrapper | 17 | 12770393 | <gh_stars>10-100
from .chnlinfo import ChnlInfo
from .info import Info
from .vidinfo import VidInfo
| 1.101563 | 1 |
pyramid_caching_api/__init__.py | jvanasco/pyramid_caching_api | 0 | 12770394 | <gh_stars>0
from . import api
from . import utils
| 1.140625 | 1 |
makai_kingdom/wish.py | misterfifths/nis_mods | 1 | 12770395 | <filename>makai_kingdom/wish.py
import ctypes as C
from typing import Final
from platform_config import PSP
from astruct import typed_struct
from astruct.type_hints import *
from utils import CountedTable
@typed_struct
class Wish(C.Structure):
_pack_ = 1
mana_cost: CUInt32
level_req: CUInt16
id: CU... | 2.234375 | 2 |
src/data_process/convert_face_to_voc.py | MatthewK3023/FoodCalorieDetector | 0 | 12770396 | import os,h5py,cv2,sys,shutil
import numpy as np
from xml.dom.minidom import Document
rootdir="../"
convet2yoloformat=True
convert2vocformat=True
resized_dim=(48, 48)
#最小取20大小的脸,并且补齐
minsize2select=20
usepadding=True
datasetprefix="/home/yanhe/data/widerface"#
def gen_hdf5():
imgdir=rootdir+"/WIDE... | 2.359375 | 2 |
WORC/addexceptions.py | MStarmans91/WORC | 47 | 12770397 | #!/usr/bin/env python
# Copyright 2016-2021 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | 2.34375 | 2 |
Python/PycharmProjects/aula 12/desafio 045.py | MarcelaSamili/Desafios-do-curso-de-Python | 0 | 12770398 | #Crie um programa que faça o computador jogar Jokenpô com você.
import random
from time import sleep
print('VAMOS <NAME>!')
print('''Coloque:
[1]PEDRA
[2]PAPEL
[3]TESOURA''')
op = input('Qual opção voce escolhe?')
lista = ['1','2','3']
pc = random.choice(lista)
sleep(1)
print('\033[36mJO!')
sleep(1)
print('\033[36mKEM... | 3.984375 | 4 |
MNIST_framework/data_gen/main.py | vanessadamario/data_efficiency | 0 | 12770399 | <reponame>vanessadamario/data_efficiency
# output_dimension = [28, 36, 40, 56, 80, 120, 160]
# scenario = [1, 2, 4]
import os
import numpy as np
import argparse
from os.path import join
from tensorflow.keras.datasets import mnist
from DATASET_GENERATOR import DatasetGenerator
root_path = '/om/user/vanessad/foveation'... | 2.609375 | 3 |
setup.py | thep0y/types-jieba | 0 | 12770400 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: thepoy
# @Email: <EMAIL>
# @File Name: setup.py
# @Created: 2022-03-31 09:43:35
# @Modified: 2022-03-31 18:45:33
import codecs
from setuptools import setup, find_packages
with codecs.open("README.md", "r", "utf-8") as fd:
setup(
... | 1.3125 | 1 |
.eggs/py2app-0.14-py3.6.egg/py2app/recipes/uuid.py | stfbnc/mtsa_py | 17 | 12770401 | def check(cmd, mf):
m = mf.findNode('uuid')
if m:
return dict(expected_missing_imports=set(['netbios', 'win32wnet']))
| 2.03125 | 2 |
10. Old Project/Projects/Sampling/wiseml/data_preparation/labeling.py | Collapse24/Work-projects | 0 | 12770402 | import pandas as pd
import numpy as np
def add_fthm_label(data: pd.DataFrame, target_column: str, thresholds: list, window_size: int):
"""
Fixed Time-Horizon model labeling
0 - keep
1 - up
2 - down
:param data: source pandas dataframe
:param target_column: name of price column... | 3.453125 | 3 |
networking_cisco/plugins/cisco/cfg_agent/cfg_exceptions.py | mail2nsrajesh/networking-cisco | 1 | 12770403 | # Copyright 2014 Cisco Systems, 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/licenses/LICENSE-2.0
#
# Unless requir... | 1.804688 | 2 |
synapse_antispam/mjolnir/antispam.py | grahamc/mjolnir | 153 | 12770404 | # -*- coding: utf-8 -*-
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# 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 require... | 2.15625 | 2 |
dl_tutorials/__init__.py | learnerzhang/AnalyticsVidhya | 1 | 12770405 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/12/21 2:30 PM
# @Author : zhangzhen
# @Site :
# @File : __init__.py
# @Software: PyCharm
import tensorflow as tf
from numpy.random import RandomState as rdm
import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', leve... | 2.546875 | 3 |
python/set_add.py | HannoFlohr/hackerrank | 0 | 12770406 | <reponame>HannoFlohr/hackerrank
s = set()
for _ in range(int(input())):
s.add(input())
print (len(s))
# one line solution
print ( len(set([str(input()) for _ in range(int(input()))])) )
# https://www.hackerrank.com/challenges/py-set-add/problem | 3.265625 | 3 |
remediation/aws/delete_s3_bucket/bot.py | peijianju-sonrai/sonrai-bots | 4 | 12770407 | import sonrai.platform.aws.arn
import logging
def run(ctx):
# Create AWS S3 client
s3_client = ctx.get_client().get('s3')
bucket_resource_srn = ctx.resource_srn
bucket_name = bucket_resource_srn.split('/')[-1]
# delete all objects from the bucket first
response = s3_client.list_objects(Buc... | 2.390625 | 2 |
singleton/singleton.py | rlelito/DesignPatterns | 0 | 12770408 | from __future__ import annotations
from typing import Optional
class Singleton(object):
_instance: Optional[Singleton] = None
def __init__(self) -> None:
if Singleton._instance is not None:
raise Exception("Class is a Singleton")
else:
Singleton._instance = self
@... | 3.375 | 3 |
metaprogramming/metaclass2.py | wapj/pyconkr2019 | 10 | 12770409 | <reponame>wapj/pyconkr2019<filename>metaprogramming/metaclass2.py
def make_class(name):
if name == "pdf":
class PdfFile:
pass
return PdfFile
else:
class TxtFile:
pass
return TxtFile
PdfFile = make_class("pdf")
print(PdfFile)
print(PdfFile())
<class... | 2.703125 | 3 |
tests/test_geofabrik.py | BLSQ/geohealthaccess | 8 | 12770410 | """Tests for Geofabrik module."""
import os
from datetime import datetime
from tempfile import TemporaryDirectory
import pytest
import vcr
from geohealthaccess.geofabrik import Geofabrik, Page, Region
BASEURL = "http://download.geofabrik.de/"
@vcr.use_cassette("tests/cassettes/geofabrik-index.yaml")
def test_page... | 2.59375 | 3 |
pyvib/utils/sample.py | pawsen/pyvib | 6 | 12770411 | # -*- coding: utf-8 -*-
"""pyvib sample data files"""
import socket
import os.path
import warnings
from shutil import move
from tempfile import TemporaryDirectory
from subprocess import check_call
from .config import get_and_create_sample_dir
__all__ = ['download_sample_data', 'get_sample_file']
# https://api.github... | 2.65625 | 3 |
python/search/past_file_search.py | Ericizepic/discordfs | 0 | 12770412 | """Search for files purely in discord."""
from .async_search_client import AsyncSearchClient
import discord
from typing import List, Dict
from fuzzywuzzy import fuzz
from utils import attachment_to_search_dict
import datetime
class PastFileSearch(AsyncSearchClient):
"""Search for files in discord with just discor... | 3.3125 | 3 |
GeoLiberator/geoliberator.py | jakeee51/GeoLiberator | 4 | 12770413 | <reponame>jakeee51/GeoLiberator
# -*- coding: utf-8 -*-
'''
Author: <NAME>
Application Name: GeoLiberator
Functionality Purpose: Instill data quality upon address data
Version: Beta
'''
#8/6/20
import re
import sys
import time
import pandas as pd
#Account for post cardinal direction
#Account for '&' an... | 3.203125 | 3 |
elasticai/creator/vhdl/generator_functions_for_one_lstm_cell.py | es-ude/elastic-ai.creator | 1 | 12770414 | <reponame>es-ude/elastic-ai.creator
import random
from functools import partial
import numpy as np
import torch
from elasticai.creator.qat.layers import QLSTMCell
from elasticai.creator.vhdl.number_representations import (
FloatToSignedFixedPointConverter,
)
from elasticai.creator.vhdl.rom import Rom
def float_... | 2.171875 | 2 |
jobs/send_zipfile_to_teacher.py | jin-hao-chen/filegoback | 0 | 12770415 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
PROJ_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, PROJ_DIR)
import pymysql
import datetime
import fire
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.schedulers.background import B... | 2.5 | 2 |
7 term/Local-Computer-Networks-System-Software/Lab 1/server_package/commands/echo_command.py | Vanya112/BSUIR_Labs | 24 | 12770416 | <reponame>Vanya112/BSUIR_Labs
from server_package.commands.command import Command
from server_package.client_descriptor import ClientDescriptor
from shared.utils.message import compose_message
class EchoCommand(Command):
_data: str
_client: ClientDescriptor
def __init__(self, configuration: dict, client:... | 2.6875 | 3 |
tests/utils/test_task_handler_with_custom_formatter.py | npodewitz/airflow | 8,092 | 12770417 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1.84375 | 2 |
sort/radixSort.py | heqin-zhu/algorithm | 2 | 12770418 | ''' mbinary
#########################################################################
# File : radixSort.py
# Author: mbinary
# Mail: <EMAIL>
# Blog: https://mbinary.xyz
# Github: https://github.com/mbinary
# Created Time: 2018-07-06 15:52
# Description:
################################################################... | 3.25 | 3 |
ibmcnx/config/WebSessionTO.py | stoeps13/ibmcnx2 | 11 | 12770419 | <reponame>stoeps13/ibmcnx2
'''
Set WebSession Timeout in all application servers
Author: <NAME>
Mail: <EMAIL>
Documentation: http://scripting101.stoeps.de
Version: 5.0.1
Date: 09/19/2015
License: Apache 2.0
'''
import ibmcnx.functions
def getAnswer(question):
answer = ''
... | 2.796875 | 3 |
main.py | mark-lvl/recommendation-engine | 1 | 12770420 | # import libraries
import pandas as pd
import os
import sys
from operator import itemgetter
from collections import defaultdict
class MovieRecommendation:
user_threshold: int
min_support: int
min_confidence: float
def __init__(self):
# users in train set
self.user_threshold = 200
... | 3.09375 | 3 |
limitedink/utils/utils_dataset.py | huashen218/LimitedInk | 3 | 12770421 | <reponame>huashen218/LimitedInk
import os
import json
import torch
import bisect
from tqdm import tqdm
import numpy as np
from itertools import chain
from copy import deepcopy as copy
from torch.utils.data import Dataset, DataLoader, RandomSampler, SequentialSampler, TensorDataset
from typing import Any, Callable, List... | 2.125 | 2 |
idl2py/wcs/add_distort.py | RapidLzj/idl2py | 0 | 12770422 | <reponame>RapidLzj/idl2py
"""
By Dr <NAME> -Q, NAOC
v1 2019-04-27
"""
import numpy as np
from..util import *
def add_distort():
pass
# pro add_distort, hdr, astr
#; NAME:
#; ADD_DISTORT
#; PURPOSE:
#; Add the distortion parameters in an astrometry structure to a FITS header.
#; EXPLANATION:
... | 2.59375 | 3 |
mpf/platforms/visual_pinball_engine/generate.py | enteryourinitials/mpf | 0 | 12770423 | """Generate python files from protobufs."""
import glob
import re
from grpc_tools import protoc
protoc.main([
'grpc_tools.protoc',
'--proto_path=protobuf/',
'--python_out=.',
'--grpc_python_out=.'
] + list(glob.iglob('./protobuf/*.proto')))
# Make pb2 imports in generated scripts relative
for script... | 2.46875 | 2 |
MAX6675/demo.py | jonalter/micropython-hw-lib | 18 | 12770424 | <filename>MAX6675/demo.py
from max6675 import MAX6675
from machine import Pin
import time
so = Pin(12, Pin.IN)
sck = Pin(14, Pin.OUT)
cs = Pin(16, Pin.OUT)
max = MAX6675(sck, cs , so)
for _ in range(10):
print(max.read())
time.sleep(1) | 2.59375 | 3 |
pylti1p3/contrib/django/oidc_login.py | edubadges/pylti1.3 | 62 | 12770425 | from django.http import HttpResponse # type: ignore
from pylti1p3.oidc_login import OIDCLogin
from pylti1p3.request import Request
from .cookie import DjangoCookieService
from .redirect import DjangoRedirect
from .request import DjangoRequest
from .session import DjangoSessionService
class DjangoOIDCLogin(OIDCLogin... | 1.96875 | 2 |
sciquence/sequences/cutting.py | krzjoa/sciquence | 8 | 12770426 | # <NAME> 2017
# sciquence: Time series & sequences in Python
#
# Functions for sequence processing
# Author: <NAME>
#
# License: MIT
import numpy as np
from itertools import groupby
############## Getting sequences ##############
def seq(array):
'''
Cut input array into sequences consisting of the same elem... | 3.46875 | 3 |
mmskeleton/utils/__init__.py | sj-li/PR-GCN | 5 | 12770427 | <filename>mmskeleton/utils/__init__.py
from .importer import import_obj, call_obj, set_attr, get_attr
from .checkpoint import load_checkpoint
__all__ = ['import_obj', 'call_obj', 'set_attr', 'get_attr', 'load_checkpoint'] | 1.335938 | 1 |
backup-23.09.2021/core/find_hot_functions.py | ComputerSystemsLaboratory/Code-Size-Prediction | 0 | 12770428 | import os
import csv
import yaml
import argparse
import numpy as np
from operator import itemgetter
from os import listdir
from os.path import isfile, join
""" Find the biggest files
"""
def Main():
parser = argparse.ArgumentParser()
parser.add_argument("dataset",
metavar='p0',
... | 2.734375 | 3 |
example.py | Techno263/python-minecraft-data | 0 | 12770429 | import minecraft_data
# Java edition minecraft-data
mcd = minecraft_data("1.13")
print(mcd.version)
print(mcd.find_item_or_block(1))
print(mcd.find_item_or_block('stone'))
print(mcd.recipes['5'][0])
print(mcd.windows['minecraft:brewing_stand'])
print(mcd.effects_name['Haste'])
# Pocket Edition minecraft-data
mcd_... | 2.4375 | 2 |
misago/threads/tests/test_post_model.py | HenryChenV/iJiangNan | 1 | 12770430 | <reponame>HenryChenV/iJiangNan<filename>misago/threads/tests/test_post_model.py
from datetime import timedelta
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.utils import timezone
from misago.categories.models import Category
from misago.threads.checksums import update_pos... | 2.390625 | 2 |
balanced_news/news/getnews/news_sites/getslate.py | thearyanmittal/news-aggregator | 0 | 12770431 | from ...models import Headline
import requests
from bs4 import BeautifulSoup
from datetime import datetime, time, timedelta
from dateparser import parse
def getslate(per_site):
url = 'https://slate.com/news-and-politics'
html = requests.get(url).text
soup = BeautifulSoup(html, 'lxml')
articles = soup.... | 2.78125 | 3 |
sts.py | dhruvildave/DenkInterpreter | 1 | 12770432 | ###############################################################################
# #
# SYMBOLS, TABLES, SEMANTIC ANALYSIS #
# #
... | 2.421875 | 2 |
shapesDetector.py | charlesaurav13/OpenCV | 22 | 12770433 | <gh_stars>10-100
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
def shapes():
img = cv.imread('./img/shapess.jpg')
img_gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
_, thresh = cv.threshold(img_gray, 240, 255, cv.THRESH_BINARY)
contours, _ = cv.findContours(thresh, cv.RETR_TREE... | 2.84375 | 3 |
tests/test_raw.py | fredstro/mrq | 745 | 12770434 | from mrq.job import Job
import datetime
from mrq.queue import Queue
import time
import pytest
@pytest.mark.parametrize(["p_queue", "p_pushback", "p_timed", "p_flags"], [
["test_timed_set", False, True, "--greenlets 10"],
["pushback_timed_set", True, True, "--greenlets 10"],
["test_sorted_set", False, Fals... | 2.0625 | 2 |
qf_lib/common/utils/miscellaneous/kelly.py | webclinic017/qf-lib | 198 | 12770435 | <reponame>webclinic017/qf-lib
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | 2.78125 | 3 |
exercicios/exercicio030.py | NicoCassio/cursoemvideo-python | 0 | 12770436 | <gh_stars>0
n = int(input('Número: '))
print('PAR' if n % 2 == 0 else 'ÍMPAR')
| 3.234375 | 3 |
homework_4.py | pyaiveoleg/computing_practicum | 0 | 12770437 | import math
from typing import Callable
class Method:
@staticmethod
def calculate(f: Callable, a: float, b: float):
pass
@staticmethod
def name():
pass
class left_rectangle(Method):
@staticmethod
def calculate(f: Callable, a: float, b: float):
return f(a) * (b - a)
... | 3.84375 | 4 |
servo/stats/queries.py | ipwnosx/Servo | 0 | 12770438 | # -*- coding: utf-8 -*-
import decimal
from django.db import connection
class StatsManager:
def __init__(self):
self.cursor = connection.cursor()
def _result(self, args):
result = []
self.cursor.execute(self.sql, args)
for k, v in self.cursor.fetchall():
... | 2.171875 | 2 |
src/spider/rssSpider.py | huobaolajiao/RsshubReader | 10 | 12770439 | # -*- coding: utf-8 -*-
"""
@author: wangyouqish
"""
import sys
sys.path.append("..")
import time,datetime
import pytz
import requests
import feedparser
import threading
import database.dbConn as dbConn
import log.logCenter as logCenter
def getFeedFromLink(url,name):
head = {'User-Agent': 'Mozilla/5.0 (Windows NT... | 2.5625 | 3 |
collectd.py | allegro/collectd | 0 | 12770440 | import re
import time
import socket
import struct
import logging
import traceback
from functools import wraps
try:
from Queue import Queue, Empty # Python 2
except ImportError:
from queue import Queue, Empty # Python 3
from collections import defaultdict
from threading import RLock, Thread, Semaphore
__all_... | 2.203125 | 2 |
tantum/model/vit_attention.py | dmitryshendryk/tantum | 0 | 12770441 |
import os
import cv2
import math
import random
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset
import timm
class VIT_Attention(nn.Module):
def __init__(self,
arch_name,
pretrained=False,
img_s... | 2.21875 | 2 |
pyecharts/charts/mixins.py | CharileWithZoe/pyecharts | 11,032 | 12770442 | from ..render import engine
class ChartMixin:
def add_js_funcs(self, *fns):
for fn in fns:
self.js_functions.add(fn)
return self
def load_javascript(self):
return engine.load_javascript(self)
class CompositeMixin(ChartMixin):
def __iter__(self):
for chart in ... | 2.0625 | 2 |
webtreasures/models/__init__.py | songzxDev/fortunecat | 0 | 12770443 | from webtreasures.models.fortunedrp import *
| 1.1875 | 1 |
src/backup.py | Kynda/Public-Utility-Scripts | 0 | 12770444 | #! /usr/bin/env python
from scp import SCPClient
import datetime
import paramiko
import argparse
import tarfile
import os
# Parse Command Line Arguments
description = '''
This script creates a tarball of a specified destination and copies it to a remote destination
using ssh on the destination. Requires configured ss... | 3.296875 | 3 |
model/encoder.py | ppujol76/-Pere_Transformers | 0 | 12770445 | from torch.functional import Tensor
import torchvision.models as models
import torch.nn as nn
class Encoder_VGG16(nn.Module):
def __init__(self):
super(Encoder_VGG16, self).__init__()
pretrained_model = models.vgg16(pretrained=True)
self.conv_base = pretrained_model.features
# Fre... | 2.640625 | 3 |
sdk/python/kfp/_credentials.py | Strasser-Pablo/pipelines | 1 | 12770446 | <reponame>Strasser-Pablo/pipelines<gh_stars>1-10
# Copyright 2021 Arrikto 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 r... | 2.328125 | 2 |
maze.py | ChaitanyaBhat/Maze-PyGame | 0 | 12770447 | <reponame>ChaitanyaBhat/Maze-PyGame
import pygame
import time
from pygame.locals import *
pygame.init()
class Player(pygame.sprite.Sprite):
def __init__(self,*kwargs):
super(Player,self).__init__(*kwargs)
# self.surf = pygame.Surface((10,10))
# self.surf.fill((0,0,255))
self.surf = ... | 3.375 | 3 |
meteor_aggregations_main.py | rahulthewaffle/aim-expedia-takehome | 0 | 12770448 | <reponame>rahulthewaffle/aim-expedia-takehome<filename>meteor_aggregations_main.py
import sys
import os
import argparse
from meteor_aggs_utils import setup_logger
from meteor_aggs import final_aggregations
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--bucket', action='sto... | 2.3125 | 2 |
assets/blender/delete_selected_recursive.py | revyTH/ludik | 0 | 12770449 | # Deletes selected objects recursively from the object hierarchy
import bpy
obj = bpy.context.object
stack = [obj]
while len(stack) > 0:
tmp = stack.pop()
if hasattr(tmp, "children"):
for child in tmp.children:
child.select = True
stack.append(child)
bpy.ops.object.delete() | 3.0625 | 3 |
attre2vec/aggregators/base.py | attre2vec/attre2vec | 0 | 12770450 | """Implementations of edge walk aggregators."""
import abc
import torch
from torch import nn
class BaseAggregator(abc.ABC, nn.Module):
"""Base class for edge walk aggregators."""
def __init__(self):
"""Inits BaseAggregator."""
super().__init__()
self._device = torch.device(
... | 2.734375 | 3 |