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 |
|---|---|---|---|---|---|---|
word_usage.py | davidak/cvtools | 0 | 51100 | #!/usr/bin/python
import sys, getopt, re
from collections import defaultdict
input_file = ''
dictionary_file = ''
try:
opts, args = getopt.getopt(sys.argv[1:],"i:d:",["input=","dictionary="])
except getopt.GetoptError:
print('word_usage.py -i <input file> [-d <dictionary>]')
sys.exit(2)
for opt, arg in opts:
if... | 3.5625 | 4 |
megatron/text_generation_utils.py | coreweave/gpt-neox | 0 | 51101 | # coding=utf-8
# Copyright (c) 2021 <NAME> <<EMAIL>>. All rights reserved.
# This file is based on code by the authors denoted below and has been modified from its original version.
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you... | 1.890625 | 2 |
setup.py | vhdeluca/PyStacking | 0 | 51102 | from setuptools import setup, find_packages
setup(name='pystacking',
version='0.1.0',
description='Python Machine Learning Stacking Maker',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=find_packages(),
python_requires=">=3.5",
tests_require=['pytest'... | 1.148438 | 1 |
read_files.py | Tojens/PointNet2Custom | 0 | 51103 | import glob
import csv
import os
txt = glob.glob("/mnt/edisk/backup/dataset/semantic_raw/*.txt")
print(len(txt))
txt_train = txt[0:236]
txt_val = txt[237:241]
txt_test = txt[242:246]
os.chdir("/mnt/edisk/backup/filelists")
with open('FileList_train.txt', 'w', newline='') as myfile:
wr = csv.writer(m... | 2.53125 | 3 |
ec2_example.py | jnewbigin/pkcs7_detached | 3 | 51104 | import requests
from pkcs7_detached import verify_detached_signature, aws_certificates
import json
from pprint import pprint
def main():
print("Verifying ec2 instance identity document")
r = requests.get("http://169.254.169.254/latest/dynamic/instance-identity/document")
identity_document = r.text
r... | 2.984375 | 3 |
geneal/applications/tsp/helpers/_plot_cities.py | NeveIsa/geneal | 47 | 51105 | <reponame>NeveIsa/geneal
import plotly.graph_objects as go
import numpy as np
def add_trace(
fig, cities_dict, city_1, city_2, lon=lambda x: x["lon"], lat=lambda x: x["lat"]
):
city_1_lon = lon(cities_dict[city_1])
city_1_lat = lat(cities_dict[city_1])
city_2_lon = lon(cities_dict[city_2])
city_2... | 2.75 | 3 |
includes/parsers/__init__.py | foo123/Beeld | 1 | 51106 | <reponame>foo123/Beeld<filename>includes/parsers/__init__.py
##
#
# Simple .INI Parser for Python
# @<NAME>.
#
##
import re
class IniParser():
"""Simple .ini parser for Python"""
def __init__(self, keysList=True, rootSection='_'):
self.input = ''
self.comments = [';', '#']
self... | 2.890625 | 3 |
scripts/generators.py | Ka6aSH/fly-libc-checker | 0 | 51107 | <filename>scripts/generators.py
# Copyright 2019 <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 l... | 2.140625 | 2 |
flask/microblog-db/app/__init__.py | qsunny/python | 0 | 51108 | from flask import Flask
from config import config
from flask_sqlalchemy import SQLAlchemy
# app.config['SECRET_KEY'] = '666666'
# ... add more variables here as needed
# app.config.from_object('config') # 载入配置文件
# app.config.from_object(config[config_name])
# config[config_name].init_app(app)
db = SQLAlchemy()
def ... | 2.25 | 2 |
benchmarks/timings.py | MDRCS/High-Performance-Python | 0 | 51109 | from timeit import repeat
from subprocess import check_output
def timer(arg, niter, name, module):
stmt = "%s(%s)" % (name, arg)
setup = "from %s import %s" % (module, name)
time = min(repeat(stmt=stmt, setup=setup, number=niter)) / float(niter) * 1e9
return time
N = 10**6
pytime_0 = timer(0, N, name... | 2.171875 | 2 |
examples/gaussian_contours.py | sglyon/quant-econ | 1 | 51110 | <gh_stars>1-10
"""
Filename: gaussian_contours.py
Authors: <NAME> and <NAME>
Plots of bivariate Gaussians to illustrate the Kalman filter.
"""
from scipy import linalg
import numpy as np
import matplotlib.cm as cm
from matplotlib.mlab import bivariate_normal
import matplotlib.pyplot as plt
# == Set up the Gaussian... | 3.203125 | 3 |
old/original-graphsage/models.py | jestjest/cs224w-project | 3 | 51111 | import torch
import torch.nn as nn
from torch.nn import init
from encoders import *
from aggregators import *
class SupervisedGraphSage(nn.Module):
def __init__(self, num_classes, enc, w):
"""
w - array of len(num_classes) indicating the weight of each class when computing
loss.
... | 2.53125 | 3 |
get_features/write_tfrecords_sites.py | kslin/miRNA_models | 1 | 51112 | from optparse import OptionParser
import os
import sys
import time
import numpy as np
import pandas as pd
import tensorflow as tf
import utils
import get_site_features
import tf_utils
np.set_printoptions(threshold=np.inf, linewidth=200)
pd.options.mode.chained_assignment = None
if __name__ == '__main__':
pars... | 2.28125 | 2 |
2018/22/caves.py | lvaughn/advent | 0 | 51113 | #!/usr/bin/env python3
CAVE_DEPTH = 6969
TARGET_LOC = (9, 796)
GEO_INDEX_CACHE = {
(0, 0): 0,
TARGET_LOC: 0
}
def get_geo_index(x, y):
key = (x, y)
if key not in GEO_INDEX_CACHE:
if y == 0:
GEO_INDEX_CACHE[key] = x * 16807
elif x == 0:
GEO_INDEX_CACHE[key] = y... | 3.078125 | 3 |
pysimplegui/test_RiKi_setting.py | konsan1101/py-etc | 0 | 51114 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#https://pysimplegui.readthedocs.io/en/latest/cookbook/
import PySimpleGUI as sg
#import PySimpleGUIWeb as sg
# Very basic window. Return values using auto numbered keys
layout = [
# API選択 free, google, watson, azure, nict, special
[sg.Frame(layout=[
... | 2.390625 | 2 |
develocorder/interface.py | wahtak/develocorder | 10 | 51115 | <filename>develocorder/interface.py<gh_stars>1-10
"""Globally register callables and call via matching keywords.
Example:
>>> # register print function for keyword my_value
>>> set_recorder(my_value=print)
>>> record(my_value="Hello World.")
Hello World.
"""
_recorders = {}
def set_recorder(**kwargs):
"""Globa... | 2.96875 | 3 |
core/var.py | ThickBull/autoTest-Rebuild | 0 | 51116 | <filename>core/var.py
# -*- encoding: utf-8 -*-
"""
@File : var.py
@Project : autoText-rebuild
@Time : 2019/12/17 17:47
@Author : qm
@Email : <EMAIL>
@desc :
"""
import datetime
import sys
import os
import settings
class ConfigNotExistError(Exception):
pass
class ConfigParseError(Exception):
pas... | 2.609375 | 3 |
pyembroidery/StringHelper.py | teosavv/pyembroidery | 45 | 51117 | def is_string(thing):
try:
return isinstance(thing, basestring)
except NameError:
return isinstance(thing, str)
| 2.765625 | 3 |
tests/test_blockchain.py | fsoubelet/toychain | 3 | 51118 | <reponame>fsoubelet/toychain<filename>tests/test_blockchain.py
import hashlib
import pytest
from toychain.blockchain import Block, BlockChain, Transaction
class TestNodes:
@pytest.mark.parametrize(
"node_address", ["http://192.168.0.1:5000", "http://127.0.0.5:5050", "http://0.0.0.0:8000"]
)
def ... | 2.328125 | 2 |
btcturk_client/tools.py | emre/btcturk-client | 15 | 51119 |
def authenticated_method(func):
def _decorated(self, *args, **kwargs):
if not self.api_key:
raise ValueError("you need to set your API KEY for this method.")
response = func(self, *args, **kwargs)
if response.status_code == 401:
raise ValueError("invalid private/pu... | 2.890625 | 3 |
700-799/786.py | linyk9/leetcode | 0 | 51120 | <reponame>linyk9/leetcode
class Frac:
def __init__(self, idx: int, idy: int, x: int, y: int) -> None:
self.idx = idx
self.idy = idy
self.x = x
self.y = y
def __lt__(self, other: "Frac") -> bool:
return self.x * other.y < self.y * other.x
class Solution:
def kthSmall... | 3.046875 | 3 |
kijiji_manager/models.py | dudududodododedede/kijiji-manager | 29 | 51121 | <reponame>dudududodododedede/kijiji-manager
from flask import session
from flask_login import UserMixin
class User(UserMixin):
"""User model
Saves user data in Flask session
"""
def __init__(self, user_id, token, email=None, name=None):
self.id = user_id
self.token = token
se... | 3.03125 | 3 |
varundeboss/apis/urls.py | varundeboss/varundeboss | 0 | 51122 | from django.conf.urls import url, include
from django.contrib.auth.models import User
urlpatterns = [
url(r'^test/', include('testapp.urls'), name='Test User/Group API'),
url(r'^resume/', include('apis.jsonresume_org.urls'), name='Json Resume'),
url(r'^schema/', include('apis.schema_org.urls'), name='Schem... | 1.78125 | 2 |
denguefever_tw/hospital/urls.py | NCKU-CCS/line_bot_server | 3 | 51123 | <filename>denguefever_tw/hospital/urls.py<gh_stars>1-10
from django.conf.urls import url
from .views import hospital_insert, hospital_nearby
urlpatterns = [
url(r'^insert/', hospital_insert),
url(r'^nearby/', hospital_nearby),
]
| 1.648438 | 2 |
SourceCode/cryptomath.py | Anusha1790/Secure_E-Voting_Mechanism_using_Blind-Signature_and_Digital_Signature | 0 | 51124 | # Cryptomath Module
import random
def gcd(a, b):
# Returns the GCD of positive integers a and b using the Euclidean Algorithm.
if a>b:
x, y = a, b
else:
y, x = a, b
while y!= 0:
temp = x % y
x = y
y = temp
return x
def extendedGCD(a,b): #used to find mod ... | 3.40625 | 3 |
test/data_processing/test_find_best_worst_lists.py | 0xProject/p2p_incentives | 3 | 51125 | <reponame>0xProject/p2p_incentives
"""
This module contains unit tests of find_best_worst_lists().
"""
from typing import List, Tuple
import pytest
from data_processing import find_best_worst_lists
from data_types import BestAndWorstLists, InvalidInputError, SpreadingRatio
from .__init__ import RATIO_LIST
# test nor... | 2.234375 | 2 |
quizer/urls.py | mikaelosterberg/QuizerBackend | 0 | 51126 | <gh_stars>0
from django.conf.urls import url, include
from rest_framework import routers
from .api import AnswerViewSet, ChoiceViewSet, QuestionViewSet, ResultViewSet
router = routers.DefaultRouter()
router.register(r'answer', AnswerViewSet)
router.register(r'choice', ChoiceViewSet)
router.register(r'question', Quest... | 2.015625 | 2 |
ancilla/ancilla/foundation/node/api/api.py | frenzylabs/ancilla | 7 | 51127 | <filename>ancilla/ancilla/foundation/node/api/api.py
'''
api.py
ancilla
Created by <NAME> (<EMAIL>) on 01/08/20
Copyright 2019 FrenzyLabs, LLC.
'''
import time
import json
from ...data.models import Service, ServiceAttachment
from ..response import AncillaError
class Api(object):
def __init__(self, se... | 2.03125 | 2 |
tests/test_discord.py | ktaranov/HPI | 1 | 51128 | from more_itertools import ilen
from my.discord import messages, activity
def test_discord() -> None:
assert ilen(messages()) > 100
# get at least 100 activity events
i: int = 0
for event in activity():
assert isinstance(event, dict)
i += 1
if i > 100:
break
e... | 2.359375 | 2 |
python/str1.py | Surya-06/My-Solutions | 0 | 51129 | r=raw_input()
count=1
for s in r:
if not s.islower():
count+=1
print count
| 3.46875 | 3 |
17086/solution.py | bossm0n5t3r/BOJ | 2 | 51130 | import sys
from collections import deque
def sol():
# sys.stdin = open("./17086/input.txt")
input = sys.stdin.readline
N, M = map(int, input().split())
baby_sharks = deque()
space = []
for r in range(N):
tmp = list(map(int, input().split()))
for c in range(M):
if tm... | 3.03125 | 3 |
Python Programs/exception.py | Chibi-Shem/Hacktoberfest2020-Expert | 77 | 51131 | <reponame>Chibi-Shem/Hacktoberfest2020-Expert<gh_stars>10-100
while True:
try:
num=int(input("Input your number: "))
print("Your number is {}".format(num))
break
except:
print("Please insert number!") | 3.515625 | 4 |
modules/2.79/bpy/types/XnorController.py | cmbasnett/fake-bpy-module | 0 | 51132 | <reponame>cmbasnett/fake-bpy-module<filename>modules/2.79/bpy/types/XnorController.py
class XnorController:
pass
| 1.09375 | 1 |
software/input_variable_processing/out_processing/out_parsing.py | Searchlight2/Searchlight2 | 17 | 51133 | <reponame>Searchlight2/Searchlight2
def out_parsing(out_path_parameter, global_variables):
# default inputs
out_path = None
# gets the sub-parameters
sub_params_list = out_path_parameter.split(",")
for sub_param in sub_params_list:
if sub_param.upper().startswith("path=".upper()):
... | 3.203125 | 3 |
compiler.py | danialkeimasi/python-compiler-symbol-table | 0 | 51134 | from pprint import pprint
from dataclasses import dataclass, field
from typing import List
from tabulate import tabulate
from typer import Typer
from sly import Lexer
app = Typer()
class Scanner(Lexer):
"""Lexer class for scanning the code.
"""
tokens = {
IF_KW, ELSE_KW, FOR_KW,... | 3.25 | 3 |
dsbox-cleaning/dsbox/datapreprocessing/cleaner/greedy.py | Rosna/P4ML-UI | 1 | 51135 | <gh_stars>1-10
import numpy as np
import pandas as pd
from . import missing_value_pred as mvp
from primitive_interfaces.supervised_learning import SupervisedLearnerPrimitiveBase
from primitive_interfaces.base import CallMetadata
from typing import NamedTuple, Sequence
import stopit
import math
Input = pd.DataFrame
Ou... | 2.921875 | 3 |
seqauto/migrations/0028_one_off_set_sequencing_run_date.py | SACGF/variantgrid | 5 | 51136 | <filename>seqauto/migrations/0028_one_off_set_sequencing_run_date.py
# Generated by Django 3.1.3 on 2021-06-15 02:43
import logging
import re
from datetime import datetime
from django.db import migrations
from django.utils.timezone import make_aware
def _one_off_set_sequencing_run_date(apps, schema_editor):
Sequ... | 2.109375 | 2 |
grr/test_lib/db_test_lib.py | 4ndygu/grr | 0 | 51137 | <reponame>4ndygu/grr<filename>grr/test_lib/db_test_lib.py
#!/usr/bin/env python
"""Test utilities for RELDB-related testing."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import functools
import sys
import mock
from grr_response_core.lib.util import... | 1.804688 | 2 |
src/alldecays/plotting/toys/diagnostics/__init__.py | LLR-ILD/alldecays | 0 | 51138 | """Diagnostics plots that might be useful for fits that are not well behaved."""
from .toy_counts_channel import toy_counts_channel
__all__ = [
"toy_counts_channel",
]
| 1.164063 | 1 |
xlwings/pro/tables.py | knmaki/xlwings | 0 | 51139 | <gh_stars>0
try:
import pandas as pd
except ImportError:
pd = None
def update(self, data):
type_error_msg = 'Currently, only pandas DataFrames are supported by update'
if pd:
if not isinstance(data, pd.DataFrame):
raise TypeError(type_error_msg)
col_diff = len(self.range.co... | 2.484375 | 2 |
contestparser/contestparser_test.py | leifvan/contestparser | 0 | 51140 | <reponame>leifvan/contestparser
import unittest
from typing import NamedTuple, List
from contestparser import LinearParser, ParseList
class TestParseList(unittest.TestCase):
def test_fixed_length(self):
text = ("3\n"
"a b c\n"
"d e f\n"
"g h i\n")
l... | 2.9375 | 3 |
server/config/urls.py | ruicamposcolabpt/MontyCarlo | 0 | 51141 | """config URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... | 2.578125 | 3 |
projects/ABDNet/eval_acc.py | Danish-VSL/deep-person-reid | 244 | 51142 | from __future__ import print_function
from __future__ import division
import os
import sys
import time
import datetime
import os.path as osp
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
from torch.optim import lr_scheduler
from args import... | 2.125 | 2 |
src/borneo/client.py | LaudateCorpus1/nosql-python-sdk | 0 | 51143 | #
# Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Universal Permissive License v 1.0 as shown at
# https://oss.oracle.com/licenses/upl/
#
from logging import DEBUG
from multiprocessing import pool
from platform import python_version
from requests import Session
fro... | 1.820313 | 2 |
tfmiss/preprocessing/preprocessing.py | shkarupa-alex/tfmiss | 1 | 51144 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.framework import random_seed
from tensorflow.python.ops.ragged import ragged_tensor
from tfmiss.ops import tfmiss_ops
def cbow_context(source, window, empty, nam... | 2.359375 | 2 |
access_niu/components/__init__.py | accessai/access-niu | 15 | 51145 | <reponame>accessai/access-niu<gh_stars>10-100
import abc
from abc import ABCMeta
class Component(object):
__metaclass__ = ABCMeta
def __init__(self, **kwargs):
self._is_active = (
kwargs.get("active") if kwargs.get("active") is not None else True
)
@abc.abstractmethod
de... | 2.71875 | 3 |
meiduoshop/apps/verify/urls.py | 1572990942/meiduoshop | 0 | 51146 | <reponame>1572990942/meiduoshop
from django.urls import path
from apps.verify import views
urlpatterns = [
# this.image_code_url = this.host + "/image_codes/" + this.image_code_id + "/";
path('image_codes/<uuid:uuid>/', views.ImageCode.as_view()),
path('sms_codes/<mobile:mobile>/', views.SmsCodeView.as_vie... | 1.640625 | 2 |
traceback_with_variables/global_hooks.py | cclauss/traceback_with_variables | 550 | 51147 | import sys
from typing import NoReturn, Optional, Type
from traceback_with_variables.print import print_exc, Format
def global_print_exc(fmt: Optional[Format] = None) -> NoReturn:
sys.excepthook = lambda e_cls, e, tb: print_exc(e=e, fmt=fmt)
def global_print_exc_in_ipython(fmt: Optional[Format] = Non... | 2.484375 | 2 |
346-moving-average-from-data-stream/346-moving-average-from-data-stream.py | jurayev/data-structures-algorithms-solutions | 0 | 51148 | <gh_stars>0
class MovingAverage:
"""
[1,10,3,5]
size = 3
n = 4
[0,1,11,14,19]
"""
def __init__(self, size: int):
self.size = size
self.prefixes = [0]
def next(self, val: int) -> float:
n = len(self.prefixes)
self.prefixes.append(val)
self.pre... | 3.484375 | 3 |
forms/migrations/0003_answer_entry.py | City-of-Helsinki/mvj | 1 | 51149 | <reponame>City-of-Helsinki/mvj
# Generated by Django 2.2.13 on 2021-09-14 11:16
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | 1.671875 | 2 |
client.py | dd0/gresearch-sentiment-challenge | 0 | 51150 | """This is the main module"""
import random
import webhandler
import sentimentanalyser
def main():
"""Run client"""
if not webhandler.API_KEY:
raise ValueError("Set your API_KEY in webhandler.py! Find it on https://devrecruitmentchallenge.com/account")
analyser = sentimentanalyser.SentimentAnalyse... | 2.890625 | 3 |
application/views/authentication.py | aditya369b/Gator-Barter-Website | 0 | 51151 | <filename>application/views/authentication.py
"""
BluePrint for all Authontication routs and logic
Use "from passlib.hash import sha256_crypt" as our encryption library
User information stored in the session (Backend) as a dictionary
And accessible from any route
30% written by <NAME>
70% written By <NAME>
If any q... | 3 | 3 |
mysite/main/forms.py | leonkoech/Django-ToDo-List | 0 | 51152 | from django import forms
class CreateListForm(forms.Form):
name = forms.CharField(label="Name ", max_length=300)
| 2.078125 | 2 |
services/tests/test_rabbitmq_wrapper_int.py | ToucanBran/gateio-crypto-trading-bot-binance-announcements-new-coins | 1 | 51153 | from services.rabbitmq_wrapper import RabbitMqWrapper
import yaml
def test_given_validRabbitConfigurations_when_openChannelCalled_then_expectSuccessfulConnection(configs):
wrapper = RabbitMqWrapper(configs["queue"])
channel = wrapper.open_channel()
opened = channel.is_open
wrapper.close_connection()
... | 2.234375 | 2 |
bin/compare_configs.py | astroweaver/dev-tractor-pipeline | 6 | 51154 | <reponame>astroweaver/dev-tractor-pipeline
# Compare two Farmer config files to determine the differences
# assumes the config files are either within the current working directory or within config/
# LMZ
import sys
import os
import importlib
import numpy as np
sys.path.insert(0, os.path.join(os.getcwd(), 'src')) ... | 2.375 | 2 |
setup.py | louity/pyscatharm | 0 | 51155 | #!/usr/bin/env python
import os
import shutil
import sys
from setuptools import setup, find_packages
VERSION = '0.0.1'
long_description = """
Fast CPU/CUDA Solid Harmonic 3D Scattering implementation
Numpy + PyTorch + FFTW / cuFFT implementation
"""
setup_info = dict(
# Metadata
name='scatharm',
version... | 1.132813 | 1 |
example.py | thehappydinoa/Aquos-Module-Python | 9 | 51156 | import argparse
from aquosRemote.aquos import AquosTV
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--ip-address", type=str,
help="IP address of AQUOS TV", required=True)
args = parser.parse_args()
# Example/Test
aquos = AquosTV(args.ip_address,... | 2.484375 | 2 |
Python/main.py | akulaarora/My-All-Weather-Strategy | 0 | 51157 | # For importing keys
import sys
sys.path.append("../")
sys.path.append("DONOTPUSH/")
import api_keys
# My modules
import database as db
# Libraries
import json
from time import sleep
# from github import Github
from alpha_vantage.timeseries import TimeSeries
import logging
# Constants
REPO_NAME = "My-All-Weather-Str... | 2.390625 | 2 |
examples/advanced/time_series_forecasting/exogenous.py | vishalbelsare/FEDOT | 0 | 51158 | <reponame>vishalbelsare/FEDOT<filename>examples/advanced/time_series_forecasting/exogenous.py
import os
import timeit
import warnings
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from sklearn.metrics import mean_squared_error, mean_absolute_error
from fedot.core.data.data import InputDa... | 2.734375 | 3 |
v2/backend/admin/__init__.py | jonfairbanks/rtsp-nvr | 558 | 51159 | <gh_stars>100-1000
from backend.magic import Bundle
from .macro import macro
from .model_admin import ModelAdmin
admin_bundle = Bundle(__name__)
| 1.140625 | 1 |
text_messages/tests/test_utils.py | SmartElect/SmartElect | 23 | 51160 | <reponame>SmartElect/SmartElect<gh_stars>10-100
from django.test import TestCase
from django.utils.translation import override
from text_messages.models import MessageText
from text_messages.utils import get_message, pick_text
class TextMessagesUtilsTestCase(TestCase):
def setUp(self):
self.number = 397
... | 2.15625 | 2 |
test/apartment_test.py | doruirimescu/helsinki-apartment-finder | 0 | 51161 | from apartment import Apartment, Apartments, Price, Area, Year, Vastike, Floor, Rooms, Zone, K, Parameter
import pytest
import unittest
class TestParameter(unittest.TestCase):
def test_K(self):
self.assertEqual(K, 1000)
def test_Parameter_Constructor_DefaultValues(self):
p = Parameter(150*K)
... | 2.9375 | 3 |
sable/view.py | HH-MWB/sable | 0 | 51162 | <reponame>HH-MWB/sable
"""Sable Viewer"""
from typing import Iterable
from typer import colors, echo, style
from sable.data import TestCase
from sable.exec import test
TAG_PASS: str = style("Passed", fg=colors.WHITE, bg=colors.GREEN)
TAG_FAIL: str = style("Failed", fg=colors.WHITE, bg=colors.RED)
def view(cases: ... | 2.71875 | 3 |
carto/__init__.py | wallarelvo/SmallCartography | 0 | 51163 | <filename>carto/__init__.py
__all__ = ["mapper", "master", "reducer", "client"]
import mapper
import master
import reducer
import client
| 1.15625 | 1 |
2021/examples-in-class-2021-09-24/if_block_example1.py | ati-ozgur/course-python | 1 | 51164 | birth_year = 1999
if birth_year < 2000:
print("line 1")
print("line 2")
print("line 3")
else:
print("line 4")
print("line 5")
print("line 6")
if birth_year < 2000:
print("line 1")
print("line 2")
print("line 3")
else:
print("line 4")
print("line 5")
print("line 6")
| 3.59375 | 4 |
mindhome_alpha/erpnext/patches/v13_0/loyalty_points_entry_for_pos_invoice.py | Mindhome/field_service | 1 | 51165 | <filename>mindhome_alpha/erpnext/patches/v13_0/loyalty_points_entry_for_pos_invoice.py<gh_stars>1-10
# Copyright (c) 2019, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
'''`sales_invoice` field from loyalty poin... | 1.9375 | 2 |
tests/test_Overhang.py | Edinburgh-Genome-Foundry/Overhang | 0 | 51166 | <gh_stars>0
import overhang
def test_Overhang():
oh_aaa = overhang.Overhang("AAA")
assert oh_aaa.overhang == "AAA"
assert oh_aaa.overhang_rc == "TTT"
assert oh_aaa.has_multimer is True # tests count_max_repeat()
assert oh_aaa.is_good() is True
assert oh_aaa.gc_content == 0
oh_ttaa = over... | 2.390625 | 2 |
twitter/__init__.py | alexcchan/twitter | 0 | 51167 | <reponame>alexcchan/twitter
from twitter import *
| 0.960938 | 1 |
core/src/apps/lisk/helpers.py | Kayuii/trezor-crypto | 0 | 51168 | from trezor.crypto.hashlib import sha256
from apps.common import HARDENED
def get_address_from_public_key(pubkey):
pubkeyhash = sha256(pubkey).digest()
address = int.from_bytes(pubkeyhash[:8], "little")
return str(address) + "L"
def get_votes_count(votes):
plus, minus = 0, 0
for vote in votes:
... | 2.46875 | 2 |
launch_parallel.py | jbr-ai-labs/NeurIPS2020-Flatland-Competition-Solution | 6 | 51169 | <filename>launch_parallel.py
import torch
from multiprocessing import Pool, set_start_method
from functools import partial
import argparse
from copy import deepcopy
from train import start_experiment
__device = None
def load_experiments(exp_path, sdevice):
exp_list = torch.load(exp_path)
# TODO a better... | 2.609375 | 3 |
fiubar/forms.py | maru/fiubar | 5 | 51170 | <reponame>maru/fiubar
# -*- coding: utf-8 -*-
from captcha.fields import ReCaptchaField
from django import forms
from django.conf import settings
class SignupForm(forms.Form):
"""
Signup form with recaptcha field.
"""
field_order = ['username', 'email', '<PASSWORD>', ]
if hasattr(settings, 'RECAP... | 2.546875 | 3 |
seed_scraper/items.py | uoshvis/seed-scraper | 0 | 51171 | <filename>seed_scraper/items.py
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
class EnforcementItem(scrapy.Item):
legal_case_name = scrapy.Field()
legal_case_detail_url = scrapy.Field()
defendant_name = scrap... | 2.234375 | 2 |
Examples/Ramps/Ramps.py | Zahner-elektrik/Zahner-Remote-Python | 0 | 51172 | <reponame>Zahner-elektrik/Zahner-Remote-Python
from zahner_potentiostat.scpi_control.searcher import SCPIDeviceSearcher
from zahner_potentiostat.scpi_control.serial_interface import SerialCommandInterface, SerialDataInterface
from zahner_potentiostat.scpi_control.control import *
from zahner_potentiostat.scpi_control.d... | 1.609375 | 2 |
models.py | martno/cyclegan-pytorch | 0 | 51173 | <reponame>martno/cyclegan-pytorch
import torch.nn as nn
import torch.nn.functional as F
NUM_COLOR_CHANNELS = 3
NUM_GEN_FEATURES = 32
GEN_KERNEL_SIZE = 3
NUM_DISCR_FEATURES = 64
DISCR_KERNEL_SIZE = 4
DISCR_PADDING = 1
NUM_RESNET_BLOCKS = 6
RECONSTRUCTED_LOSS_WEIGHT = 10
LEAKY_RELU_NEGATIVE_SLOPE = 0.2
class Gen... | 2.4375 | 2 |
python/argparse/power.py | zeroam/TIL | 0 | 51174 | <filename>python/argparse/power.py
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('x', type=int, help='the base')
parser.add_argument('y', type=int, help='the exponent')
# action='count'를 통해 -v 옵션의 갯수를 리턴 받을 수 있다.
# ex) -vv -> 2, -v -> 1, 기본값은 0으로 설정(default=0)
parser.add_argument('-v', '--verbo... | 4.09375 | 4 |
model/lednet.py | AceCoooool/LEDNet | 41 | 51175 | from torch import nn
import torch.nn.functional as F
from model.basic import DownSampling, SSnbt, APN
class LEDNet(nn.Module):
def __init__(self, nclass, drop=0.1):
super(LEDNet, self).__init__()
self.encoder = nn.Sequential(
DownSampling(3, 29), SSnbt(32, 1, 0.1 * drop), SSnbt(32, 1, ... | 2.53125 | 3 |
excel/book.py | cicicici/hopper | 0 | 51176 | <reponame>cicicici/hopper
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import datetime
from copy import copy, deepcopy
from openpyxl import load_workbook
from ..util.opt import Opt
from ..util.fs import file_exist
from ..debug impor... | 2.125 | 2 |
uuv_manipulators_kinematics/test/test_arm_interface.py | tdenewiler/uuv_manipulators | 8 | 51177 | #!/usr/bin/env python
# Copyright (c) 2016 The UUV Simulator Authors.
# 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... | 2.3125 | 2 |
selection.py | lel23/Biodegradable-Prediction | 0 | 51178 | """
Feature Selection
Test 3
Random Forest, heatmap
"""
import matplotlib.pyplot as plt
from mlxtend.plotting import scatterplotmatrix
from sklearn.ensemble import RandomForestClassifier
from sklearn.feature_selection import SelectFromModel
from sklearn.model_selection import train_test_split
from mlxtend.plotting im... | 2.6875 | 3 |
gpgpu/generators/render_volume_defs.py | jpanikulam/experiments | 1 | 51179 | <filename>gpgpu/generators/render_volume_defs.py<gh_stars>1-10
# %codegen(cl_gen)
import generate_opencl_structs
def main():
cfg_defd = [
{
'type': 'int',
'length': 1,
'name': 'method',
},
{
'type': 'float',
'length': 1,
... | 1.710938 | 2 |
src/tutorial2.py | gpu0/pytorch-examples | 1 | 51180 | """
autograd package provides automatic differentiation for all operations on Tensors.
"""
import torch
from torch.autograd import Variable
"""
autograd.Variable wraps around Tensor and
supports (almost) all ops defined on it.
One can directly call .backward() and have
all gradients calculated automatically.
"""
x ... | 3.453125 | 3 |
vulnscan_parser/models/testssl/finding.py | happyc0ding/vulnscan-parser | 17 | 51181 | from vulnscan_parser.models.vsfinding import VSFinding
class TestsslFinding(VSFinding):
def __init__(self):
super().__init__()
self.ignored_dict_props.extend(['vulnerability', 'ports'])
self.ignored_dict_props.remove('finding')
self.vulnerability = None
self._cwe = []
... | 2.390625 | 2 |
cloudmesh/google/__init__.py | cloudmesh/cloudmesh-google | 0 | 51182 | __version__ = "4.1.9" | 1.015625 | 1 |
Scripts/university_construct_plots.py | Friso-Selten/A-Longitudinal-Analysis-of-University-Rankings | 3 | 51183 | import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.style as style
import numpy as np
import os
style.use('ggplot')
grid_list = ['grid.168010.e', 'grid.1032.0', 'grid.7177.6', 'grid.194645.b', 'grid.6571.5']
dirname = os.getcwd()
dirname = dirname + '/Data/'
df_ARWU2018 = pd.read_csv(dirname + 'AR... | 1.960938 | 2 |
Accidence/tstring.py | mkinsz/pymodule | 0 | 51184 | <reponame>mkinsz/pymodule<gh_stars>0
import cmath
import math
name = 'John'
age = 23
print('%s is %d years old.' % (name, age))
params = {'name': 'John', 'age': 23}
print('%(name)s is %(age)d years old' % params)
mylist = [1, 2, 3]
print("A list: %s" % mylist)
data = ('John', 'Doe', 55.34)
format_string = 'Hello %s %... | 3.40625 | 3 |
src/QieyunEncoder/工具/反切.py | nk2028/qieyun-encoder | 0 | 51185 | # -*- coding: utf-8 -*-
'''
根據反切規律自動完成反切過程。
'''
from typing import List
from ..常量 import 常量
from ..音韻地位 import 音韻地位
from .._拓展音韻屬性 import 母到標準等
def _jointer(xs: List[str]):
'''
將多個字串以頓號和「或」字連接。
```python
>>> _jointer(['A'])
'A'
>>> _jointer(['A', 'B'])
'A或B'
>>> _jointer(['A', 'B', ... | 3.765625 | 4 |
Pygts/Utils/__init__.py | George-Gou/DeepGravity | 1 | 51186 | # -- coding : utf-8 --
# @Time:2022/1/22 17:30
# @Author: <NAME>(<EMAIL>)
| 0.910156 | 1 |
tests/utils_test.py | BostonDSA/fest | 10 | 51187 | from fest import utils
class SomeClass:
pass
def test_future():
fut = utils.Future(iter('abcdefg'))
ret = fut.filter(lambda x: x < 'e').execute()
exp = list('abcd')
assert ret == exp
def test_digest():
ret = {'fizz': 'buzz'}
assert utils.digest(ret) == 'f45195aef08daea1be5dbb1c7feb5763... | 2.359375 | 2 |
examples/shorten_url.py | Vincydotzsh/fasmga.py | 2 | 51188 | import asyncio
import fasmga
import os
client = fasmga.Client(os.getenv("FGA_TOKEN"))
@client.on("ready")
async def main():
url = await client.shorten("http://example.com", "your-url-id")
# change "your-url-id" with the url ID you want,
# or remove it if you want it to generate a random one.
print("Y... | 3.28125 | 3 |
python/simple_run_weekly.py | shibli049/miscellaneous | 1 | 51189 | #! /usr/local/bin/python3.7
``` Usage: cron job
0 */1 * * * simple_run_weekly.py
```
from datetime import date
import json
from subprocess import run
import logging
logging.basicConfig(level=logging.INFO,
format=' %(asctime)s - %(levelname)s - %(lineno)d - %(message)s')
ALERT_DAY='Thursday'
file... | 2.328125 | 2 |
md.py | Tensai7/manga-dl | 0 | 51190 | <filename>md.py
import argparse
import os
import urllib.request
from urllib.error import HTTPError
from urllib.request import urlopen
from sys import exit
import extra
from parsers import Mangapanda, Mangasee
opener = urllib.request.build_opener()
opener.addheaders = [('User-Agent',
'Mozilla/5.0 ... | 2.359375 | 2 |
swexpert/d2/sw_5186.py | ruslanlvivsky/python-algorithm | 3 | 51191 | # 1일차 - 이진수2
test_cases = int(input())
# 10진수 -> 2진수
def dec_to_bin(decimal):
binary = ''
while decimal != 0:
decimal *= 2
if decimal >= 1:
decimal -= 1
binary += '1'
else:
binary += '0'
if len(binary) >= 13:
binary = 'overflow'
... | 3.421875 | 3 |
tests/station/test_parameter_get.py | ismaelJimenez/mamba_client | 0 | 51192 | <gh_stars>0
from mamba_client.station import NetworkController, ParameterGet
from mamba_client.mock.mamba_server_mock import MambaServerMock
class TestClass:
def test_parameter_get_init(self):
MambaServerMock(port=34562)
network_controller = NetworkController(port=34562)
param_set = Param... | 2.296875 | 2 |
DFS/0094_binary_tree_inorder_traversal.py | MartinMa28/Algorithms_review | 0 | 51193 | class TreeNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def inorderTraversal(self, root: TreeNode) -> list:
if root == None:
return []
stack = []
visited = set()
trav = []
stack.append(root)
wh... | 3.6875 | 4 |
Aula Python/Aula 09 ex1.py | ayresmajor/Curso-python | 0 | 51194 | frase = 'Curso em Vídeo Python'
print('-'.join(frase.split()))
| 3.078125 | 3 |
mrwer.py | amali/multiRefWER | 6 | 51195 | <filename>mrwer.py
#!/usr/bin/python -tt
# this is the main script for MR-WER
#
# Copyright (C) 2017, Qatar Computing Research Institute, HBKU (author: <NAME>)
#
from __future__ import division
import sys
reload(sys)
import codecs
import collections
import re
from subprocess import call
import numpy as np
from mr... | 2.453125 | 2 |
getJSON.py | tinoue70/CitationUtil | 0 | 51196 | #!/usr/bin/env python3
# -*- coding: utf-8-*-
"""\
Get CMIP6 Citation info and save as a JSON file.
---
This script gets Citation info from the citation service.
You have to specify MIP(`activity_id`), model(`source_id`),
institution(`institution_id`), and experiment(`experiment_id`) to get
info.
"""
from utils impo... | 2.46875 | 2 |
umqtt.robust/example_sub_robust.py | Carglglz/micropython-lib | 1,556 | 51197 | import time
from umqtt.robust import MQTTClient
def sub_cb(topic, msg):
print((topic, msg))
c = MQTTClient("umqtt_client", "localhost")
# Print diagnostic messages when retries/reconnects happens
c.DEBUG = True
c.set_callback(sub_cb)
# Connect to server, requesting not to clean session for this
# client. If the... | 2.953125 | 3 |
vendor/packages/translate-toolkit/translate/storage/wordfast.py | jgmize/kitsune | 2 | 51198 | <filename>vendor/packages/translate-toolkit/translate/storage/wordfast.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2007 Zuza Software Foundation
#
# This file is part of translate.
#
# translate is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | 1.546875 | 2 |
Python/implement-strstr.py | RideGreg/LeetCode | 1 | 51199 | <reponame>RideGreg/LeetCode
# Time: O(n + k)
# Space: O(k)
# 28
# Implement strStr().
#
# Returns a pointer to the first occurrence of needle in haystack,
# or null if needle is not part of haystack.
#
# Wiki of KMP algorithm:
# http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
class Solution(object):
d... | 3.6875 | 4 |