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 |
|---|---|---|---|---|---|---|
zhihuer/celery.py | guojy1314/stw1209 | 85 | 39800 | <gh_stars>10-100
# 在zhihuer项目目录下,
# cmd运行: celery -A zhihuer worker -l info (-A 默认寻找目录下的celery模块)
# 启动celery服务
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
from django.conf import settings
# 设置环境变量
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'zhihuer.settings')
# ... | 1.679688 | 2 |
cogs/youtube.py | RuiL1904/ruibot-discord.py | 0 | 39801 | import os
import nextcord as discord
from nextcord.ext import commands
import pytube
class Youtube(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(name = 'youtube', aliases = ['yt'])
async def youtube(self, context, url):
# Check if 20 intern... | 2.8125 | 3 |
saliency_web_mapper/config/environment.py | HeosSacer/saliency_web_mapper | 0 | 39802 | <filename>saliency_web_mapper/config/environment.py
from saliency_web_mapper.config.typesafe_dataclass import TypesafeDataclass
from typing import List, Dict, Tuple, Sequence
class SaliencyWebMapperEnvironment(TypesafeDataclass):
# Defaults with type
url: str = 'http://localhost:3001/'
window_name: str = ... | 2.03125 | 2 |
setup.py | web-eid/mobile-id-rest-python-client | 0 | 39803 | <reponame>web-eid/mobile-id-rest-python-client<gh_stars>0
import os
from setuptools import find_packages, setup
VERSION = "0.0.1"
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
description = "Estonian Mobile-ID Python client is an Python librar... | 1.78125 | 2 |
tests/core/test_setproctitle.py | STATION-I/STAI-blockchain | 10 | 39804 | <filename>tests/core/test_setproctitle.py
import unittest
from stai.util.setproctitle import setproctitle
class TestSetProcTitle(unittest.TestCase):
def test_does_not_crash(self):
setproctitle("stai test title")
| 2.03125 | 2 |
eurlex2lexparency/transformation/utils/liap.py | Lexparency/eurlex2lexparency | 0 | 39805 | """
"""
import re
from collections import namedtuple
from functools import lru_cache
from lexref.model import Value
__all__ = ['ListItemsAndPatterns']
romans_pattern = Value.tag_2_pattern('EN')['ROM_L'].pattern.strip('b\\()')
_eur_lex_item_patterns_en = { # key: (itemization-character-pattern, ordered [bool], fi... | 2.46875 | 2 |
setup.py | JulianGindi/auto-semver | 5 | 39806 | <gh_stars>1-10
from setuptools import setup
setup(
name="auto-semver",
version="0.8.0",
description="Semver swiss-army knife",
url="http://github.com/juliangindi/auto-semver",
author="<NAME>",
author_email="<EMAIL>",
license="MIT",
packages=["auto_semver"],
zip_safe=False,
entry... | 1.125 | 1 |
libyang/schema.py | pepa-cz/libyang-python | 0 | 39807 | # Copyright (c) 2018-2019 <NAME>
# Copyright (c) 2021 RACOM s.r.o.
# SPDX-License-Identifier: MIT
from contextlib import suppress
from typing import IO, Any, Dict, Iterator, Optional, Tuple, Union
from _libyang import ffi, lib
from .util import IOType, c2str, init_output, ly_array_iter, str2c
# --------------------... | 1.90625 | 2 |
2020/day-05/day-05b.py | BenjaminEHowe/advent-of-code | 0 | 39808 | <reponame>BenjaminEHowe/advent-of-code
seats = []
with open("input.txt") as f:
for line in f:
line = line.replace("\n", "")
seat = {}
seat["raw"] = line
seat["row"] = int(seat["raw"][:7].replace("F", "0").replace("B", "1"), 2)
seat["column"] = int(seat["raw"][-3:].replace("L... | 3.109375 | 3 |
crmsystem/__init__.py | iomegak12/pythondockertry | 0 | 39809 | <reponame>iomegak12/pythondockertry
from .config import GlobalConfiguration
from .controllers import DataController
from .utilities import ErrorProvider, CustomerEncoder, OrderEncoder, PrettyTableGenerator
from .services import CustomerService, OrderService
from .models import Customer, Order, CRMSystemError
from .deco... | 1.117188 | 1 |
aliquotmaf/subcommands/vcf_to_aliquot/runners/gdc_1_0_0_aliquot.py | NCI-GDC/aliquot-maf-tools | 1 | 39810 | """Main vcf2maf logic for spec gdc-1.0.0-aliquot"""
import urllib.parse
from operator import itemgetter
import pysam
from maflib.header import MafHeader, MafHeaderRecord
from maflib.sort_order import BarcodesAndCoordinate
from maflib.sorter import MafSorter
from maflib.validation import ValidationStringency
from mafli... | 2.28125 | 2 |
shortly/settings.py | fengsp/shortly | 11 | 39811 | # -*- coding: utf-8 -*-
"""
shortly.settings
~~~~~~~~~~~~~~~~
Shortly config.
:copyright: (c) 2014 by fsp.
:license: BSD.
"""
import os
DEBUG = False
# Detect environment by whether debug named file exists or not
if os.path.exists(os.path.join(os.path.dirname(__file__), 'debug')):
DEBUG = T... | 1.460938 | 1 |
examples/fiber_tractography/TractographyHelper.py | MIC-DKFZ/cmdint | 8 | 39812 | <gh_stars>1-10
from cmdint import CmdInterface
import numpy as np
from shutil import copyfile
from dipy.io import read_bvals_bvecs
import os
""" This exapmple contains two classes that help with fiber tractography using MITK Diffusion and MRtrix. It is only
intended as a larger example of multiple usages of CmdInterfa... | 2.53125 | 3 |
tests/misc/normalize_volume.py | ysatapathy23/TomoEncoders | 1 | 39813 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
import sys
import matplotlib.pyplot as plt
import numpy as np
# from tomo_encoders.misc_utils.feature_maps_vis import view_midplanes
import cupy as cp
import time
import h5py
#from recon_subvol import fbp_filter, recon_patch
# from tomo_encoders import ... | 2.1875 | 2 |
deeptrade/__init__.py | deeptrade-tech/deeptrade_api | 1 | 39814 | from __future__ import absolute_import, division, print_function
# configuration variables
api_key = None
api_base = "https://www.deeptrade.ch/"
# API sentiment
from deeptrade.sentiment import *
# API stocks
from deeptrade.stocks import *
| 1.296875 | 1 |
Movie_IMDB/process_3.py | likelyzhao/Homeland | 0 | 39815 | <gh_stars>0
# -*- coding:utf-8 -*-
import os
import json
access_key = 'Access_Key'
secret_key = 'Secret_Key'
bucket_name = 'Bucket_Name'
bucket_based_url = "Based_url"
localfile = 'bbb.png'
json_file = 'splits.json'
threshold = 0.5
#movie_header = 'http://ozqw10x19.bkt.clouddn.com/IMDB评选TOP250/'
def _mkdir(path):
if... | 2.296875 | 2 |
maad/cluster/__init__.py | jflatorreg/scikit-maad | 3 | 39816 | <gh_stars>1-10
# -*- coding: utf-8 -*-
""" cluster functions for scikit-maad
Cluster regions of interest using High Dimensional Data Clsutering (HDDC).
"""
from .hdda import (HDDC)
from .cluster_func import (do_PCA)
__all__ = ['HDDC',
'do_PCA']
| 1.257813 | 1 |
pipng/imagescale/Globals.py | nwiizo/joke | 1 | 39817 | #!/usr/bin/env python3
# Copyright © 2012-13 Qtrac Ltd. All rights reserved.
# This program or module is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option)... | 1.476563 | 1 |
explore_dataset.py | andreybicalho/attention-ocr-1 | 0 | 39818 | import random
from PIL import Image
from captcha.image import ImageCaptcha
from utils.dataset import CaptchaDataset
from utils.img_util import display_images
from torchvision import transforms
import numpy as np
img_width = 160
img_height = 60
n_chars = 7
chars = list('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHI... | 2.71875 | 3 |
features/extract_features_buckeye.py | kamperh/bucktsong_eskmeans | 1 | 39819 | #!/usr/bin/env python
"""
Extract MFCC and filterbank features for the Buckeye dataset.
Author: <NAME>
Contact: <EMAIL>
Date: 2019, 2021
"""
from datetime import datetime
from os import path
from tqdm import tqdm
import argparse
import numpy as np
import os
import sys
sys.path.append("..")
from paths import buckey... | 2.859375 | 3 |
by-session/ta-921/j8/atal_matal.py | amiraliakbari/sharif-mabani-python | 2 | 39820 | def f(a, start):
if len(a) == 1:
return a[0]
d = (start + 15 - 1) % len(a)
del a[d]
return f(a, d % len(a))
n = int(input())
print 1 + f(range(n*2), 0) / 2
| 2.90625 | 3 |
examples/old-examples/pygame/01_hello_world.py | Vallentin/ModernGL | 0 | 39821 | <filename>examples/old-examples/pygame/01_hello_world.py
import struct
import ModernGL
import pygame
from pygame.locals import DOUBLEBUF, OPENGL
pygame.init()
pygame.display.set_mode((800, 600), DOUBLEBUF | OPENGL)
ctx = ModernGL.create_context()
vert = ctx.vertex_shader('''
#version 330
in vec2 vert;
v... | 2.796875 | 3 |
phpme/binx/console.py | eghojansu/phpme | 0 | 39822 | import os, json, subprocess
class Console():
"""Run PHP job"""
def get_interface_methods(namespace):
try:
output = Console.run_command('interface-methods', [namespace])
return json.loads(output)
except Exception as e:
return {}
def get_class_methods(n... | 2.625 | 3 |
app/core/tests/test_models.py | prafullkumar41/recipe-app-api | 0 | 39823 | from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email(self):
'''Tet creating a new user with an email is sucessfull'''
email = '<EMAIL>'
password = '<PASSWORD>'
user = get_user_model().objects.cre... | 2.828125 | 3 |
oyProjectManager/models/entity.py | gcodebackups/oyprojectmanager | 1 | 39824 | <reponame>gcodebackups/oyprojectmanager
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2014, <NAME>
#
# This module is part of oyProjectManager and is released under the BSD 2
# License: http://www.opensource.org/licenses/BSD-2-Clause
from exceptions import TypeError
import os
import jinja2
from sqlalchemy import Uniqu... | 1.890625 | 2 |
setup.py | Omerdan03/dog_scraper | 0 | 39825 | <reponame>Omerdan03/dog_scraper<filename>setup.py
import os
from setuptools import setup, find_namespace_packages
requirements = open('requirements.txt').readlines()
with open(os.path.normpath(os.path.join(__file__, '../scraper/VERSION'))) as f:
__version__ = f.readline(0)
setup(name='dog-scraper',
version... | 1.664063 | 2 |
uni_ticket/migrations/0176_ticketcategorywsprotocollo_protocollo_uo_rpa_matricola.py | biotech2021/uniTicket | 15 | 39826 | <reponame>biotech2021/uniTicket
# Generated by Django 3.2.7 on 2021-11-11 09:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uni_ticket', '0175_alter_ticketcategorywsprotocollo_protocollo_uo_rpa'),
]
operations = [
migrations.AddFiel... | 1.3125 | 1 |
slowfast/config/custom_config.py | bqhuyy/SlowFast-clean | 0 | 39827 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Add custom configs and default values"""
from fvcore.common.config import CfgNode
def add_custom_config(_C):
# Knowledge distillation
_C.KD = CfgNode()
# If True enable KD, else skip KD.
_C.KD.ENABLE = ... | 1.84375 | 2 |
edan.py | Smithsonian/EDAN-python | 1 | 39828 | <gh_stars>1-10
#!/usr/bin/env python3
#
# Search metadata in the EDAN API
# v0.1
#
import urllib.parse
import urllib.request
import datetime
import email.utils
import uuid
import hashlib
import json
from base64 import b64encode
#for testing
from urllib.request import Request, urlopen
from urllib.error import URLErro... | 2.421875 | 2 |
dash_docs/chapters/dash_bio/examples/ideogram.py | joelostblom/dash-docs | 379 | 39829 | import dash
import dash_bio as dashbio
import dash_html_components as html
import dash_core_components as dcc
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
'Select which chromosomes to display on ... | 2.5 | 2 |
blockchain/node.py | EnniOne/minimum_viable_block_chain | 0 | 39830 | from blockchain import Blockchain, Transaction
from nacl.signing import SigningKey
from hashlib import sha256
from time import sleep
from threading import Thread
import random
class Node:
"""Represent a Node."""
def __init__(self, neighbours, unverified_transactions_pool):
"""
Initialize the ... | 2.890625 | 3 |
mmocr/models/common/__init__.py | yangrisheng/mmocr | 2 | 39831 | <reponame>yangrisheng/mmocr
# Copyright (c) OpenMMLab. All rights reserved.
from . import backbones, layers, losses, modules
from .backbones import * # NOQA
from .layers import * # NOQA
from .losses import * # NOQA
from .modules import * # NOQA
__all__ = backbones.__all__ + losses.__all__ + layers.__all__ + module... | 0.867188 | 1 |
Task1B.py | lhliew/flood-warning | 0 | 39832 | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 29 16:13:48 2017
@author: laide
"""
"""prints a list of tuples (station name, town, distance) for the 10 closest
and the 10 furthest stations from the Cambridge city centre, (52.2053, 0.1218)."""
from floodsystem.geo import stations_by_distance
from floodsystem.stationda... | 3.78125 | 4 |
tests/run-tests.py | notofonts/NotoSansDuployan | 6 | 39833 | #!/usr/bin/env python3
# Copyright 2018-2019 <NAME>
# Copyright 2020-2021 Google LLC
#
# 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
#
# Un... | 2 | 2 |
TagScreen.py | CMPUT-291-Miniproject/MiniProject-1 | 0 | 39834 | <filename>TagScreen.py
from Tag import Tag
from CheckInput import CheckInput
from PostQuery import QuestionQuery
from PostQuery import AnswerQuery
class TagScreen:
"""
A screen which handles adding a tag to a post
This module is responsible for providing the UI of the screen
which the user can interface with to a... | 3.6875 | 4 |
sta663_project_lda/algorithms/lda_gibbs.py | haofuml/sta663_project_lda | 3 | 39835 | <reponame>haofuml/sta663_project_lda<gh_stars>1-10
"""
Collapsed Gibbs Sampling Implementation of LDA
"""
import numpy as np
import sys
import random
from scipy.special import gamma, gammaln, psi
from scipy.stats import *
from scipy import *
import argparse
from sta663_project_lda.visualization.demo_topics import topic... | 2.234375 | 2 |
FrontEnd/app/socket_client_side.py | ahmobayen/image_processing | 0 | 39836 | <filename>FrontEnd/app/socket_client_side.py<gh_stars>0
#!/usr/bin/env python3
import os.path
import pickle
import struct
import socket
import selectors
sel = selectors.DefaultSelector()
messages = [b'Video Request']
def video_receive():
HOST = "127.0.0.1" # The server's hostname or IP address
PORT = 65432 ... | 2.953125 | 3 |
notebooks/myhmm.py | RonDen/HanTokenization | 3 | 39837 | import re
import os
from prob import trans_P, emit_P, start_P
from preprocess import preprocess, recov, UNK
DATAROOT = '/home/luod/class/nlp/HanTokenization/datasets'
RESULTROOT = '/home/luod/class/nlp/HanTokenization/results'
VOCAB_FILE = os.path.join(DATAROOT, 'training_vocab.txt')
VOCAB_FREQ = os.path.join(RESULTR... | 2.046875 | 2 |
tests/test_vidkl.py | ziatdinovmax/gpax | 13 | 39838 | <filename>tests/test_vidkl.py<gh_stars>10-100
import sys
import pytest
import numpy as onp
import jax.numpy as jnp
import jax
import haiku as hk
import numpyro
from numpy.testing import assert_equal, assert_array_equal
sys.path.insert(0, "../gpax/")
from gpax.vidkl import viDKL, MLP
from gpax.utils import get_keys
... | 2.0625 | 2 |
module3-nosql-and-document-oriented-databases/mongoDB.py | cocoisland/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 39839 | #!/usr/bin/env python
import pymongo
conn_string="mongodb://dbUser19:LSVyKnHW@cluster<EMAIL>-00-0<EMAIL>.mongodb.<EMAIL>:27017,cluster0-shard-00-01-nadgn.mongodb.net:27017,cluster0-shard-00-02-nadgn.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true"
client=pymongo.MongoCli... | 1.9375 | 2 |
tests/test_helper.py | ajctrl/pysesameos2 | 16 | 39840 | <filename>tests/test_helper.py
#!/usr/bin/env python
"""Tests for `pysesameos2` package."""
import pytest
from pysesameos2.helper import (
CHProductModel,
CHSesame2MechSettings,
CHSesame2MechStatus,
CHSesameBotButtonMode,
CHSesameBotLockSecondsConfiguration,
CHSesameBotMechSettings,
CHSes... | 2.546875 | 3 |
test_migrations/contrib/pytest_plugin/plugin.py | skarzi/django-test-migrations | 4 | 39841 | import pytest
from test_migrations import constants
from .fixtures import migrator # pylint: disable=W0611
pytest_plugins = ['pytest_django'] # pylint: disable=C0103
def pytest_load_initial_conftests(early_config):
# Register the marks
early_config.addinivalue_line(
'markers',
(
... | 1.945313 | 2 |
hrp/models.py | paleocore/paleocore110 | 0 | 39842 | import os
from django.contrib.gis.db import models
from hrp.ontologies import *
# from hrp.ontologies import ITEM_TYPE_VOCABULARY, HRP_COLLECTOR_CHOICES, \
# HRP_COLLECTING_METHOD_VOCABULARY, HRP_BASIS_OF_RECORD_VOCABULARY, HRP_COLLECTION_CODES
from django.contrib.gis.geos import Point
import projects.models
cl... | 2.0625 | 2 |
sfepy/discrete/dg/limiters.py | BubuLK/sfepy | 2 | 39843 | <reponame>BubuLK/sfepy
# -*- coding: utf-8 -*-
"""
Limiters for high order DG methods
"""
import numpy as nm
from sfepy.discrete.dg.poly_spaces import iter_by_order
from sfepy.discrete.dg.fields import get_raveler, get_unraveler
from sfepy.base.base import output
MACHINE_EPS = 1e-30
def minmod(a, b, c):
"""Minm... | 2.421875 | 2 |
yarn_list_utils/Utils.py | windgeek/bigdata_cus | 0 | 39844 | <reponame>windgeek/bigdata_cus<filename>yarn_list_utils/Utils.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by wind on 2021/4/21
import requests
import json
import time
class Utils:
'''
@staticmethod
def fetchJsonToList(url, root, subitem):
response = requests.get(url)
try:
... | 2.34375 | 2 |
api/views/errors.py | rubycho/webpi | 5 | 39845 | <filename>api/views/errors.py
import enum
from typing import List
from rest_framework import status
from rest_framework.response import Response
class DataType(enum.Enum):
"""
Constants, used on generating error strings.
"""
QUERY = 'query'
PARAM = 'param'
BODY = 'body'
def extract_data(da... | 2.765625 | 3 |
object-oriented-programming/src/oop-interface.py | giserh/book-python | 1 | 39846 | class MLModelInterface:
def fit(self, features, labels):
raise NotImplementedError
def predict(self, data):
raise NotImplementedError
class KNeighborsClassifier(MLModelInterface):
def fit(self, features, labels):
pass
def predict(self, data):
pass
class LinearRegres... | 2.921875 | 3 |
main.py | celikmustafa89/streaming-standardization | 0 | 39847 | import random
import math
listes = []
"""for i in range(3):
# listes.append(random.sample(range(5, 50), random.randint(5,1000)))
listes.append(random.sample(range(1, 100), 10))
"""
listes = [
[10,20,30,90,30,54,123,34,656,246,24,842,6784,2,56,4,5,7423,6,6,3,345,6,7,345,46],
[10,20,30,90],
[10,20,... | 3.59375 | 4 |
binding.gyp | artik-snu/node-addon-gpio | 0 | 39848 | {
"targets": [
{
"target_name": "gpio",
"sources": ["gpio.cc", "tizen-gpio.cc"]
}
]
} | 1 | 1 |
webauthn/helpers/parse_client_data_json.py | MasterKale/py_webauthn | 0 | 39849 | <reponame>MasterKale/py_webauthn<filename>webauthn/helpers/parse_client_data_json.py
import json
from json.decoder import JSONDecodeError
from .base64url_to_bytes import base64url_to_bytes
from .exceptions import InvalidClientDataJSONStructure
from .structs import CollectedClientData, TokenBinding
def parse_client_d... | 2.625 | 3 |
tests/python/pants_test/backend/jvm/tasks/jvm_compile/test_resource_mapping.py | WamBamBoozle/pants | 0 | 39850 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from pant... | 2.1875 | 2 |
examples/basic_events.py | Shadofer/dogey | 3 | 39851 | from dogey import Dogey
from dogey.classes import Message, User, Room, Context
from dogey.exceptions import DogeyCommandError
dogey = Dogey(token='your token', refresh_token='<PASSWORD> refresh token', prefix='.')
bot = dogey.bot
@dogey.event
async def on_ready():
print(f'{bot.name} is up! (prefix is {bot.prefix... | 2.515625 | 3 |
algorithm/deep_learning/neural_network6.py | kake777/python_sample | 0 | 39852 | #ミニバッチ学習
import numpy as np
from dataset.mnist import load_mnist
(x_train, t_train), (x_test, t_test) =\
load_mnist(normalize=True, one_hot_label=True)
print(x_train.shape)
print(t_train.shape)
train_size = x_train.shape[0]
batch_size = 10
batch_mask = np.random.choice(train_size, batch_size)
x_batch = x_train[b... | 3.546875 | 4 |
openport/common/tee.py | Deshdeepak1/openport | 5 | 39853 | import sys
class TeeStdOut(object):
def __init__(self, name, mode):
self.file = open(name, mode)
self.stdout = sys.stdout
sys.stdout = self
def close(self):
if self is None:
return
if self.stdout is not None:
sys.stdout = self.stdout
... | 3.125 | 3 |
main.py | vk02169/photobooth_raspi3 | 1 | 39854 | <filename>main.py
##################################################################################################################################
# The original photobooth application was written by WYLUM. I have borrowed from their code base and the proceeded to enhance/subtract.
# Especially the part where the ap... | 2 | 2 |
globalCounter/server/counter_server.py | aratz-lasa/globalCounter | 2 | 39855 | import socket
from multiprocessing import Pool, Queue, Manager, cpu_count
from ..protocol.methods import *
from ..protocol.models import *
from ..various.abc import CounterServer
MAX_WORKERS = cpu_count()
class UDPCounterServer(CounterServer):
def __init__(self, ip="0.0.0.0", port=0, max_workers=MAX_WORKERS):
... | 2.78125 | 3 |
src/fparser/two/tests/fortran2003/test_format_item_c1002.py | sturmianseq/fparser | 33 | 39856 | # Copyright (c) 2019 Science and Technology Facilities Council
# All rights reserved.
# Modifications made as part of the fparser project are distributed
# under the following license:
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condi... | 1.257813 | 1 |
nomaj/nj/nj_fixed.py | monomonedula/nomaj | 0 | 39857 | <filename>nomaj/nj/nj_fixed.py
from typing import Callable, Awaitable, Dict
from koda import Result, Ok
from nvelope import JSON
from nomaj.nomaj import Nomaj, Req, Resp
class NjFixed(Nomaj):
def __init__(self, resp: Resp):
self._resp: Ok[Resp] = Ok(resp)
async def respond_to(self, request: Req) ->... | 2.203125 | 2 |
flask_app/dash/orange/models.py | julien-bonnefoy/website | 0 | 39858 | <reponame>julien-bonnefoy/website
# -*- coding: utf-8 -*-
from sqlalchemy import Column, Integer, String, Sequence, Text, Table
from sqlalchemy import ForeignKey, Boolean, DateTime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
import redis
import rq
import datetime as ... | 2.171875 | 2 |
cms/templatetags/watch.py | sandmark/DjangoPerfectSquare | 0 | 39859 | from django import template
from django.utils.http import urlquote
import re
register = template.Library()
@register.filter
def quote_filepath(url):
_, scheme, path = re.split(r'(https?://)', url)
return '{}{}'.format(scheme, urlquote(path))
| 2.15625 | 2 |
model/transformer.py | scut-bds/exampe_repo_from_scutbds | 0 | 39860 | <reponame>scut-bds/exampe_repo_from_scutbds
# coding=utf-8
# Copyright 2021 South China University of Technology and
# Engineering Research Ceter of Minstry of Education on Human Body Perception.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance w... | 2.234375 | 2 |
src/lib/idol/dataclass/codegen/schema/primitive_type.py | lyric-com/idol | 0 | 39861 | <filename>src/lib/idol/dataclass/codegen/schema/primitive_type.py
# DO NOT EDIT
# This file was generated by idol_data, any changes will be lost when idol_data is rerun again
from enum import Enum
class SchemaPrimitiveTypeEnum(Enum):
INT = "int"
DOUBLE = "double"
STRING = "string"
BOOL = "bool"
AN... | 2.1875 | 2 |
tests/test_requirements_files/app.py | Robinson04/serverlesspack | 1 | 39862 | from pydantic import BaseModel
from typing import Optional
class RequestDataModel(BaseModel):
loginToken: str
def login_with_google(data: dict):
request_data = RequestDataModel(**data)
from google.oauth2 import id_token
from google.auth.transport.requests import Request as GoogleRequest
user_info... | 2.796875 | 3 |
nickleback.py | helanan/kill_nickleback | 0 | 39863 | <reponame>helanan/kill_nickleback
songs = { ('Nickelback', 'How You Remind Me'), ('Will.i.am', 'That Power'), ('<NAME>', 'Stella by Starlight'), ('Nickelback', 'Animals') }
# Using a set comprehension, create a new set that contains all songs that were not performed by Nickelback.
nonNickelback = {}
| 2.875 | 3 |
siam_tracker/benchmarks/otb/butil/seq_config.py | songheony/SPM-Tracker | 32 | 39864 | <reponame>songheony/SPM-Tracker
import zipfile
import shutil
import copy
import json
from PIL import Image
from ..config import *
from ..model import *
from .split_seq import split_seq_TRE
from .shift_bbox import shift_init_BB
import logging
logging.getLogger().setLevel(logging.INFO)
def get_sub_seqs(s, numSeg, eva... | 1.992188 | 2 |
main.py | mneeman/Removing_atmospheric_turbulence | 4 | 39865 | <gh_stars>1-10
import multiprocessing
multiprocessing.set_start_method('spawn', True)
import argparse
import os
import numpy as np
import math
import sys
import torchvision
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
from torchvision import datasets
from torchvision.utils impo... | 2.15625 | 2 |
change_brightness.py | qLethon/bin_picking_robot | 0 | 39866 | from PIL import Image, ImageEnhance
import os
import argparse
def change_brightness(source_dir, save_dir, brightness):
os.makedirs(save_dir, exist_ok=True)
image_pathes = [f for f in os.scandir(source_dir) if f.is_file()]
for image_path in image_pathes:
save_path = os.path.join(save_dir, image_path... | 3.046875 | 3 |
handlers/changing_stickerpack_handl.py | bbt-t/bot-pet-project | 0 | 39867 | <reponame>bbt-t/bot-pet-project
from aiogram.dispatcher import FSMContext
from aiogram.types import CallbackQuery
from handlers.states_in_handlers import UserSettingStates
from loader import dp
from utils.keyboards.start_handl_choice_kb import get_start_keyboard
@dp.callback_query_handler(text='set_skin', state=User... | 2.0625 | 2 |
DebugLibrary/robotvar.py | lobinho/robotframework-debuglibrary | 93 | 39868 | def assign_variable(robot_instance, variable_name, args):
"""Assign a robotframework variable."""
variable_value = robot_instance.run_keyword(*args)
robot_instance._variables.__setitem__(variable_name, variable_value)
return variable_value
| 2.765625 | 3 |
objectModel/Python/tests/storage/test_github.py | rt112000/CDM | 884 | 39869 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
import json
import unittest
import unittest.mock as mock
import random
from tests.common import async_test
from cdm.storage.github import GithubAdapter
class Gi... | 2.390625 | 2 |
speedTester/logs/average.py | saurabhcommand/Hello-world | 1,428 | 39870 | <reponame>saurabhcommand/Hello-world
file1 = open("./logs/pythonlog.txt", 'r+')
avg1 = 0.0
lines1 = 0.0
for line in file1:
lines1 = lines1 + 1.0
avg1 = (avg1 + float(line))
avg1 = avg1/lines1
print(avg1, "for Python with", lines1, "lines")
file2 = open("./logs/clog.txt", 'r+')
avg2 = 0.0
lines2 = 0.0
for line... | 3.3125 | 3 |
test/test_handlers.py | abstractR/ext_logging | 0 | 39871 | import json
import errno
import os
import ext_logging
from . import BaseTestCase, log
class TraceCase(BaseTestCase):
def test_multiple_handlers(self):
log_conf_sysl = {
'handler': 'ext_logging.handlers.StdOutExtendedSysLogHandler',
'level': 'DEBUG',
'json_serializer'... | 2.171875 | 2 |
setup.py | opacam/python3-tmdb3 | 2 | 39872 | <gh_stars>1-10
#!/usr/bin/env python
import sys
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
wd = os.path.dirname(os.path.abspath(__file__))
os.chdir(wd)
sys.path.insert(1, wd)
name = 'tmdb3'
pkg = __import__('tmdb3')
author, email = pkg.__author__.rsplit... | 1.664063 | 2 |
Linked List/142. Linked List Cycle II.py | xli1110/LC | 2 | 39873 | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def detectCycle(self, head: ListNode) -> ListNode:
if head is None:
return None
# 1 - check cycle
p1 = head
p2 = head.next
... | 3.890625 | 4 |
simpleml/models/classifiers/sklearn/mixture.py | ptoman/SimpleML | 15 | 39874 | '''
Wrapper module around `sklearn.mixture`
'''
__author__ = '<NAME>'
from .base_sklearn_classifier import SklearnClassifier
from simpleml.models.classifiers.external_models import ClassificationExternalModelMixin
from sklearn.mixture import BayesianGaussianMixture, GaussianMixture
'''
Gaussian Mixture
'''
class... | 2.203125 | 2 |
Configuration/Generator/python/ZPrime5000JJ_8TeV_TuneCUETP8M1_cfi.py | ckamtsikis/cmssw | 6 | 39875 | import FWCore.ParameterSet.Config as cms
from Configuration.Generator.Pythia8CommonSettings_cfi import *
from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import *
generator = cms.EDFilter("Pythia8GeneratorFilter",
#pythiaHepMCVerbosity = cms.untracked.bool(False),
... | 1.25 | 1 |
fairseq/modules/Z_layer/multi_phrase_attention.py | salvation-z/fairseq | 1 | 39876 | # 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.
# Copied from multihead_attention.py
# Change it for phrase level gaussian attention
# TODO:
# 1. Graph based function
# 2. Convlution based f... | 2.53125 | 3 |
tools/bacommon/__init__.py | ritiek/ballistica | 0 | 39877 | <gh_stars>0
# Released under the MIT License. See LICENSE for details.
#
"""Bits of functionality common to ballistica client and server components."""
| 0.90625 | 1 |
tensorflow_ranking/python/keras/estimator_test.py | renyi533/ranking | 2,482 | 39878 | <filename>tensorflow_ranking/python/keras/estimator_test.py
# Copyright 2021 The TensorFlow Ranking Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lice... | 2.046875 | 2 |
tests/tests/screens/screens/test_screens.py | centergy/flex_ussd | 0 | 39879 | from flex.ussd.screens import UssdScreen
class AbsractOne(UssdScreen):
class Meta:
abstract = True
class Home(AbsractOne):
pass
| 1.429688 | 1 |
k-means.py | JoelRamosC/Algorithms_PYTHON | 0 | 39880 | # -*- coding: utf-8 -*-
# Fonte https://realpython.com/k-means-clustering-python/
# Clustering is a set of techniques used to partition data into groups, or clusters. Clusters are loosely defined as groups of data objects that are more similar to other objects in their cluster than they are to data objects in oth... | 4.125 | 4 |
Imaging/Core/Testing/Python/TestImageProjection.py | jasper-yeh/VtkDotNet | 3 | 39881 | <gh_stars>1-10
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# this script tests vtkImageSlab with various axes permutations,
# in order to cover a nasty set of "if" statements that check
# the intersections of the raster lines w... | 2.109375 | 2 |
tests/pipelines/test_context_factory.py | dpasse/eeyore | 0 | 39882 | <reponame>dpasse/eeyore
import os
import sys
sys.path.insert(0, os.path.abspath('src'))
from eeyore_nlp.pipelines import ContextFactory, \
TextPipeline, \
ContractionsTextPipe, \
PreTaggedContextFactory
def test_contex... | 2.46875 | 2 |
l5q1.py | gonewithharshwinds/itt-lab | 1 | 39883 | <reponame>gonewithharshwinds/itt-lab
#!/usr/bin/python
def add(a,b):
return a+b
def sub(a,b):
return a-b
def mul(a,b):
return a*b
def div(a,b):
return a/b
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print("Please select operation : \n" \
"1. Addit... | 3.828125 | 4 |
Task/Sokoban/Python/sokoban.py | LaudateCorpus1/RosettaCodeData | 1 | 39884 | from array import array
from collections import deque
import psyco
data = []
nrows = 0
px = py = 0
sdata = ""
ddata = ""
def init(board):
global data, nrows, sdata, ddata, px, py
data = filter(None, board.splitlines())
nrows = max(len(r) for r in data)
maps = {' ':' ', '.': '.', '@':' ', '#':'#', '$'... | 3.140625 | 3 |
tests/test_thornthwaite.py | gastoneb/PyETo | 100 | 39885 | """
Unit test script for pyeto.thornthwaite.py
"""
import unittest
import pyeto
class TestThornthwaite(unittest.TestCase):
def test_monthly_mean_daylight_hours(self):
# Test against values for latitude 20 deg N from Bautista et al (2009)
# Calibration of the equations of Hargreaves and Thornthw... | 2.609375 | 3 |
openmdao.lib/src/openmdao/lib/optproblems/sellar.py | OzanCKN/OpenMDAO-Framework | 1 | 39886 | <filename>openmdao.lib/src/openmdao/lib/optproblems/sellar.py
"""
Two discipline components.
From Sellar's analytic problem.
<NAME>., <NAME>., and <NAME>., Response Surface Based, Concur-
rent Subspace Optimization for Multidisciplinary System Design," Proceedings
References 79 of the 34th AIAA Aerospace S... | 2.328125 | 2 |
video/emotion_detection_camera.py | xii1/image-classifier-service | 0 | 39887 | import cv2
from ml.facial_expression_classification import predict_facial_expression_by_array, IMAGE_WIDTH, IMAGE_HEIGHT
from video.camera import Camera
OPENCV_HAARCASCADE_FRONTALFACE_FILE = 'trained_models/opencv/haarcascades/haarcascade_frontalface_alt.xml'
class EmotionDetectionCamera(Camera):
def __init__(s... | 3.1875 | 3 |
vb2py/test_at_scale/testheinsega.py | ceprio/xl_vb2py | 0 | 39888 |
import unittest
from vb2py.test_at_scale import file_tester
class Test_heinsega(file_tester.FileTester):
def test0(self):
self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/Module1.bas')
def test1(self):
self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/... | 2.046875 | 2 |
scripts/forecast_models_ex.py | chiara87todaro/1C_PYproject | 0 | 39889 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 17 10:23:50 2019
@author: chiara
"""
import os
import numpy as np # scientific calculation
import pandas as pd # data analysis
import itertools
import warnings
from statsmodels.tsa.arima_model import ARMA
ts1=list(range(0,500,2))
len(ts1)
mode... | 2.296875 | 2 |
app/front/forms.py | karilint/TaxonManager | 0 | 39890 | <gh_stars>0
# Copyright 2020 <NAME>, <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 2.0625 | 2 |
src/reddack/cli.py | diatomicDisaster/Reddit-Slackbot | 0 | 39891 | # Future imports
from __future__ import (
annotations
)
# Standard imports
import argparse
from typing import (
Sequence
)
from pathlib import Path
# Local imports
import reddack
import reddack.config
import reddack.utils
def create_arg_parser() -> argparse.ArgumentParser:
"""Create the argument parser f... | 2.546875 | 3 |
src/TSP/DP.py | ox4f5da2/TSP | 0 | 39892 | <reponame>ox4f5da2/TSP
import time
import numpy as np
import utils # 自定义工具函数包
inf = 10e7 # 定义无穷大值
def getMinDistance(point, cityNum, dp):
"""
得到动态规划后的列表
:param point: 城市距离矩阵 ndarray
:param cityNum: 城市数量 int
:return: dp列表 list
"""
column = 1 << (cityNum - 1) # dp数组的列数
# 初始化dp数组第一列
for i in range(ci... | 2.71875 | 3 |
Chapter09/others/convertor.py | PacktPublishing/Machine-Learning-for-Mobile | 13 | 39893 | import tfcoreml as tf_converter
tf_converter.convert(tf_model_path = 'retrained_graph.pb',
mlmodel_path = 'converted.mlmodel',
output_feature_names = ['final_result:0'],
image_input_names = 'input:0',
class_labels = 'retrained_labels.tx... | 2.171875 | 2 |
pythem-master/pythem/modules/fuzzer.py | Marzooq13579/Hack-Gadgets | 8 | 39894 | <gh_stars>1-10
#!/usr/bin/env python2.7
# Copyright (c) 2016-2018 <NAME>
#
# This file is part of the program pythem
#
# pythem is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# Licens... | 2.765625 | 3 |
attention/utils/metadata.py | fbickfordsmith/attention-iclr | 0 | 39895 | <filename>attention/utils/metadata.py
"""
Define metadata variables used throughout the repository.
"""
import numpy as np
import pandas as pd
from scipy.spatial.distance import squareform
from sklearn.metrics.pairwise import cosine_distances
from ..utils.paths import path_metadata, path_representations, path_results
... | 2.015625 | 2 |
Grokking-Algorithms/Greedy/classRoomScheduling.py | javokhirbek1999/AlgorithmsDS | 6 | 39896 |
# The classroom scheduling problem
# Suppose you have a classroom and you want to hold as many classes as possible
# __________________________
#| class | start | end |
#|_______|_________|________|
#| Art | 9:00 am | 10:30am|
#|_______|_________|________|
#| Eng | 9:30am | 10:30am|
#|_______|_________|_____... | 4 | 4 |
app/tests/checkout_backend/uses_cases/test_total_amount_processor.py | jcazallasc/lana-python-challenge | 0 | 39897 | from django.test import TestCase
from checkout_backend.entities.offer_entity import OfferEntity
from checkout_backend.entities.product_entity import ProductEntity
from checkout_backend.uses_cases.total_amount_processor import TotalAmountProcessor
class OffersTestCase(TestCase):
def setUp(self):
self.pro... | 2.46875 | 2 |
wavelink/__init__.py | hamza1311/Wavelink | 0 | 39898 | __title__ = 'WaveLink'
__author__ = 'EvieePy'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019-2020 (c) PythonistaGuild'
__version__ = '0.6.0'
from .client import Client
from .errors import *
from .eqs import *
from .events import *
from .player import *
from .node import Node
from .websocket import WebSocket
| 1.453125 | 1 |
Domain/restaurantvalidator.py | VargaIonut23/restaurant | 0 | 39899 | class restaurantvalidator():
def valideaza(self, restaurant):
erori = []
if len(restaurant.nume) == 0:
erori.append('numele nu trb sa fie null')
if erori:
raise ValueError(erori)
| 3.25 | 3 |