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 |
|---|---|---|---|---|---|---|
tests/wsgi.py | arterial-io/mesh | 0 | 47100 | from wsgiref.simple_server import WSGIServer
class MockWSGIServer(object):
application = None
def setup_environ(self):
env = self.base_environ = {}
env['SERVER_NAME'] = 'mock-wsgi-server'
env['GATEWAY_INTERFACE'] = 'CGI/1.1'
env['SERVER_PORT'] = 'XXX'
env['REMOTE_HOST'... | 2.28125 | 2 |
samples/driver-hello-world/lib/__init__.py | bafu/lib-python-databox | 0 | 47101 | <gh_stars>0
from lib.utils import *
#from lib.catalog import *
from lib.export import *
#from lib.subscriptions import *
#from lib.key_value import *
##from lib.time_series import *
from lib.core_store import * | 1.140625 | 1 |
grblocalization/GRBToyModel3D.py | marivasq/gamma-ai | 6 | 47102 | <filename>grblocalization/GRBToyModel3D.py<gh_stars>1-10
###################################################################################################
#
# GRBToyModel.py
#
# Copyright (C) by <NAME>, <NAME> & <NAME>.
# All rights reserved.
#
# Please see the file LICENSE in the main repository for the copyright-no... | 1.882813 | 2 |
utils/db_util.py | haodaohong/zimt8 | 1 | 47103 | <gh_stars>1-10
# -*- coding: utf-8 -*-
#
# connect()方法用于连接数据库,返回一个数据库连接对象。如果要连接一个位于host.remote.com服务器上名为fourm的MySQL数据库,连接串可以这样写:
# db = MySQLdb.connect(host="remote.com",user="user",passwd="<PASSWORD>",db="fourm" )
# connect()的参数列表如下:
# host,连接的数据库服务器主机名,默认为本地主机(localhost)。
# user,连接数据库的用户名,默认为当前用户。
# passwd,连接密码,没有默认... | 2.609375 | 3 |
sound.py | Artemia76/discord-audio-pipe | 0 | 47104 | import numpy as np
import sounddevice as sd
MME = 0
sd.default.channels = 2
sd.default.dtype = 'int16'
sd.default.latency = 'low'
sd.default.samplerate = 48000
class PCMStream:
def __init__(self):
self.stream = None
def read(self, num_bytes):
# frame is 4 bytes
... | 2.59375 | 3 |
implement.py | vl-18/CSFL-Non-IID-data | 0 | 47105 | __all__ = [
'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn',
'vgg19_bn', 'vgg19',
]
model_urls = {
'vgg11': 'https://download.pytorch.org/models/vgg11-bbd30ac9.pth',
'vgg13': 'https://download.pytorch.org/models/vgg13-c768596a.pth',
'vgg16': 'https://download.pytorch.org/model... | 1.34375 | 1 |
server/openapi_server/utils/request.py | mintproject/MINT-ModelCatalogIngestionAPI | 2 | 47106 | <gh_stars>1-10
import json
import typing
from typing import Dict
import uuid
import validators
from rdflib import Graph
from openapi_server import query_manager
from openapi_server.settings import ENDPOINT, PREFIX, GRAPH_BASE, UPDATE_ENDPOINT
from openapi_server import logger
primitives = typing.Union[int, str, bool,... | 2.421875 | 2 |
tests/conftest.py | sjakthol/python-aws-dynamodb-parallel-scan | 0 | 47107 | <reponame>sjakthol/python-aws-dynamodb-parallel-scan
import importlib
import unittest.mock
import boto3
import botocore.exceptions
import more_itertools
import moto # type: ignore
import pytest
from . import utils
TEST_TABLE_NAME = "dynamodb-parallel-scan-testtable"
TEST_TABLE_ITEM_COUNT = 205
MOCK_SCAN_ITEMS = uti... | 2.328125 | 2 |
mobo/cluster.py | seatonullberg/mobo | 0 | 47108 | from abc import ABC
import numpy as np
from sklearn.cluster import DBSCAN, KMeans
from typing import Callable, Optional, Union
class BaseClusterer(ABC):
"""Abstract base class for Clusterers."""
def __call__(self, data: np.ndarray) -> np.ndarray:
pass
class DbscanClusterer(BaseClusterer):
"""DBS... | 3.125 | 3 |
tests/clean/infra/log/utils/colors/test_termcolors.py | bahnlink/pyclean | 0 | 47109 | <filename>tests/clean/infra/log/utils/colors/test_termcolors.py
from clean.infra.log.utils.colors.termcolors import (
DARK_PALETTE, DEFAULT_PALETTE, LIGHT_PALETTE, NOCOLOR_PALETTE, PALETTES,
colorize, parse_color_setting,
)
def test_empty_string():
assert parse_color_setting('') == PALETTES[DEFAULT_PALETT... | 2.4375 | 2 |
crawler/driver/__init__.py | bmwant/wcbot | 0 | 47110 | <reponame>bmwant/wcbot<filename>crawler/driver/__init__.py
class BaseDriver(object):
EXECUTABLE_PATH = None
BINARY_PATH = None
def __init__(self):
self._driver = None
@property
def driver(self):
return self._driver
| 2.28125 | 2 |
opstestfw/switch/CLI/lagHeartbeat.py | r-cc-c/ops-ft-framework | 0 | 47111 | # (C) Copyright 2015 Hewlett Packard Enterprise Development LP
# 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/LICEN... | 2.046875 | 2 |
source/topicModel.py | arrismo/tripods-testing | 2 | 47112 | <reponame>arrismo/tripods-testing
"""
--Do we need this file?--
"""
from sklearn.model_selection import train_test_split
from sklearn import tree,metrics
from sklearn.tree.export import export_text
from sklearn.tree import export_graphviz
import seaborn as sns
sns.set_style('whitegrid')
import pandas as pd
def listo... | 2.828125 | 3 |
neural_network.py | narulaakshay01/DataScience | 0 | 47113 | import numpy as np
def sigmoid(t):
return 1 / (1 + np.exp(-t))
def sigmoid_derivative(p):
return p * (1 - p)
class NeuralNetwork:
#Do not change this function header
def __init__(self,x=[[]],y=[],numLayers=2,numNodes=2,eta=0.001,maxIter=10000):
self.data = np.append(x,np.ones([len(x),1]),1)
... | 3.28125 | 3 |
data_conversion_subsystem/config/config.py | diego-hermida/ClimateChangeApp | 2 | 47114 | <gh_stars>1-10
from os import environ
from utilities.util import get_config
DCS_CONFIG = get_config(__file__)
DCS_CONFIG.update(get_config(__file__.replace('config.py', 'docker_config.py')) if environ.get('DOCKER_MODE', False)
else get_config(__file__.replace('config.py', 'dev_config.py')))
DCS_CONFIG['DATA_CO... | 1.929688 | 2 |
InsightFace.py | quangtm199/DeepFace | 0 | 47115 | import argparse
import os
import cv2
import numpy as np
import torch
from torch import nn
from deepface.backbones.iresnet import iresnet18, iresnet34, iresnet50, iresnet100, iresnet200
from deepface.backbones.mobilefacenet import get_mbf
from deepface.commons import functions
import gdown
url={
'ms1mv3_r50':'https:... | 1.515625 | 2 |
Trakttv.bundle/Contents/Libraries/Shared/plugin/core/configuration.py | disrupted/Trakttv.bundle | 1,346 | 47116 | from plugin.core.environment import Environment
from ConfigParser import NoOptionError, NoSectionError, ParsingError, SafeConfigParser
import logging
import os
log = logging.getLogger(__name__)
CONFIGURATION_FILES = [
'advanced'
]
class ConfigurationFile(object):
def __init__(self, path):
self._pat... | 2.328125 | 2 |
src/jaws_scripts/client/list_effective_alarms.py | JeffersonLab/kafka-alarm-scripts | 0 | 47117 | #!/usr/bin/env python3
"""
Lists the effective alarms.
"""
import click
from jaws_libp.clients import EffectiveAlarmConsumer
# pylint: disable=missing-function-docstring,no-value-for-parameter
@click.command()
@click.option('--monitor', is_flag=True, help="Monitor indefinitely")
@click.option('--nometa', is_fla... | 2.25 | 2 |
statement_renamer/readers/filename_reader.py | mkazin/StatementRenamer | 0 | 47118 | from .reader import Reader
class FilenameReader(Reader):
def parse(self, fname):
return fname
# This is the contents of my old AmEx statement renamer, which
# used the filename as the data source.
# import os
# import re
# month_names = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
# 'Jul', 'Aug... | 3.359375 | 3 |
Pre-term/Computational Thinking and Problem Solving/Lecture 9/prog1.py | BedrockDev/CAU2019 | 0 | 47119 | # 2019-02-18
# sentence to dictionary meaning
sentence = "It is truth universally acknowledged"
f = open('dict_test.TXT', 'r', encoding='utf-8')
dictionary = {}
for line in f:
word = line[:-1].split(" : ", 1)
dictionary.update({word[0]:word[-1]})
f.close()
print("Sentence :", sentence)
for word in senten... | 3.6875 | 4 |
datatree/tests/test_mapping.py | TomNicholas/datatree | 31 | 47120 | import pytest
import xarray as xr
from datatree.datatree import DataTree
from datatree.mapping import TreeIsomorphismError, check_isomorphic, map_over_subtree
from datatree.testing import assert_equal
from datatree.treenode import TreeNode
from .test_datatree import create_test_datatree
empty = xr.Dataset()
class ... | 2.765625 | 3 |
setup.py | awalker125/forumsentry-sdk-for-python | 2 | 47121 | <gh_stars>1-10
import os
import sys
from setuptools import setup
from setuptools.command.install import install
from setuptools import find_packages
#Change this on major/minor version number change. You must create a git tag at the same tag called with the same value
# git tag "0.1"
# git push --tags
VERSION = "0.17... | 2.21875 | 2 |
rivebot/rivebot.py | coredump-ch/moss | 0 | 47122 | <filename>rivebot/rivebot.py
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import sys
import json
from cStringIO import StringIO
from rivescript import RiveScript
def parse_input():
"""Read JSON from input."""
request = StringIO()
while True:
... | 2.671875 | 3 |
DiretoryBrute.py | Moleey/DiretoryBrute.py | 1 | 47123 | from os import system
from requests import get
from pyfiglet import figlet_format
from colored import fore, back, style, attr
attr(0)
print(back.BLACK)
print(fore.BLUE_VIOLET + style.BOLD)
system("clear")
print(figlet_format("DIRETORY BRUTE\nBY MOLEEY", width=58, justify="center", font="smslant"))
site = input("Link ... | 3.125 | 3 |
testdust/diffusion/__init__.py | ibackus/testdust | 0 | 47124 | <filename>testdust/diffusion/__init__.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
This package is for generating and analyzing the dustydiffusion test of
Price & Laibe 2015
Created on Thu Mar 16 16:41:03 2017
@author: ibackus
"""
import makeICs
import analyze
import plot
| 0.976563 | 1 |
progress.py | gyupro/korean_ads_downloader | 1 | 47125 | <reponame>gyupro/korean_ads_downloader<gh_stars>1-10
import sys
import time
def print_progress (iteration, total, prefix = '', suffix = '', decimals = 1, barLength = 100):
formatStr = "{0:." + str(decimals) + "f}"
percent = formatStr.format(100 * (iteration / float(total)))
filledLength = int(round(barLengt... | 2.71875 | 3 |
guiModule.py | xianc78/guiModule | 0 | 47126 | <reponame>xianc78/guiModule
# Module for simple GUI functions. ONLY WORKS IN WINDOWS
import ctypes
def MessageBox(message, title):
ctypes.windll.user32.MessageBoxA(0, message, title, 0)
def YesNo(message, title):
if ctypes.windll.user32.MessageBoxA(0, message, title, 4) == 6:
return True
else:
return False
... | 2.859375 | 3 |
venv/lib/python3.8/site-packages/azureml/_tracing/__init__.py | amcclead7336/Enterprise_Data_Science_Final | 0 | 47127 | <gh_stars>0
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from azureml._base_sdk_common import __version__ as VERSION
from ._tracer_factory import get_tracer
__version__ = VERSI... | 1.195313 | 1 |
src/stk/molecular/topology_graphs/topology_graph/topology_graph/topology_graph.py | stevenbennett96/stk | 0 | 47128 | <reponame>stevenbennett96/stk<filename>src/stk/molecular/topology_graphs/topology_graph/topology_graph/topology_graph.py
"""
Topology Graph
==============
"""
from __future__ import annotations
import typing
from collections import abc
from functools import partial
import numpy as np
from stk.utilities import flat... | 2.59375 | 3 |
nmeatoolkit/pipes/seatalk.py | dakk/nmeatoolkit | 0 | 47129 | # -*- coding: utf-8 -*-
# Copyright (C) 2021 <NAME>
'''
MIT License
Copyright (c) 2021 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... | 2.28125 | 2 |
blackduck/Reporting.py | rishianand06/hub-rest-api-python | 0 | 47130 | <reponame>rishianand06/hub-rest-api-python<filename>blackduck/Reporting.py
import logging
import requests
import json
from operator import itemgetter
import urllib.parse
from .Utils import object_id
logger = logging.getLogger(__name__)
valid_categories = ['VERSION','CODE_LOCATIONS','COMPONENTS','SECURITY','FILES', '... | 2.625 | 3 |
server/adb.py | narata/answerot_new_1 | 0 | 47131 |
import subprocess,re
import ConfigParser
def set_config(device, sx, sy, ci, ck):
device_info = get_device()
result = {
"device": "",
"sx": "",
"sy": "",
"client_id": "",
"client_secret": "",
"msg": "",
"device_info": device_info,
}
cf = ConfigPa... | 2.359375 | 2 |
ocr/utils/calcIoU.py | takuya-motoshima/document-scanner | 0 | 47132 | <reponame>takuya-motoshima/document-scanner
def calcIoU(rectA, rectB):
"""Calculate IoU for two rectangles.
Args:
rectA: Rectangular bounding box ([top left X, top left Y, bottom right X, bottom right Y]).
rectB: Rectangular bounding box ([top left X, top left Y, bottom right X, bottom right Y]).
Ret... | 3.5625 | 4 |
client/collectors/collector.py | lxy20/django-postgres-stack | 4 | 47133 |
class MultiCollector(object):
'a collector combining multiple other collectors'
def __init__(self):
self._collectors = {}
def register(self, name, collector):
self._collectors[name] = collector
def start(self):
for name in self._collectors:
self._collectors[name].... | 3.34375 | 3 |
main_pycharm_v01.py | TonySoloProjects/network_log_visualization | 0 | 47134 | <filename>main_pycharm_v01.py
"""
Routines to interactively visualize network server error log files
to graphically determine which servers tend to fail and to potentially
find relations between failing connections.
Created by: <NAME> <EMAIL>
Created on: 2020/09/10
Copyright © 2020 <NAME>. All rights reserved.
"""
f... | 3.15625 | 3 |
Utils.py | BoChenGroup/WeTe | 4 | 47135 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~----->>>
# _ _
# .__(.)< ?? >(.)__.
# \___) (___/
# @Time : 2022/3/20 下午10:06
# @Author : wds -->> <EMAIL>
# @File : util.py
# ~~~~~~~~~~~~~~~~~~~~~~... | 2.5 | 2 |
ged4py/__init__.py | haney/ged4py | 1 | 47136 | # -*- coding: utf-8 -*-
"""Top-level package for GEDCOM parser for Python."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.10'
from . import codecs # noqa: F401, needed to register ANSEL codec
from .parser import GedcomReader # noqa: F401
| 1.03125 | 1 |
src/auth.py | 4shub/weExist | 0 | 47137 | """
Original: <NAME>
New Author: <NAME>
"""
from __future__ import print_function
import httplib2
import os
import re
import time
import base64
from apiclient import discovery
from apiclient import errors
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
import smtp... | 2.5 | 2 |
netmgt/migrations/0001_initial.py | drscream/django-netmgt | 1 | 47138 | <reponame>drscream/django-netmgt<gh_stars>1-10
# Generated by Django 2.2.6 on 2019-10-29 09:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | 1.867188 | 2 |
picky/wsgi.py | Wilfred/Picky | 2 | 47139 | <reponame>Wilfred/Picky
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "picky.settings")
# This application object is used by the development server
# as well as any WSGI server configured to use this file.
from django.core.wsgi import get_wsgi_application
from raven.contrib.django.raven_compat.middleware.... | 1.273438 | 1 |
label_maker/utils.py | cgoodier/label-maker | 1 | 47140 | <filename>label_maker/utils.py
"""Provide utility functions"""
import numpy as np
def url(tile, imagery):
"""Return a tile url provided an imagery template and a tile"""
return imagery.replace('{x}', tile[0]).replace('{y}', tile[1]).replace('{z}', tile[2])
def class_match(ml_type, label, i):
"""Determine ... | 2.84375 | 3 |
utils/actions.py | zagaran/instant-census | 1 | 47141 | from inspect import getargspec
from uuid import uuid4
from utils.logging import log_error
ACTIONS = {}
DYNAMIC_PARAMS = ["user", "parser_return", "execution_state", "resend", "delay"]
class ActionConfig(object):
@staticmethod
def do_action(action_config, user, parser_return=None, execution_state=[],
... | 2.4375 | 2 |
FER/em_network/models/Conv2D.py | Zber5/OpenRadar | 1 | 47142 | import torch
import torch.nn as nn
import torch.nn.functional as F
from FER.em_network.models.model import TimeDistributed
class PhaseNet(nn.Module):
def __init__(self):
super(PhaseNet, self).__init__()
self.group1 = nn.Sequential(
nn.Conv2d(12, 24, kernel_size=(5, 5), stride=1, paddi... | 2.59375 | 3 |
elm-finder/apps/homepage/admin.py | martin-jahn/elm-finder | 2 | 47143 | <reponame>martin-jahn/elm-finder<filename>elm-finder/apps/homepage/admin.py
from django.contrib import admin
from apps.homepage.models import PSA, Dpotw, Gotw
@admin.register(Dpotw)
class DpotwAdmin(admin.ModelAdmin):
raw_id_fields = ("package",)
@admin.register(Gotw)
class GotwAdmin(admin.ModelAdmin):
raw... | 1.65625 | 2 |
vb_baseapp/admin/actions/basemodel_with_softdelete.py | vbyazilim/django-vb-baseapp | 0 | 47144 | <reponame>vbyazilim/django-vb-baseapp
from django.contrib.admin import helpers
from django.contrib.admin.utils import model_ngettext
from django.core.exceptions import PermissionDenied
from django.template.response import TemplateResponse
from django.utils.translation import ugettext_lazy as _
from console import cons... | 1.890625 | 2 |
debug-hugging_face_baseline.py | kongwilson/kaggle-feedback-prize | 0 | 47145 | """
https://www.kaggle.com/weicongkong/feedback-prize-huggingface-baseline-training/edit
Copyright (C) <NAME>, 23/02/2022
"""
# %% [markdown]
# # HuggingFace Training Baseline
#
# I wanted to create my own baseline for this competition, and I tried to do so "without peeking" at the kernels published by others. Ideall... | 2.453125 | 2 |
appname/mailers/teams.py | Dnida/Ignite | 53 | 47146 | from flask import render_template, url_for
from appname.mailers import Mailer
class InviteEmail(Mailer):
TEMPLATE = 'email/teams/invite.html'
def __init__(self, invite):
self.recipient = None
self.invite = invite
self.recipient_email = invite.invite_email or (invite.user and invite.us... | 2.640625 | 3 |
hooks/pre_gen_project.py | JayThibs/orbyter-cookiecutter | 66 | 47147 | """Python module name validation.
Compatible with python 2 and python 3, to ensure cookiecutter support
across various platforms
"""
import logging
import sys
import re
logging.basicConfig()
logger = logging.getLogger(__name__)
REF_URL = "https://www.python.org/dev/peps/pep-0008/#package-and-module-names"
def vali... | 3.265625 | 3 |
graphstar/tests/graph.py | pengboomouch/graphstar | 0 | 47148 | <filename>graphstar/tests/graph.py
import pytest
from graphstar import graph
@pytest.fixture(scope="function")
def g():
return graph.Graph()
@pytest.fixture
def n():
return graph.Node()
@pytest.fixture(scope="function")
def two_nodes(g):
n1 = g.make_node(1, 1)
n2 = g.make_node(2, 2)
return n1, n2
def test_... | 2.984375 | 3 |
lists.py | the-visserd/two-hearts | 0 | 47149 | <filename>lists.py
# Set number of participants
num_dyads = 4
num_participants = num_dyads*2
# Create lists for iterations
participants = list(range(num_participants))
dyads = list(range(num_dyads)) | 3.46875 | 3 |
advent_tools.py | moink/AoC2017 | 0 | 47150 | <gh_stars>0
"""Tools to help solve advent of code problems faster"""
import abc
import collections
import contextlib
import copy
import datetime
import hashlib
import itertools
import os
import re
import shutil
import urllib.request
import scipy
from matplotlib import pyplot as plt
import numpy as np
def set_up_dir... | 3.140625 | 3 |
__classes__/node.py | Ahuge/NukeParser | 24 | 47151 | <gh_stars>10-100
class Node(object):
def Class(self):
"""
self.Class() -> Class of node.
@return: Class of node.
"""
# raise NotImplementedError("This function is not written yet. Please put in an issue on the github page.")
return "%s(%r)" % (self.__class__, self.__... | 2.984375 | 3 |
networking_kaloom/ml2/drivers/kaloom/db/kaloom_models.py | ramupreetham/neutron | 3 | 47152 | <filename>networking_kaloom/ml2/drivers/kaloom/db/kaloom_models.py
# Copyright 2019 Kaloom, 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:... | 1.929688 | 2 |
tests/test_admin.py | hongquan/django-improved-user | 0 | 47153 | <filename>tests/test_admin.py<gh_stars>0
"""Test Admin interface provided by Improved User"""
import os
import re
from django import VERSION as DjangoVersion
from django.contrib.admin.models import LogEntry
from django.contrib.auth import SESSION_KEY
from django.test import TestCase, override_settings
from django.test... | 2.15625 | 2 |
shutDown.py | Dinuda/ShutDown | 3 | 47154 | <filename>shutDown.py<gh_stars>1-10
import os
os.system("shutdown /s /t 1") | 1.679688 | 2 |
micropython/src/thermal_printer_alarm.py | fabianDadada/thermal_printer_alarm_clock | 0 | 47155 | """This module contains all the actual logic of the project.
The main method is run when the microcontroller starts and afer each sleep cycle.
"""
import logging
import machine
import network
import ntptime
import os
import sdcard
import ujson
import urequests
import utime
from Adafruit_Thermal import Adafruit_Therma... | 2.453125 | 2 |
vmcnet/mcmc/metropolis.py | nilin/vmcnet | 17 | 47156 | <filename>vmcnet/mcmc/metropolis.py<gh_stars>10-100
"""Proposal and acceptance fns for Metropolis-Hastings Markov-Chain Monte Carlo."""
import logging
from typing import Callable, Tuple, cast
import jax
import jax.numpy as jnp
import vmcnet.utils as utils
from vmcnet.utils.typing import Array, D, P, PRNGKey
Metropol... | 2.84375 | 3 |
project/evaluate/views.py | ktzoulas/stateless-password-manager | 0 | 47157 | """
Contains the views of the 'evaluate' blueprint.
"""
# pylint: disable=invalid-name
from flask import Blueprint, render_template, request
from project.evaluate.forms import EvaluateForm
from project.evaluate.helpers import evaluate_pass
evaluate_blueprint = Blueprint('evaluate', __name__, url_prefix='/evaluate... | 2.375 | 2 |
main.py | lx0hacker/xinling | 0 | 47158 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
'''
@author: lx0hacker
@date:2018-02-07
'''
import requests
from urllib.parse import unquote,urlparse
import re
import os
import os.path
from bs4 import BeautifulSoup
requests.packages.urllib3.disable_warnings()
import time
import random
'''
@url : 漫画的入口
@return 创建的文件夹的名字
'... | 2.765625 | 3 |
main_dpir_sisr_real_applications.py | HedgehogCode/DPIR | 328 | 47159 | <reponame>HedgehogCode/DPIR<filename>main_dpir_sisr_real_applications.py
import os.path
import glob
import cv2
import logging
import time
import numpy as np
from datetime import datetime
from collections import OrderedDict
import hdf5storage
import torch
from utils import utils_deblur
from utils import utils_logger
... | 1.820313 | 2 |
metoo/db/redis.py | Kevin-Huang-NZ/fastapi_face_recognition | 0 | 47160 | from aioredis import Redis, from_url
from core.config import settings
async def init_redis_pool() -> Redis:
if settings.USE_REDIS_SENTINEL:
pass
else:
redis = await from_url(
settings.REDIS_URL,
password=settings.REDIS_PASSWORD,
encoding="utf-8",
... | 1.914063 | 2 |
mlrepricer/oldsql/listener.py | elcolumbio/mlrepricer | 9 | 47161 | # -*- coding: utf-8 -*-
"""
Get messages save them locally and delete them from the queue.
It's very fast we get thousands messages per minute.
If the queue is empty we sleep for 20 seconds.
We store the messages in yamlfiles, it will create some markers like !!omap.
Besides that we use it for readability.
"""
import... | 2.703125 | 3 |
alibabacloud/clients/smartag_20180313.py | wallisyan/alibabacloud-python-sdk-v2 | 21 | 47162 | # Copyright 2019 Alibaba Cloud 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 required by applicable la... | 2.125 | 2 |
tests/test_altitudo.py | milesgranger/altitudo | 0 | 47163 | <filename>tests/test_altitudo.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `altitudo` package."""
import pytest
from click.testing import CliRunner
from altitudo import cli, altitudo
def test_command_line_interface():
"""Test the CLI."""
runner = CliRunner()
result = runner.invoke(cli.... | 2.984375 | 3 |
reproschema/models/utils.py | sanuann/reproschema-py | 3 | 47164 | import json
from . import Protocol, Activity, Item
def load_schema(filepath):
with open(filepath) as fp:
data = json.load(fp)
if "@type" not in data:
raise ValueError("Missing @type key")
schema_type = data["@type"]
if schema_type == "reproschema:Protocol":
return Protocol.from... | 2.71875 | 3 |
backend/api/fixtures/operational/0029_update_notifications.py | kuanfan99/zeva | 3 | 47165 | from django.db import transaction
from api.management.data_script import OperationalDataScript
from api.models.notification import Notification
class UpdateNotifications(OperationalDataScript):
"""
Update notifications name
"""
is_revertable = False
comment = 'Update notifications name'
def ... | 2.234375 | 2 |
leviathan/__init__.py | scottywz/leviathan-player | 0 | 47166 | # Leviathan Music Manager
# A command-line utility to manage your music collection.
#
# Copyright (C) 2010-2011, 2020 <NAME>
# https://code.s.zeid.me/leviathan
#
#
# This program 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 ... | 1.140625 | 1 |
python-pscheduler/pscheduler/pscheduler/filestring.py | krihal/pscheduler | 47 | 47167 | """
Functions for retrieving strings from files
"""
import os
def string_from_file(string, strip=True):
"""
Return an unaltered string or the contents of a file if the string
begins with @ and the rest of it points at a path.
If 'strip' is True, remove leading and trailing whitespace
(default be... | 4.25 | 4 |
gather_test_content.py | mgbennet/wpVitalsTender | 0 | 47168 | <gh_stars>0
#!/usr/bin/python
"""
Really quick script to build test data for multiple assessments
"""
import requests
import wpVitalsTender as wpvt
import json
# https://en.wikipedia.org/wiki/Wikipedia:Vital_articles/Expanded/Technology#Infrastructure_.2872_articles.29
articles = wpvt.parse_article(wpvt.get_content(... | 2.75 | 3 |
tests/executors/models/test_electra.py | xiongma/bert2tf | 7 | 47169 | import unittest
import numpy as np
from bert2tf import Executor, ElectraDiscriminator, BertTokenizer
from tests import Bert2TFTestCase
class MyTestCase(Bert2TFTestCase):
@unittest.skip('just run on local machine')
def test_create_electra_model(self):
model = Executor.load_config('ElectraDiscriminato... | 2.5625 | 3 |
scenario-generator.py | mdenesfe/scenario-generator | 0 | 47170 | <reponame>mdenesfe/scenario-generator
basrol = input("Başrolün ismi: ")
kardes = input("Başrolün Ağabeyi: ")
anne = input("Başrolün Annesi: ")
baba = input("Başrolün Babası: ")
sevgili1 = input("Basrolun Sevdiği: ")
arkadas = input("Başrolün Yakın Arkadaşı: ")
mekan = input("Nerede: ")
isyeri = input("Nered... | 2.453125 | 2 |
STUDENTS1.py | WitteDuivel/library-management-oncemore | 1 | 47171 | import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="<PASSWORD>",database="library_management_project")
mycursor=mydb.cursor()
def useradd():
studIDp=int(input("ENTER YOUR STUDENT_ID:- "))
stfnamep=input("ENTER YOUR FIRST NAME:- ")
stlnamep=input("ENTER YOUR LAST NA... | 3.265625 | 3 |
deepblast/dataset/tests/test_alphabet.py | athbaltzis/deepblast | 29 | 47172 | import numpy as np
import unittest
from deepblast.dataset.alphabet import UniprotTokenizer
import numpy.testing as npt
class TestAlphabet(unittest.TestCase):
def test_tokenizer(self):
tokenizer = UniprotTokenizer(pad_ends=True)
res = tokenizer(b'ARNDCQEGHILKMFPSTWYVXOUBZ')
# Need to accou... | 2.5625 | 3 |
socketclusterclient/Socketcluster.py | sacOO7/socketcluster-client-python | 51 | 47173 | <reponame>sacOO7/socketcluster-client-python
import json
from threading import Timer
import websocket
import logging
import importlib
Emitter = importlib.import_module(".Emitter", package="socketclusterclient")
Parser = importlib.import_module(".Parser", package="socketclusterclient")
sclogger = logging.getLogger(__n... | 2.34375 | 2 |
lib/notationToEmoji.py | easton-bittner/TkPublic | 17 | 47174 | <filename>lib/notationToEmoji.py
from lib.moveConversionDict import *
#======================================================================
#=============BEGIN Replacing Move Notation with INTERMEDIATES ========
#======================================================================
def moveReplace(userInput_... | 2.984375 | 3 |
12_module_basic/17_controller/mod.py | hemuke/python | 0 | 47175 | <reponame>hemuke/python<filename>12_module_basic/17_controller/mod.py
__all__ = ['v1', 'f1', 'C1']
v1 = 18
v2 = 36
def f1():
pass
def f2():
pass
class C1(object):
pass
class C2(object):
pass
| 1.835938 | 2 |
core/authors/util.py | cmackenzie1/cmput404-project | 0 | 47176 | <reponame>cmackenzie1/cmput404-project
import requests
import json
from core.authors.models import Author
from core.hostUtil import is_external_host, get_host_url
from core.servers.SafeServerUtil import ServerUtil
from posixpath import join as urljoin
## Gets the unique ID of a local or external author. If external,... | 2.609375 | 3 |
database/buyer.py | mithilesh1024/Callback-Warrior_ShoppingMart | 0 | 47177 | <filename>database/buyer.py
from flask_sqlalchemy import SQLAlchemy
class Seller(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(120), unique=True, nullable=False)
email = db.Column(db.String(120), unique=True, nullable=False)
password = db.Column(db.String(60), null... | 2.828125 | 3 |
main.py | abhinav8797/Mobile_App | 0 | 47178 | from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
import json, glob
from datetime import datetime
from pathlib import Path
import random
from hoverable import HoverBehavior
from kivy.uix.image import Image
from kivy.uix.behaviors import ButtonBehavi... | 2.671875 | 3 |
pymars/tests/test_drg.py | kbronstein56/pyMARS | 39 | 47179 | """Tests for drg module"""
import sys
import os
import pkg_resources
import pytest
import numpy as np
import networkx as nx
import cantera as ct
from ..sampling import data_files, InputIgnition
from ..drg import graph_search, create_drg_matrix, run_drg, trim_drg, reduce_drg
# Taken from http://stackoverflow.com/a/2... | 2.703125 | 3 |
ymidi/containers.py | Owen-Cochell/yapmidi | 0 | 47180 | <filename>ymidi/containers.py
"""
Components that house MIDI events and other misc. data,
"""
from dataclasses import dataclass
class TrackInfo(dataclass):
"""
An object that contains info about a specific track.
The data in this object is used for keeping track of track statistics.
We allow fo... | 2.625 | 3 |
apimodule/auctionhouse.py | bobbzorzen/wowapi | 0 | 47181 | <filename>apimodule/auctionhouse.py
import requests
def getDumpFile(apiKey):
requestUri = "https://eu.api.battle.net/wow/auction/data/azjol-nerub?locale=en_US&apikey=%s" % apiKey
r = requests.get(requestUri);
jsonData = r.json()
try:
fileData = jsonData["files"][0]
return fileData... | 2.484375 | 2 |
enan/calculator/_binom.py | mizuno-group/enan | 0 | 47182 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 23 12:59:35 2019
Binomial test
@author: tadahaya
"""
import pandas as pd
import numpy as np
import scipy.stats as stats
import statsmodels.stats.multitest as multitest
from scipy.stats import rankdata
class Calculator():
def __init__(self):
... | 3.078125 | 3 |
src/rgt/HINT/Tracks.py | mguo123/pan_omics | 0 | 47183 | import os
from argparse import SUPPRESS
import numpy as np
from pysam import Samfile, Fastafile
from scipy.stats import scoreatpercentile
# Internal
from rgt.Util import GenomeData, HmmData, ErrorHandler
from rgt.GenomicRegionSet import GenomicRegionSet
from rgt.HINT.biasTable import BiasTable
from rgt.HINT.signalProc... | 2.140625 | 2 |
detecting_poverty/utils.py | ryanmwebb/detecting_poverty | 1 | 47184 | <gh_stars>1-10
import torch
import numpy as np
from PIL import Image
import random
import math
import seaborn as sns
from sklearn import metrics
import matplotlib.pyplot as plt
def adjusted_classes(y_scores, threshold):
"""
This function adjusts class predictions based on the prediction threshold (t).
Will... | 2.875 | 3 |
intro/with_restaurant.py | j54854/mySimPy | 0 | 47185 | import matplotlib.pyplot as plt
import random, math
import simpy
class Model:
def __init__(self, env, cap, ub, mt, vt):
self.env = env
self.cap = cap # number of seats
self.ub = ub # maximum queue length
self.mt = mt # mean of eating time
self.vt = vt # variance of eatin... | 3.6875 | 4 |
deepRec1/dataloader4mlleatestWithTs.py | meannoharm/movie_recommend | 0 | 47186 | from utils import osUtils as ou
import random
from tqdm import tqdm
from data_set import filepaths as fp
import pandas as pd
def readRecData(path,test_ratio = 0.1):
df = pd.read_csv(path,sep='\t',header=None)
a = df.sort_values(by=[0,3],axis=0)
a.to_csv('a.csv')
print(a)
return
if __name__ == '__m... | 1.976563 | 2 |
eth2/beacon/types/blocks.py | boorac/Trinity-Aurora-Client | 0 | 47187 | from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Sequence, Type, TypeVar
from eth._utils.datatypes import Configurable
from eth.constants import ZERO_HASH32
from eth_typing import BLSSignature, Hash32
from eth_utils import humanize_hash
from ssz.hashable_container import HashableContainer, SignedH... | 2.078125 | 2 |
anyfix_globals.py | alexander-liao/anyfix | 4 | 47188 | values = {
'r': 0.000000000001
}
typers = {
'r': float
}
def setGlobal(key, value):
values[key] = value
| 2.140625 | 2 |
nussl/separation/spatial/duet.py | ZhaoJY1/nussl | 259 | 47189 | import numpy as np
from scipy import signal
from .. import MaskSeparationBase
from ...core import utils
from ...core import constants
class Duet(MaskSeparationBase):
"""
The DUET algorithm was originally proposed by S.Rickard and F.Dietrich for DOA
estimation and further developed for BSS and demixing b... | 2.578125 | 3 |
scale/storage/test/test_delete_files_job.py | kaydoh/scale | 121 | 47190 | from __future__ import unicode_literals
import os
import django
from django.test import TestCase
from mock import call, patch
from storage.brokers.host_broker import HostBroker
from storage.delete_files_job import delete_files
from storage.test import utils as storage_test_utils
class TestDeleteFiles(TestCase):
... | 2.109375 | 2 |
ports/cran/uses.py | yzgyyang/portcran | 1 | 47191 | <gh_stars>1-10
from typing import List, Optional
from ..core import Uses
__all__ = ["Cran"]
@Uses.register("cran")
class Cran(Uses):
PKGNAMEPREFIX = "R-cran-"
def __init__(self) -> None:
super(Cran, self).__init__("cran")
def get_variable(self, name: str) -> Optional[List[str]]:
if name... | 2.46875 | 2 |
specialize-protein-subclass.py | rwst/wikidata-molbio | 2 | 47192 | from sys import *
import csv
s = set()
reader = csv.DictReader(open('t.tab', 'r'), delimiter='\t')
for item in reader:
iturl = item.get('item')
it = iturl[iturl.rfind('/')+1:]
if it in s:
continue
s.add(it)
insturl = item.get('inst')
inst = insturl[insturl.rfind('/')+1:]
name = item... | 2.796875 | 3 |
api/models.py | jjkivai/SolutionsWeb | 0 | 47193 | from django.db import models
# Helper functions
def project_cover(instance, filename):
return "Project_{0}/cover_{1}".format(instance.id, filename)
def project_image(instance, filename):
return "Project_{0}/image_{1}".format(instance.project.id, filename)
def client_logo(instance, filename):
return "Cl... | 2.203125 | 2 |
Django/views.py | haohoangtran/Django | 0 | 47194 | from django.http import HttpResponse
from django.shortcuts import render
def home(request):
return render(request,'index.html')
def table(request):
return render(request,"basic-table.html") | 1.640625 | 2 |
graph4ipy/consts.py | agapow/graph4ipy | 0 | 47195 | <reponame>agapow/graph4ipy
"""
Module-file constants.
"""
### IMPORTS
import os
# XXX: or should we not allow this?
__all__ = (
'MODULE_PATH',
'ASSETS_PATH',
)
### CONSTANTS & DEFINES
MODULE_PATH = os.path.normpath (os.path.dirname (__file__))
ASSETS_PATH = os.path.join (MODULE_PATH, 'assets')
JQUERY_TAG = ... | 1.40625 | 1 |
distiller/pseudo_teacher.py | watson21/Knowledge_Distilling | 0 | 47196 | <gh_stars>0
import torch
from torch import Tensor
import numpy as np
import copy
class PseudoTeacher:
def __init__(self, acc:float=0.9, mean:float=-12.0293, std:float= 4.8868,
dataset_size:int=..., num_classes:int=..., seed=None) -> None:
self.acc = acc
self.mean = mean
... | 2.671875 | 3 |
rlberry/envs/interface/model.py | antoine-moulin/rlberry | 0 | 47197 | <reponame>antoine-moulin/rlberry<filename>rlberry/envs/interface/model.py
import gym
import numpy as np
import logging
from rlberry.seeding import seeding
logger = logging.getLogger(__name__)
class Model(gym.Env):
"""
Base class for an environment model.
Attributes
----------
name : string
... | 2.921875 | 3 |
pythonScripts/allSystemBehavior.py | Yperidis/bvd_agent_based_model | 1 | 47198 | #!/usr/bin/env python
import sys
import os
import plotGlobalEndemicBehaviour as analysisFile
thisDir = os.path.dirname(os.path.abspath(__file__))
filenames = []
thepath = "/Users/pascal/Coding/uni/Masterarbeit/Tests/results/finalcont/"
scen = "scen"
thisScen = scen
listfile = "/comp3.txt" #"/testing_list.txt"
scenari... | 2.265625 | 2 |
html_extract/jieba_call.py | xinyi-Z/HtmlExtract-Python | 6 | 47199 | # -*- coding: utf-8 -*-
'''
Name: jieba库调用
Author:XinYi <EMAIL>
Time:2016.3
'''
import jieba.analyse
import jieba
def cut_all(data):
'''
采用全模式分词,即把句子中所有的可以成词的词语都扫描出来
来到北京大学-->来到/北京/北京大学/大学
'''
temp_result = jieba.cut(data, cut_all=True)
temp_result = '/'.join(temp_result)
... | 2.59375 | 3 |