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 |
|---|---|---|---|---|---|---|
pyunit_idcard/idcard.py | PyUnit/pyunit-idCard | 5 | 12777051 | # !/usr/bin/python3.7
# -*- coding: utf-8 -*-
# @Time : 2020/6/22 上午10:07
# @Author: <EMAIL>
# @Notes : 身份证实体抽取,身份证补全,身份证检测等功能
import json
import os
import re
from datetime import datetime
class NumberNotShortError(Exception):
...
class IDCardNotStingError(Exception):
...
class IDCardFormatError(Exceptio... | 2.765625 | 3 |
root_gnn/src/datasets/herwig_hadrons.py | Calvin-Qiu/TopReco | 0 | 12777052 | import numpy as np
import itertools
from graph_nets import utils_tf
from root_gnn.src.datasets.base import DataSet
n_node_features = 6
max_nodes = 3 # including the particle that decays
def num_particles(event):
return len(event) // n_node_features
def make_graph(event, debug=False):
# each particle contains... | 2.375 | 2 |
labs_web/views/student/announcement.py | okorienev/labs_web | 2 | 12777053 | <gh_stars>1-10
from flask.views import View
from flask_login import current_user, login_required
from flask import render_template, redirect, url_for, flash
from labs_web.extensions import get_announcement_by_oid
class Announcement(View):
decorators = [login_required]
def dispatch_request(self, *args, **kwar... | 2.265625 | 2 |
models/network.py | uidmice/placement-simulation | 0 | 12777054 | <reponame>uidmice/placement-simulation
import numpy as np
import networkx as nx
from networkx.drawing.nx_pydot import graphviz_layout
import matplotlib.pyplot as plt
from models.domain import Domain
from models.device import Device
from models.router import Router
from models.link import Link
"""
Constants associate... | 2.96875 | 3 |
model/resnet.py | xzgz/vehicle-reid | 3 | 12777055 | from __future__ import absolute_import
from __future__ import division
import torch
import copy
from torch import nn
from torch.nn import functional as F
from torchvision.models.resnet import resnet50, Bottleneck
from .hacnn import SoftBlock, SoftHardBlock
import torchvision
class ResNet50(nn.Module):
def __init... | 2.296875 | 2 |
setup.py | ccnmtl/epubbuilder | 0 | 12777056 | <gh_stars>0
from __future__ import unicode_literals
from setuptools import setup
setup(
name="epubbuilder",
version="0.2.1",
author="<NAME>",
author_email="<EMAIL>",
url="https://github.com/ccnmtl/epubbuilder",
description="epub builder library",
long_description="forked from python-epub-b... | 1.273438 | 1 |
framework/models/courses.py | sperea/LMS-Backend-Boilerplate-Django-REST | 0 | 12777057 | import os
import uuid
from django.db import models
from accounts.models import Student
from accounts.models import Teacher
import cloudinary
class CourseORM(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=150)
slug = models.Sl... | 2.21875 | 2 |
app/hook_details/push_hook_details.py | futuresimple/triggear | 14 | 12777058 | <reponame>futuresimple/triggear<filename>app/hook_details/push_hook_details.py
from typing import Dict, Set, Union
from app.clients.github_client import GithubClient
from app.enums.event_types import EventType
from app.hook_details.hook_details import HookDetails
from app.mongo.registration_cursor import RegistrationC... | 2.09375 | 2 |
bench/py/keyedpq_a.py | pskopnik/apq | 4 | 12777059 | <gh_stars>1-10
from dataclasses import dataclass, field
from typing import Any, Dict, Generic, List, Tuple, TypeVar, Union
import heapq
import math
_KT = TypeVar('_KT') # key type
_DT = TypeVar('_DT') # data type
_KT_inner = TypeVar('_KT_inner') # alternative key type for inner definitions
_DT_inner = TypeVar('_DT_in... | 2.40625 | 2 |
display.py | qxcross/muniak | 0 | 12777060 | <reponame>qxcross/muniak<filename>display.py
# These functions deal with displaying information in CLI
## Check Payment Display
def display_lessons(lessons):
print('displaying lesson payment info')
unpaid_lessons = []
paid_lessons = []
for lesson in lessons:
if lesson['paid'] == 'n':
... | 3.125 | 3 |
jrk/el_hyperparams.py | mehdi-mirzapour/eigenthemes | 11 | 12777061 | '''
Code modified by the authors of the paper: "Low-rank Subspaces for Unsupervised Entity Linking" to enable working with "Wikidata" instead of "Freebase"
'''
import argparse
sup_train=False
MAX_POS = 10
MAX_N_POSS_TEST = 100
MAX_N_POSS_TRAIN = 100
N_NEGS = 10
SAMPLE_NEGS = True
TYPE_OPT = 'mean'
parser = argparse.... | 2.609375 | 3 |
in-class/Week 5 BikeShare ClusterTree.py | dvtate/cs484 | 0 | 12777062 | # Load the necessary libraries
import matplotlib.pyplot as plt
import numpy
import pandas
import sklearn.cluster as cluster
import sklearn.metrics as metrics
bikeshare = pandas.read_csv('C:\\Users\\minlam\\Documents\\IIT\\Machine Learning\\Data\\BikeSharingDemand_Train.csv',
delimit... | 3.0625 | 3 |
examples/Hunter_Johnston_Dissertation/Chapter_6/Example_6_1/outerLoop/outSpec_EOL.py | leakec/tfc | 15 | 12777063 | from tfc import utfc
from tfc.utils import TFCDictRobust, egrad, NllsClass, MakePlot
import numpy as onp
import jax.numpy as np
from jax import vmap, jacfwd, jit, lax
import tqdm
import pickle
from scipy.optimize import fsolve
from scipy.integrate import simps
from time import process_time as timer
## TEST PARAMETE... | 1.664063 | 2 |
milky_way_drift/data.py | MABradley/MilkyWayDrift | 0 | 12777064 | """
Data
================
data storage and manipulation classes, should be sufficient to run the game without display
"""
from enum import Enum
import numpy
class Facing(Enum):
YP = 0
XP = 1
ZN = 2
YN = 3
XN = 4
ZP = 5
# gives a directional delta array in hex coordinates for given Facing
de... | 3.15625 | 3 |
clsim/python/GetIceCubeCableShadow.py | hschwane/offline_production | 1 | 12777065 |
from icecube.icetray import OMKey
from icecube.simclasses import I3MapModuleKeyI3ExtraGeometryItemCylinder, I3ExtraGeometryItemCylinder
from icecube.dataclasses import I3Position, ModuleKey
from I3Tray import I3Units
import numpy as np
from os.path import expandvars
from_cable_shadow = expandvars("$I3_BUILD/ice-mod... | 2.453125 | 2 |
translations.py | anast20sm/Addarr | 0 | 12777066 | import i18n
from config import config
from definitions import LANG_PATH
i18n.load_path.append(LANG_PATH)
i18n.set('locale', config["language"])
| 2.140625 | 2 |
quflow/laplacian/sparse.py | kmodin/quflow | 0 | 12777067 | <filename>quflow/laplacian/sparse.py
import numpy as np
from numba import njit
import scipy.sparse.linalg
from scipy.sparse import coo_matrix
# ----------------
# GLOBAL VARIABLES
# ----------------
_lu_laplacian_cache = dict()
_sparse_laplacian_cache = dict()
_lu_heat_flow_cache = dict()
_use_umfpack = True
# ---... | 2.40625 | 2 |
PyQt5/Multi Form/Main.py | kuhakuu04/Python_PyQt5_GUI | 0 | 12777068 | import PyQt5.QtWidgets
import MainForm
app_module = PyQt5.QtWidgets.QApplication([])
app = MainForm.MainForm()
app.show()
app_module.exec() | 1.507813 | 2 |
profile/load-singly-bbn-time.py | gitter-badger/py-bbn | 48 | 12777069 | <reponame>gitter-badger/py-bbn
import time
from pybbn.graph.dag import Bbn
from pybbn.pptc.inferencecontroller import InferenceController
# deserialization 0.02801
# junction tree 6.10584
start = time.time()
bbn = Bbn.from_json('singly-bbn.json')
stop = time.time()
diff = stop - start
print(f'deserialization {dif... | 2.328125 | 2 |
expenda_api/expenses/serializers.py | ihsaro/Expenda | 0 | 12777070 | from rest_framework.serializers import ModelSerializer
from expenses.models import Expense
class ListRetrieveExpenseSerializer(ModelSerializer):
class Meta:
model = Expense
fields = '__all__'
class CreateExpenseSerializer(ModelSerializer):
class Meta:
model = Expense
fields ... | 2.0625 | 2 |
python/csv2sql.py | Ellian-aragao/aleatoriedades | 0 | 12777071 | <reponame>Ellian-aragao/aleatoriedades<filename>python/csv2sql.py
import sys
import csv
def main(args):
with open(args[1]) as csvfile:
reader = csv.reader(csvfile, delimiter=',')
# print('INSERT INTO tb_idioma (id_idioma, ds_abreviacao, ds_descricao) VALUES')
for i, line in enumerate(reader... | 3.421875 | 3 |
observer/observers/json_observer.py | rosenpin/EyeTracker | 0 | 12777072 | from observers.observer import Observer
from observers.eys_state import EyeStateItem, ChooseState
import json
import os
class JsonObserver(Observer):
CSV_FILE_NAME = 'db.json'
def __init__(self):
super().__init__()
def trigger(self, eye_state_item: EyeStateItem):
if eye_state_item.choos... | 2.8125 | 3 |
hackerrank/algorithm/almost-sorted/a.py | SwordYoung/cutprob | 0 | 12777073 | #!/usr/bin/env python
def test(n, nums):
assert n == len(nums)
mmax = []
stk = []
for i in xrange(n):
# print "i = %d" % (i)
mmax.append(i)
while stk and nums[i] >= nums[stk[-1]]:
stk.pop()
if not stk:
mmax[i] = 0
else:
mmax[i]... | 3.125 | 3 |
test_frcnn_count.py | vvc-unal/keras-frcnn | 0 | 12777074 | import itertools
import operator
import os
import pickle
import re
import sys
import time
import cv2
from keras import backend as K
from keras.layers import Input
from keras.models import Model
import skvideo.io
from keras_frcnn import roi_helpers
import keras_frcnn.resnet as nn
import numpy as np
video_folder = '..... | 2.359375 | 2 |
microgrid/control/__init__.py | bcornelusse/microgrid-bench | 10 | 12777075 | """
The control module provides an interface for designing microgrid operational planning controllers.
"""
from .idle_controller import IdleController
__all__ = [
'IdleController'
]
| 1.398438 | 1 |
week02_1.py | allqoow/exerciseML | 0 | 12777076 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Author : allqoow
# Contact : <EMAIL>
# Started on: 20161029(yyyymmdd)
# Project : exerciseML(Exercise for Machine Learning)
# H2.1.A
print "H2.1.A"
import matplotlib.pyplot
import math
import numpy.random
x1List = []
x2List = []
yList = []
colourList = []
with ope... | 3.15625 | 3 |
knockoff/utilities/io.py | Nike-Inc/knockoff-factory | 26 | 12777077 | import logging
from sqlalchemy import create_engine
from joblib import Parallel, delayed
logger = logging.getLogger(__name__)
def _to_sql(df, table, url, **kwargs):
to_sql_kwargs = {
'index': False,
'method': 'multi',
'if_exists': 'append'
}
to_sql_kwargs.update(kwargs)
engin... | 2.640625 | 3 |
deepcave/utils/importing.py | PhMueller/DeepCAVE | 0 | 12777078 | <gh_stars>0
import os
import glob
from typing import List
from importlib import import_module
import importlib.util
import sys
import inspect
import collections
from deepcave.utils.logs import get_logger
logger = get_logger(__name__)
def auto_import_iter(module, paths: List[str]):
for path in paths:
fo... | 2.390625 | 2 |
setup.py | Mykrass/data-synthesis-for-machine-learning | 1 | 12777079 | <filename>setup.py
#!/usr/bin/env python
from setuptools import setup
INSTALL_REQUIRES = [
'numpy >= 1.14.3',
'matplotlib >= 2.2.2',
'mako ==1.0.12',
'pandas >= 0.24.2',
'scikit-learn >= 0.20.2',
'pytest >= 4.6.2',
'python-dateutil >= 2.7.3',
'setuptools >= 39.1.0'
]
LONG_DESCRIPTION ... | 1.6875 | 2 |
Medium/comisions.py | Nahalius/PythonBasics | 0 | 12777080 | city = input("Enter city name = ")
sales = int(input("Enter sales volume = "))
cities = ["Sofia", "Varna", "Plovdiv"]
index = 4
#Discounts by cities
if 0 <= sales and sales <= 500:
comision = [0.05,0.045,0.055]
elif 500 < sales and sales <= 1000:
comision = [0.07,0.075,0.08]
elif 1000 < sales and sales <= 1000... | 3.75 | 4 |
test.py | hearteam/Linebot_project | 0 | 12777081 | # # # coding: utf-8
# # # import re
# # # import inverted_index
# # #
# # # msg = '我覺得我眼睛有點乾'
# # #
# # # pattern = '我覺得'
# # #
# # # txt = re.match(pattern,msg)
# # #
# # # # if txt != None:
# # # # print(msg.split(pattern))
# # # keyword =''
# # #
# # # if msg[0:3] == '我覺得':
# # # sentence = msg.split('我覺得')[... | 2.953125 | 3 |
dl_simulation.py | cleary-lab/CS-SMAF | 16 | 12777082 | <reponame>cleary-lab/CS-SMAF
import numpy as np
from sklearn import decomposition
from sklearn.linear_model import MultiTaskLassoCV,OrthogonalMatchingPursuit,RidgeCV,Ridge,ElasticNetCV,Lasso
import spams
from scipy.spatial import distance
from scipy.stats import spearmanr, entropy
import sys
from sklearn import mixture... | 2.203125 | 2 |
pygame_geometry/triangle.py | MarcPartensky/Pygame-Geometry | 3 | 12777083 | from .abstract import Form
class Triangle(Form):
"""Representation of triangle."""
@classmethod
def random(cls, **kwargs):
return super().random(n=3, **kwargs)
def __init__(self, points, **kwargs):
if len(points)!=3:
raise Exception("There must be 3 points in a triangle not... | 3.90625 | 4 |
app/models.py | oblassers/tuw-servicebroker | 0 | 12777084 | <reponame>oblassers/tuw-servicebroker<gh_stars>0
from openbrokerapi.catalog import ServicePlan, ServiceMetadata, ServicePlanMetaData, ServicePlanCost, Schemas
from openbrokerapi.service_broker import (
ServiceBroker,
Service,
ProvisionDetails,
ProvisionedServiceSpec,
BindDetails,
Binding,
Up... | 1.96875 | 2 |
system/tasks.py | topicgit/seal | 132 | 12777085 | import logging
import requests
import json
from celery import shared_task
from system.models import Users
from seal import settings
logger = logging.getLogger('system_celery')
@shared_task
def system_demo(one):
##因为开启了时区,所以django在数据库里面保存的为 utc 时间, 调用的时候会帮你 转为 东八区, celery会自动识别时间
from django.utils import timezo... | 2.1875 | 2 |
src/py/component.py | snwjas/RandomDesktopBackground-WEBUI | 17 | 12777086 | <filename>src/py/component.py<gh_stars>10-100
# -*-coding:utf-8-*-
"""
组件
@author <NAME>
"""
import mmap
import os
import sys
import typing
from threading import Timer
from typing import Dict
class SingletonMetaclass(type):
""" 单例元类 """
def __init__(cls, *args, **kwargs):
cls.__instance = None
... | 2.40625 | 2 |
pirates/kraken/KrakenGameFSM.py | Willy5s/Pirates-Online-Rewritten | 81 | 12777087 | <reponame>Willy5s/Pirates-Online-Rewritten<filename>pirates/kraken/KrakenGameFSM.py
from direct.directnotify import DirectNotifyGlobal
from direct.fsm.FSM import FSM
class KrakenGameFSM(FSM):
notify = DirectNotifyGlobal.directNotify.newCategory('KrakenGameFSM')
def __init__(self, av):
FSM.__init__(sel... | 2.140625 | 2 |
src/amrpkg/scripts/scan_control.py | rafafigueroa/amrws | 0 | 12777088 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Twist
from sensor_msgs.msg import LaserScan
import numpy as np
pub = rospy.Publisher('/mobile_base/commands/velocity', Twist, queue_size=10)
def sc_callback(robot_sc):
scan_ranges = robot_s... | 2.234375 | 2 |
django_cradmin/acemarkdown/widgets.py | appressoas/django_cradmin | 11 | 12777089 | import json
from django import forms
from django.template.loader import render_to_string
class AceMarkdownWidget(forms.widgets.Textarea):
template_name = 'django_cradmin/acemarkdown/widget.django.html'
directiveconfig = {
# 'showTextarea': False,
# 'theme': 'tomorrow'
}
@property
... | 2.046875 | 2 |
src/pycropml/transpiler/antlr_py/tests/test_to_specification.py | AgriculturalModelExchangeInitiative/PyCropML | 3 | 12777090 |
from pycropml.transpiler.antlr_py.to_specification import *
specification ="""
!<CyML Description Begin>
! ABD Average bulk density for soil profile (g [soil] / cm3 [soil])
! (10.5, [0.5 - 100.0]) state variable
! TLL Total soil water in the profile at the lower limit of
! plant-ext... | 2.421875 | 2 |
cities_seeder.py | ishidur/TSPSolver | 8 | 12777091 | import numpy as np # type: ignore
city_num = 20
file_path = "./coordinates/"
output_file = "random_" + str(city_num) + "_cities.csv"
if __name__ == "__main__":
# “continuous uniform” distribution random
np_cities = np.random.random((city_num, 2))
np.savetxt(file_path + output_file, np_cities, delimiter="... | 2.65625 | 3 |
duguai/game/human.py | ChiangYintso/du-guai | 6 | 12777092 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
人类玩家模块
@author: 江胤佐
"""
from typing import Iterator, Union, Set
from duguai import mode
from duguai.card.cards import cards_view
from duguai.utils import is_in
from ..game.game_env import GameEnv, _remove_last_combo, SPLIT_LINE
class Human(GameEnv.AbstractPlayer, GameEnv.Me... | 2.78125 | 3 |
setup.py | udellgroup/oboe | 74 | 12777093 | <gh_stars>10-100
import setuptools
import os
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
def package_files(directory):
"""
Recursively find all files in a (sub)directory.
Source: https://stackoverflow.com/a/36693250
"""
paths = []
for (path, directorie... | 1.71875 | 2 |
lab_7/main_4.py | MrLuckUA/python_course | 0 | 12777094 | <reponame>MrLuckUA/python_course
#! /usr/bin/python3
# -*- coding: utf-8 -*-S
def crypt(line: str) -> str:
result = str()
for symbol in line:
result += chr(ord(symbol) + 1)
return result
print(crypt(input()))
| 4.21875 | 4 |
tg_utils/checks.py | wanaryytel/tg-utils | 6 | 12777095 | from django.conf import settings
from django.core.checks import Warning
def check_production_settings(app_configs, **kwargs):
issues = []
if settings.DEBUG:
return issues
if not settings.EMAIL_HOST_PASSWORD or 'TODO' in settings.EMAIL_HOST_PASSWORD:
issues.append(
Warning(
... | 2.015625 | 2 |
apps/build.py | broadinstitute/ebola-predictor | 12 | 12777096 | <filename>apps/build.py
#!/usr/bin/env python
"""
Build a Kivy app for the selected platform.
@copyright: The Broad Institute of MIT and Harvard 2015
"""
import os, argparse, shutil, platform
def build_android(app_dir, build_options):
p4a_dist = ''
with open("./settings.cfg", "r") as sfile:
lines = ... | 2.84375 | 3 |
updater/updater.py | Cosmic-Chatter/Constellation | 0 | 12777097 | <filename>updater/updater.py
"""Module to handle updating Constellation components"""
import urllib.request
| 1.460938 | 1 |
utils/decoder/model.py | gaoyiyeah/ZASR_tensorflow | 115 | 12777098 | """Contains DeepSpeech2 model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import time
import logging
import gzip
import copy
import numpy as np
import inspect
from utils.decoder.swig_wrapper import Scorer
from utils.decoder.swig_... | 2.53125 | 3 |
src/exojax/spec/atomll.py | dcmvdbekerom/exojax | 0 | 12777099 | <reponame>dcmvdbekerom/exojax<gh_stars>0
import numpy as np
from exojax.spec import atomllapi
from exojax.utils.constants import ccgs, m_u, kB, hcperk, ecgs, hcgs, Rcgs, a0, eV2wn
import jax.numpy as jnp
def Sij0(A, gupper, nu_lines, elower, QTref_284, QTmask, Irwin=False):
"""Reference Line Strength in Tref=296K,... | 2.015625 | 2 |
tests/boards/utils.py | trickeydan/j5-dev | 10 | 12777100 | """Utility classes for testing."""
from typing import Optional, Set, Type
from j5.backends import Backend
from j5.boards import Board
from j5.components import Component
class MockBoard(Board):
"""A testing board with little to no functionality."""
def __init__(self, serial: str):
self._serial = ser... | 2.984375 | 3 |
Agents/NetworkAgent/network/agent.py | Entek-Technical-Services/BEMOSS3.5 | 73 | 12777101 | # -*- coding: utf-8 -*-
'''
Copyright (c) 2016, Virginia Tech
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of condi... | 1.101563 | 1 |
JupyterNotebooks/JupyterNotebooksLib/cli.py | allihuwa/Content-Production-for-Improving-Cancer-Treatment-Worklflow | 1 | 12777102 | import slicer
def cliRunSync(module, node=None, parameters=None, delete_temporary_files=True, update_display=True):
"""Run CLI module. If ipywidgets are installed then it reports progress.
"""
try:
from ipywidgets import IntProgress
from IPython.display import display
# Asynchronous run, with proge... | 2.75 | 3 |
fence/blueprints/login/shib.py | ohsu-comp-bio/fence | 0 | 12777103 | import flask
from flask_restful import Resource
from fence.auth import login_user
from fence.blueprints.login.redirect import validate_redirect
from fence.errors import InternalError, Unauthorized
from fence.models import IdentityProvider
from fence.config import config
class ShibbolethLogin(Resource):
def get(s... | 2.390625 | 2 |
automatewithpython/.practiceprojects/fantasygamedictionary.py | Coalemus/Python-Projects | 0 | 12777104 | #!/bin/zsh
'''
Fantasy Game Inventory
You are creating a fantasy video game. The data structure to model the player’s inventory will be a dictionary where the keys are string values describing the item in the inventory and the value is an integer value detailing how many of that item the player has. For example, the ... | 4.3125 | 4 |
tests/test_fft.py | mfkiwl/amalthea-ecp5-usb-sdr | 21 | 12777105 | from amalthea.gateware.fft import *
class TestFFT(unittest.TestCase):
def test_fft(self):
clk = 60e6
m = FFT(32, Q(1,10))
input = [1+0j]*16 + [-1+0j]*16
# Map input to Complex fixed-point
data = list(map(lambda x: ComplexConst(m.internal_shape, x).value(), input))
... | 2.1875 | 2 |
test/lazy/test_root_lazy_variable.py | orionr/gpytorch | 0 | 12777106 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
import unittest
from torch.autograd import Variable
from gpytorch.lazy import RootLazyVariable
from gpytorch.utils import approx_equal
class TestRootLazyVa... | 2.3125 | 2 |
experiments/references/naf_many_envs.py | Asap7772/rail-rl-franka-eval | 0 | 12777107 | """
Run PyTorch NAF on many envs.
"""
import random
import railrl.torch.pytorch_util as ptu
from railrl.exploration_strategies.ou_strategy import OUStrategy
from railrl.launchers.launcher_util import run_experiment
from railrl.torch.naf import NafPolicy, NAF
from rllab.envs.mujoco.ant_env import AntEnv
from rllab.envs... | 2.296875 | 2 |
tests/blueprints/test_points.py | drkane/find-that-postcode | 4 | 12777108 | from tests.fixtures import client
def test_point_json(client):
rv = client.get("/points/51.501,-0.2936")
point_json = rv.get_json()
assert rv.headers["Access-Control-Allow-Origin"] == "*"
assert (
point_json.get("data", {})
.get("relationships", {})
.get("nearest_postcode", {}... | 2.1875 | 2 |
roles/trouter/molecule/default/tests/test_trouter.py | Mieszko96/alfresco-ansible-deployment | 14 | 12777109 | <reponame>Mieszko96/alfresco-ansible-deployment
"""TRouter Tests"""
import os
import pytest
from hamcrest import assert_that, contains_string
# pylint: disable=redefined-outer-name
@pytest.fixture()
def get_ansible_vars(host):
"""Define get_ansible_vars"""
java_role = "file=../../../roles/java/vars/main.yml na... | 2.09375 | 2 |
src/events/pygame_events/click.py | ArcosJuan/Get-out-of-my-fucking-maze | 2 | 12777110 | from src.events import Event
class Click(Event):
def __init__(self, pos, button):
super().__init__()
self.pos = pos
self.button = button
def get_pos(self): return self.pos
def get_button(self): return self.button | 2.96875 | 3 |
tools/odelayplot.py | AitchisonLab/ODELAY-ODELAM-python | 0 | 12777111 |
import os
import pathlib
import re
import time
import sys
import json
import cv2
import h5py
import math
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.path as mpath
import matplotlib.lines as mlines
import matplotlib.patches as mpatches
import matplotlib as mpl
from scipy.s... | 1.695313 | 2 |
backend/api/decapod_api/views/__init__.py | angry-tony/ceph-lcm-decapod | 41 | 12777112 | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 1.53125 | 2 |
tests/core/pyspec/eth2spec/utils/hash_function.py | MicahZoltu/eth2.0-specs | 2,161 | 12777113 | from hashlib import sha256
from remerkleable.byte_arrays import Bytes32
from typing import Union
ZERO_BYTES32 = b'\x00' * 32
def hash(x: Union[bytes, bytearray, memoryview]) -> Bytes32:
return Bytes32(sha256(x).digest())
| 2.484375 | 2 |
ef/1_waves/wave_test.py | urbanij/misc-scripts | 0 | 12777114 | #!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
#
# Created on: Sat Nov 2 14:41:15 CET 2019
#
# Author(s): <NAME> <https://urbanij.github.io>
#
# Description: Unit test for traveling_wave_1.py
#
# ==========================================================
import unittest
from wave import *
from functions imp... | 3.328125 | 3 |
backend/cbt/urls.py | harryface/cbt-django-react | 0 | 12777115 | from django.urls import path, include
urlpatterns = [
path('api/examiner/', include('core.examiner.urls')),
path('api/taker/', include('core.taker.urls')),
]
| 1.53125 | 2 |
sektor/db.py | jesuejunior/sektor | 1 | 12777116 | # encoding: utf-8
import sqlite3
from datetime import datetime
class DB:
def connect():
conn = sqlite3.connect("sektor.db")
return conn
def init():
conn = DB.connect()
cursor = conn.cursor()
try:
cursor.execute(
"""CREATE TABLE IF NOT EXISTS... | 3.4375 | 3 |
antelope-image-classification/antelope_classification.py | avanwyk/fastai-projects | 1 | 12777117 | <reponame>avanwyk/fastai-projects<filename>antelope-image-classification/antelope_classification.py
""" Antelope Classification using FastAI
This script is an end-to-end case study of creating a custom image dataset of
major African antelope and training a deep convolutional neural network to
classify each species.
T... | 2.90625 | 3 |
tests/test_basics.py | vfxetc/zoneconfig | 1 | 12777118 | from . import *
class TestBasics(TestCase):
def test_find(self):
path = root_path('basics')
root = Zone(path=path)
self.assertFalse(root.found)
root.find()
self.assertTrue(root.found)
self.assertEqual(root.path, [path])
self.assertEqual(len(root.loaders),... | 2.546875 | 3 |
scripts/duck_prepare_sys.py | mihaelasmilova/duck | 1 | 12777119 | import argparse
import pickle
try:
from duck.steps.parametrize import prepare_system
from duck.utils.cal_ints import find_interaction
from duck.steps.equlibrate import do_equlibrate
from duck.utils.check_system import check_if_equlibrated
except ModuleNotFoundError:
print('Dependencies missing; che... | 2.4375 | 2 |
testbase/report.py | fossabot/QTAF | 0 | 12777120 | # -*- coding: utf-8 -*-
#
# Tencent is pleased to support the open source community by making QTA available.
# Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may not use this
# file except in compliance with the License. You may... | 1.664063 | 2 |
tasks/affective_task/utils/display_msg_affective_disscussion.py | eduongAZ/tomcat-baseline-tasks | 1 | 12777121 | import pygame
from config import UPDATE_RATE
from common import render_text_center
def display_msg_affective_disscussion(screen, msg: str, milliseconds: int):
start_ticks = pygame.time.get_ticks()
clock = pygame.time.Clock()
while pygame.time.get_ticks() - start_ticks < milliseconds:
render_text_c... | 2.84375 | 3 |
challenges/challenge_14.py | ysaunier/ring-zer0 | 0 | 12777122 | <reponame>ysaunier/ring-zer0
import hashlib
from core.client import RingClient
def decode_binary_string(text) -> str:
return ''.join(chr(int(text[i * 8:i * 8 + 8], 2)) for i in range(len(text) // 8))
def execute():
client = RingClient()
client.login()
page = client.get_challenge(challenge=14)
... | 2.65625 | 3 |
soldash/views.py | ap0ught/soldash | 2 | 12777123 | <reponame>ap0ught/soldash
# -*- coding: utf-8 -*-
#Copyright 2011 <NAME> <<EMAIL>>
#
#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 re... | 1.992188 | 2 |
Face detcetion and dataset generation/ex12.py | jyothiprakashpanaik/ML-4-e | 1 | 12777124 | # Face recognization
import cv2
import os
alg = "haarcascade_frontalface_default.xml"
haar = cv2.CascadeClassifier(alg)
cam = cv2.VideoCapture(0)
path = "dataset"
if not os.path.isdir(path):
os.mkdir(path)
(width,height) = (100,100)
count = 0
while count<100:
count+=1
print(count)
_,img = cam.read()
grayImg =... | 2.875 | 3 |
tlgbotcore/csvdbutils/csvdb/tests/test_csvdb.py | kaefik/py-tlgbotcore | 0 | 12777125 | """
провести в порядок тесты
"""
import unittest
import os
import shutil
import csv
from csvdb import CSVDB
class TestCSVDB(unittest.TestCase):
"""
тесты для проверки работы объекта CSVDB
"""
def remove_dbdir(self):
"""
удаление БД папки даже она существует
"""
... | 3 | 3 |
uiuc_transportation_demand/tests/test_functions.py | yardasol/pride | 2 | 12777126 | from functions import units
from functions import gge_dictionary
from functions import unit_cost_dictionary
from functions import gge_cost_dictionary
from functions import fuel_equivalent
from functions import fuel_equivalent_cost
from functions import co2_equivalent
from functions import co2_emissions
import pytest
#... | 2.6875 | 3 |
tfjs_graph_converter/quirks.py | httpsgithu/tfjs-to-tf | 114 | 12777127 | # SPDX-License-Identifier: MIT
# Copyright © 2020 <NAME>
"""Functions to fix various known issues with exported TFJS models"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import base64
from typing import... | 2.21875 | 2 |
problem_solving/3sum.py | umitkaanusta/stuff-im-learning | 1 | 12777128 | class Solution:
# not my soln but its very cool
def threeSum(self, nums: List[int]) -> List[List[int]]:
triplets = set()
neg, pos, zeros = [], [], 0
for num in nums:
if num > 0:
pos.append(num)
elif num < 0:
neg.append(num)
... | 3.34375 | 3 |
targets/PythonSdk/source/PlayFab/PlayFabSettings.py | iomac/SDKGenerator | 0 | 12777129 | <filename>targets/PythonSdk/source/PlayFab/PlayFabSettings.py
import playfab.PlayFabErrors as PlayFabErrors
import sys
import traceback
ProductionEnvironmentURL = "https://{titleId}.playfabapi.com{methodUrl}"
TitleId = "" # You must set this value for PlayFabSdk to work properly (Found in the Game
# Manag... | 1.929688 | 2 |
recalibration/recalibration.py | LaRoccaRaphael/MSI_recalibration | 10 | 12777130 | <filename>recalibration/recalibration.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import numpy as np
from pyimzml.ImzMLParser import ImzMLParser
from pyimzml.ImzMLWriter import ImzMLWriter
from sklearn import linear_model
from scipy.stats import gaussian_kde
def peak_selection(ms_intensities):
... | 2.46875 | 2 |
tests/test_add_contact.py | kegorn/python_training | 0 | 12777131 | <filename>tests/test_add_contact.py<gh_stars>0
from model.contact import Contact
def test_add_contact(app):
app.contactHelper.create(Contact(firstname="new_fn_1", lastname="new_ln_1", address2="some_address_2")) | 2.078125 | 2 |
src/scripts/train.py | xiedidan/sparse-coding | 18 | 12777132 | import os
import sys
sys.path.insert(0, os.path.abspath('../../.'))
from tqdm import tqdm
import torch
from src.model.SparseNet import SparseNet
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from src.model.ImageDataset import NatPatchDataset
from src.utils.cmd_line import par... | 2.3125 | 2 |
tests/test_model_views.py | Algebra8/LAViewSet | 0 | 12777133 | <reponame>Algebra8/LAViewSet
import json
import pytest
from laviewset import ModelViewSet
from .models import User, UserSchema
_serializer_class = UserSchema
@pytest.fixture
def model_viewset_core(db_router):
class SomeViewSet(ModelViewSet):
route = db_router.extend('users')
model = User
... | 2.25 | 2 |
slixmpp/plugins/xep_0333/__init__.py | marconfus/slixmpp | 0 | 12777134 | """
slixmpp: The Slick XMPP Library
Copyright (C) 2016 <NAME>
This file is part of slixmpp.
See the file LICENSE for copying permission.
"""
from slixmpp.plugins.base import register_plugin
from slixmpp.plugins.xep_0333.stanza import Markable, Received, Displayed, Acknowledged
from slixmpp.plugins.xe... | 1.078125 | 1 |
watch/forms.py | moharick/KaaRadaMtaani | 0 | 12777135 | <filename>watch/forms.py
from django import forms
from django.forms import ModelForm
from django.core import validators
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from .models import *
class MtaaForm(ModelForm):
class Meta:
model = Mtaa
fields... | 2.15625 | 2 |
homeassistant/components/poolsense/__init__.py | jsltrifork/core | 0 | 12777136 | """The PoolSense integration."""
import asyncio
from datetime import timedelta
import logging
import async_timeout
from poolsense import PoolSense
from poolsense.exceptions import PoolSenseError
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from homeass... | 2.015625 | 2 |
day01/Quartiles.py | silvioedu/RackerRank-10-days-of-statistic | 0 | 12777137 | <filename>day01/Quartiles.py
if __name__ == '__main__':
n = int(input())
x = sorted(list(map(int, input().split())))
from statistics import median
print(int(median(x[:n//2])))
print(int(median(x)))
print(int(median(x[(n+1)//2:])))
| 3.296875 | 3 |
app/__init__.py | Haustorium/Flask-Microblog | 0 | 12777138 | <reponame>Haustorium/Flask-Microblog
import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.openid import OpenID
from flask.ext.login import LoginManager
from config import basedir
app = Flask(__name__)
app.config.from_object('config')
db = SQLAlchemy(app)
lm = LoginManager()
lm... | 2.203125 | 2 |
src/tensorneko/util/dispatcher.py | ControlNet/tensorneko | 9 | 12777139 | <reponame>ControlNet/tensorneko
from __future__ import annotations
import warnings
from functools import partial
from typing import Callable, Dict, List, Generic, Sequence, Any
import inspect
from .type import T
class DispatcherTypeWarning(Warning):
pass
class Dispatcher:
dispatchers: Dict[str, Dispatche... | 2.28125 | 2 |
test/test_use_cases.py | bitmuster/pytest_system_test_plugin | 2 | 12777140 | import logging
import os
import time
import pytest
CURL = "/usr/bin/curl -X POST http://localhost:{} -d hello_my_plugins"
WAITSTATUS = 0.1
def get_factory_args(port):
# TODO: Find better way of getting an interpreter in the current env
interpreter = os.path.abspath("./env-plugin/bin/python")
args = [
... | 2.328125 | 2 |
scipy/optimize/tests/test__linprog_clean_inputs.py | smola/scipy | 1 | 12777141 | <reponame>smola/scipy
"""
Unit test for Linear Programming via Simplex Algorithm.
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_, assert_allclose
from pytest import raises as assert_raises
from scipy.optimize._linprog_util import _clean_inputs,... | 2.5 | 2 |
test/test_extractor.py | fabiofumarola/dragnet | 0 | 12777142 | import io
import os
import unittest
import numpy as np
from sklearn.linear_model import LogisticRegression
from dragnet import Extractor
from dragnet.blocks import TagCountNoCSSReadabilityBlockifier
from dragnet.util import get_and_union_features
from dragnet.compat import str_cast
with io.open(os.path.join('test',... | 2.28125 | 2 |
process.py | PeterBee97/authors-tool | 0 | 12777143 | <reponame>PeterBee97/authors-tool
#!/usr/bin/python3
import spacy,sys
en = spacy.load("en_core_web_sm")
#en.max_length=2000000
sents = en(open(sys.argv[1]).read())
people = [ee for ee in sents.ents if ee.label_ == 'PERSON']
for p in people:
print(p)
| 2.6875 | 3 |
transposonmapper/mapping/samflag.py | EKingma/Transposonmapper | 2 | 12777144 | <filename>transposonmapper/mapping/samflag.py
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 4 09:38:16 2021
@author: gregoryvanbeek
"""
#%%INPUT
flag = 1040
verbose=True
#%%
def samflags(flag=0, verbose=True):
"""This script converts a decimal flag to binary and get the corresponding properties according to t... | 2.796875 | 3 |
rdr_service/alembic/versions/6f9266e7a5fb_initial_metrics.py | all-of-us/raw-data-repository | 39 | 12777145 | """Initial metrics
Revision ID: 6f9266e7a5fb
Revises: 51415576d3e9
Create Date: 2017-12-12 10:38:27.166562
"""
import model.utils
import sqlalchemy as sa
from alembic import op
from rdr_service.participant_enums import MetricSetType, MetricsKey
# revision identifiers, used by Alembic.
revision = "6f9266e7a5fb"
down... | 1.59375 | 2 |
jarviscli/tests/plugins/composed/plugin0.py | qwireq/Jarvis | 1 | 12777146 | <reponame>qwireq/Jarvis<gh_stars>1-10
from plugin import Plugin
class Plugin0_Sub0(Plugin):
"""Doc"""
def require(self):
pass
def complete(self):
pass
def alias(self):
pass
def run(self, jarvis, s):
jarvis.say("++sub0++ " + s)
class Plugin3(Plugin):
"""Docu... | 2.40625 | 2 |
Important/FlattenListofLists.py | jason71319jason/Interview-solved | 2 | 12777147 | '''
Write a function to flatten a list of lists
input:
[1,[2,3,4],[5,[6,7]]]
output:
[1,2,3,4,5,6,7]
'''
#recursive function
def flattenList(lst, f_lst=None):
if f_lst is None:
f_lst=[]
for l in lst:
if isinstance(l,list):
flattenList(l, f_lst)
else:
f_lst.... | 4.21875 | 4 |
Aula12/exercicio_45.py | brenuvida/cursoemvideo | 0 | 12777148 | <filename>Aula12/exercicio_45.py
from random import randint
print ('\n\n\nVamos jogar JOKENPÔ!!!\n\n\n')
escolha = int(input('Escolha PEDRA, PAPEL ou TESOURA:\n\n[1] PEDRA\n\n[2] PAPEL\n\n[3] TESOURA\n\nFaça a sua escolha: '))
if escolha != 1 and escolha != 2 and escolha != 3:
print('\n\nVocê escolheu: {}\nApen... | 3.9375 | 4 |
pyle.py | aljungberg/pyle | 13 | 12777149 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Pyle makes it easy to use Python as a replacement for command line tools such as `sed` or `perl`.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future impor... | 2.890625 | 3 |
scrap.py | yolossn/stock_split_meeting_alert | 1 | 12777150 | <filename>scrap.py
import requests
from lxml import etree
from datetime import datetime,date
import sys
class stockAlert():
def __init__(self,url):
self.url=url
self.html=""
self.doc=""
self.contents=""
self.event=[]
self.eventQtly=[]
self.weekNotify=[]
... | 2.9375 | 3 |