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 |
|---|---|---|---|---|---|---|
my-rl/qlearning_agent.py | siowyisheng/rl-learning | 0 | 12780451 | <gh_stars>0
# my implementation of a q-learning agent
import random
import numpy as np
class QLearningAgent:
"""An agent which uses Q learning to optimize actions in an environment."""
def __init__(self, alpha, gamma):
self._Q = {}
self.alpha = alpha
self.gamma = gamma
def decid... | 3.25 | 3 |
scorebot/triggers/team_triggers.py | cloudlinux/scorebot | 3 | 12780452 | from scorebot.db import db_api, db_utils
from scorebot.triggers.triggers_base import TeamTrigger, GroupOfTeamTriggers
team_triggers = {
db_api.PatchsetProposed.type: GroupOfTeamTriggers(
score_db_api=db_api.PatchsetProposed,
triggers=[
# week
TeamTrigger(
nam... | 2.078125 | 2 |
scripts/conv_exp_hospital_section.py | wecacuee/modern-occupancy-grid | 21 | 12780453 | import convergence_experiment
def executables():
return convergence_experiment.executables("Data/hospital_section_player/",
2000)
| 1.296875 | 1 |
PLM/configs/profileConfigs.py | vtta2008/pipelineTool | 7 | 12780454 | # -*- coding: utf-8 -*-
"""
Script Name:
Author: <NAME>/Jimmy - 3D artist.
Description:
"""
# -------------------------------------------------------------------------------------------------------------
""" Import """
VFX_PROJ_PROFILER = dict(
APPS = ["maya", "zbrush", "mari", "nuke",... | 1.429688 | 1 |
sail_on_client/harness/__init__.py | darpa-sail-on/sail-on-client | 1 | 12780455 | <gh_stars>1-10
"""Sail On client harness package."""
| 0.898438 | 1 |
learning-phases/src/neuralnetwork/network.py | vonhachtaugust/learning-phases | 0 | 12780456 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from keras.models import Sequential, Model
from keras.models import model_from_yaml
import keras.backend as K
from keras.callbacks import Callback
from ..utility.utils import path
def custom_uniform(shape, range=(-1, 1), name=None):
"""
Examp... | 3.09375 | 3 |
pyabsa/network/lcf_pooler.py | yangheng95/LCF-ABSA | 31 | 12780457 | <filename>pyabsa/network/lcf_pooler.py
# -*- coding: utf-8 -*-
# file: lcf_pooler.py
# time: 2021/6/29
# author: yangheng <<EMAIL>>
# github: https://github.com/yangheng95
# Copyright (C) 2021. All Rights Reserved.
import numpy
import torch
import torch.nn as nn
class LCF_Pooler(nn.Module):
def __init... | 2.4375 | 2 |
tests/letter_tests2.py | subramani95/open-tamil | 0 | 12780458 | # -*- coding: utf-8 -*-
# (C) 2017 <NAME>
#
# This file is part of 'open-tamil' package tests
#
# setup the paths
from opentamiltests import *
import tamil.utf8 as utf8
from tamil.tscii import TSCII
import codecs
if PYTHON3:
class long(int):
pass
class Letters(unittest.TestCase):
def test_uyir_mei_sp... | 2.859375 | 3 |
examples/EnumEditor_demo.py | rwl/traitsbackendpyjamas | 1 | 12780459 | # Copyright (c) 2007, Enthought, Inc.
# License: BSD Style.
"""
Implementation of an EnumEditor demo for Traits UI
This demo shows each of the four styles of the EnumEditor
Fixme: This only shows the capabilities of the old-style EnumEditor
"""
# Imports:
from enthought.traits.api \
import HasTra... | 2.046875 | 2 |
solutions/solution970.py | Satily/leetcode_python_solution | 3 | 12780460 | class Solution:
def powerfulIntegers(self, x, y, bound):
"""
:type x: int
:type y: int
:type bound: int
:rtype: List[int]
"""
def powers(n, bound):
if n == 1:
return [1]
power_list = []
s = 1
whil... | 3.765625 | 4 |
ci.py | mhalano/mad_scientists_lab | 0 | 12780461 | <gh_stars>0
#! /usr/bin/env python3
import os
import sys
import yaml
import git
import subprocess
tempdir = "/tmp"
targetdir = "ci"
config_file="pipeline.yml"
pipeline_name=sys.argv[1]
repo_address=sys.argv[2]
#def check_arguments() :
#Checa se os dois argumentos da linha de comando existem e sao validos
#erro ... | 2.734375 | 3 |
cypherpunkpay/web/views_admin/admin_charge_views.py | RandyMcMillan/CypherpunkPay | 44 | 12780462 | <reponame>RandyMcMillan/CypherpunkPay<gh_stars>10-100
from pyramid.view import (view_config)
from cypherpunkpay import App
from cypherpunkpay.usecases.report_charges_uc import ReportChargesUC
from cypherpunkpay.web.views_admin.admin_base_view import AdminBaseView
class AdminChargeViews(AdminBaseView):
@view_con... | 1.96875 | 2 |
src/sweetrpg_COMPONENT_web/application/auth/__init__.py | sweetrpg/web-template | 0 | 12780463 | # -*- coding: utf-8 -*-
__author__ = "<NAME> <<EMAIL>>"
"""
"""
from flask_oauthlib.provider import OAuth2Provider
# from authlib.integrations.flask_client import OAuth
from flask import current_app
import logging
from sweetrpg_COMPONENT_web.application import constants
import os
| 1.351563 | 1 |
main.py | GryPr/Vireo | 0 | 12780464 | <filename>main.py
from utilities import startup
def main() -> None:
startup.run_sanity_checks()
bot = startup.create_bot()
startup.load_extensions(bot, 'cogs')
startup.run_bot(bot)
if __name__ == "__main__":
main()
| 1.625 | 2 |
dictionaries.py | tiagopariz/FaztCursoPythonParaPrincipiantes | 0 | 12780465 | <filename>dictionaries.py
# list
cart = [
["book1", 3, 4.99],
["book2", 3, 6.99],
["book3", 3, 15.99]
]
# Dictionary
product = {
"name": "Book1",
"quantity": 3,
"price": 3
}
print(type(product)) # <class 'dict'>
person = {
"first_name": "ryan",
"last_name": "ray"
}
print(type(person)... | 3.453125 | 3 |
src/regression/linear_regression.py | eric-ycw/solomon | 0 | 12780466 | import numpy as np
import sys
sys.path.insert(0, '..')
from src.utils import *
class LinearRegression:
def __init__(self):
self.params = None
def train(self, X, y, iterations=5000, learning_rate=0.01, display=False):
'''
Input parameters:
X: (mxn) array where m is the number ... | 3.46875 | 3 |
Python/exo v2/exo 3 v2.py | Cantin-L/Professionelle | 1 | 12780467 | <filename>Python/exo v2/exo 3 v2.py
'''
Auteur : <NAME>.
Site web : https://itliocorp.fr
Version : 0.2
License : MIT 3.0
Sujet :
Notions : Afficher une variable, Importation de valeur, Un petit peu de math, Commentaires
Fonction à utiliser :
input(...)
print(...)
'''
| 1.523438 | 2 |
CDKProjectVer2/AppStacks/ApplicationLoadBalancer/stacks/alb_conf.py | binhlh23/cdkbynooddev | 0 | 12780468 | <filename>CDKProjectVer2/AppStacks/ApplicationLoadBalancer/stacks/alb_conf.py
STACK = 'ALBHDBank'
AZ_1 = 'ap-southeast-1a'
AZ_2 = 'ap-southeast-1b'
AZ_3 = 'ap-southeast-1c'
VPC_ID = 'vpc-0d5fa16a59668d675'
ALBSUBNET = 'subnet-0a436875d4d79e4f5'
| 1.03125 | 1 |
native/all_load_tracking/plotter.py | EfficientAI/efficient_cv | 0 | 12780469 | <reponame>EfficientAI/efficient_cv
from matplotlib import pyplot as plt
def main():
timestamps = []
avgs = []
exps = []
loads = []
with open('output.txt', 'rb') as f:
lines = f.readlines()
for line in lines:
timestamp, avg, exp, load = line.split()
timestamp... | 2.5 | 2 |
scripts/2014/campdataparser.py | iBurnApp/iBurn-Data | 7 | 12780470 | '''
Converts Official Camp data provided in XML by Burning Man Org
to JSON of the PlayaEvents API format.
Input:
Burning Man Org Camp Placement XML
PlayaEvents Camp without location JSON
e.g: http://playaevents.burningman.com/api/0.2/2014/camp/
Output:
iBurn Camp Json (./camps.json)
'''
import xml.etre... | 3.015625 | 3 |
notochord/test/__main__.py | jroose/notochord | 0 | 12780471 | <reponame>jroose/notochord
import unittest
from . import *
def main():
unittest.main(exit=False)
if __name__ == "__main__":
main()
| 1.21875 | 1 |
tests/sources/tracking/rasterisation.py | bcbnz/matplotlib-pgfutils | 1 | 12780472 | <gh_stars>1-10
from pgfutils import save, setup_figure
setup_figure(width=1, height=1)
from matplotlib import pyplot as plt
import numpy as np
d = np.random.randn(128, 128)
plt.imshow(d)
save()
| 2 | 2 |
drawingclasses/luaplot/luabar_n_line.py | Daguhh/ConkyLuaMakerGUIv2 | 19 | 12780473 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Class that implement draw of rectangles (for bar and line)
It use pygame.draw
methods :
- draw
- update
- resize
"""
import pygame
from .math_tools import PositionMathTool as pmt
from .math_tools import PositionValueObject as pval
class BarNLine:
d... | 3.546875 | 4 |
bandits/__init__.py | XiaoMutt/ucbc | 0 | 12780474 | from .basis import Bandit
from .bernoulli import BernoulliBandit
from .normal import NormalBandit
from .bimodal import BimodalBandit
from .uniform import UniformBandit
| 1.148438 | 1 |
django_cradmin/renderable.py | appressoas/django_cradmin | 11 | 12780475 | import warnings
from django.template.loader import render_to_string
from django_cradmin import crsettings
def join_css_classes_list(css_classes_list):
"""
Join the provided list of css classes into a string.
"""
return ' '.join(css_classes_list)
class AbstractRenderable(object):
"""
An ab... | 2.484375 | 2 |
doc/urls.py | sfreedgood/redline_django_with_NLP | 0 | 12780476 | <reponame>sfreedgood/redline_django_with_NLP
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name = 'index'),
path('upload', views.upload_doc, name='upload'),
path('nlptest', views.nlptest, name='nlptest')
] | 1.640625 | 2 |
tests/unit/configuration/test_lint.py | dafrenchyman/kontrolilo | 5 | 12780477 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from pathlib import Path
from tempfile import TemporaryDirectory, NamedTemporaryFile
from unittest.mock import Mock
from kontrolilo.configuration import Configuration, ConfigurationInclude
from kontrolilo.configuration.configuration import CONFIG_FILE_NAME
from kontrolilo.configu... | 2.359375 | 2 |
quote.py | babu1998/Widhya-auth | 0 | 12780478 | <gh_stars>0
import os
import random
import time
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
def recommend_font_size(text):
size = 45
l = len(text)
resize_heuristic = 0.9
resize_actual = 0.985
while l > 1:
l = l * resize_heuristic
size = size * resize_a... | 2.8125 | 3 |
tests/learning/test_semi_supervised_learning.py | dumpmemory/nlpatl | 18 | 12780479 | <gh_stars>10-100
from typing import List, Union
from datasets import load_dataset
import unittest
import numpy as np
from nlpatl.models.embeddings import Transformers
from nlpatl.models.classification import (
Classification,
SkLearnClassification,
XGBoostClassification,
)
from nlpatl.learning i... | 2.640625 | 3 |
reverse_a_string.py | yehnan/python_note | 0 | 12780480 |
s = 'Hello Python'
# s.reverse()
print(s[::-1])
print(''.join(reversed(s)))
def reverse_i(s):
r = ''
for c in s:
r = c + r
return r
print(reverse_i(s))
def reverse_r(s):
if len(s) <= 1:
return s
else:
return reverse_r(s[1:]) + s[0]
pri... | 3.84375 | 4 |
piptui/custom/customForm.py | MrNaif2018/PipTUI | 0 | 12780481 | from npyscreen import FormBaseNew
import curses
class FormBaseNewHinted(FormBaseNew):
def display_menu_advert_at(self):
return self.lines - 1, 1
def draw_form(self):
super(FormBaseNewHinted, self).draw_form()
menu_advert = '^A: Install\t\t^R: Uninstall\t\t^U: Update'
if isins... | 2.53125 | 3 |
utils/tool.py | Gagarinwjj/Coeus | 139 | 12780482 | <filename>utils/tool.py
# coding: utf-8
__author__ = 'deff'
import re
class Tools:
@staticmethod
def xml_assent(word):
symbola = re.compile('>')
word = symbola.sub('<', word)
symbolb = re.compile('<')
word = symbolb.sub('>', word)
symbolc = re.compile('&')
... | 2.59375 | 3 |
a.sikorska/PD3/Alicja_Sikorska_pd3.py | alsikorska/python_wprowadzenie_warsztaty_2021 | 0 | 12780483 | # Zadanie 1
def Ciag_fib(n):
a = 1
b = 1
print(a)
print(b)
for i in range(1, n-1):
a, b = b, a + b
print(b)
return
Ciag_fib(50)
# Zadanie 3
def Unique_elements(*lista):
lista_unique=[]
for n in range(0, len(lista)) :
if lista[n] not in lista_unique :
... | 3.5 | 4 |
mediawiki_auth/middleware.py | damoti/django-mediawiki-auth | 1 | 12780484 | <gh_stars>1-10
from django.conf import settings
from django.utils.deprecation import MiddlewareMixin
from django.utils.functional import SimpleLazyObject
from mediawiki_auth import mediawiki
def get_user(request):
if not hasattr(request, '_cached_user'):
request._cached_user = mediawiki.get_or_create_djan... | 2.21875 | 2 |
tests/GitLab/test_gitlab_hoster.py | GitMateIO/IGitt | 6 | 12780485 | import os
from IGitt.GitLab import GitLabOAuthToken
from IGitt.GitLab.GitLab import GitLab
from IGitt.GitLab.GitLabComment import GitLabComment
from IGitt.GitLab.GitLabCommit import GitLabCommit
from IGitt.GitLab.GitLabIssue import GitLabIssue
from IGitt.GitLab.GitLabMergeRequest import GitLabMergeRequest
from IGitt.I... | 1.929688 | 2 |
pyexlatex/graphics/tikz/library.py | whoopnip/py-ex-latex | 4 | 12780486 | <reponame>whoopnip/py-ex-latex
from pyexlatex.models.item import SimpleItem
class TikZLibrary(SimpleItem):
name = 'usetikzlibrary'
def __init__(self, contents):
super().__init__(self.name, contents) | 1.84375 | 2 |
_unittests/ut_pycode/test_references.py | Pandinosaurus/pyquickhelper | 18 | 12780487 | """
@brief test tree node (time=5s)
"""
import sys
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import add_missing_development_version
class TestReferences(unittest.TestCase):
def test_references(self):
fLOG(
__file__,
self._... | 2.421875 | 2 |
develocorder/logger.py | wahtak/develocorder | 10 | 12780488 | from collections import deque
import numpy as np
class Logger:
"""Print recorded values."""
def __init__(self, name):
"""
:param name str: identifier for printed value
"""
self.name = name
def __call__(self, value):
print("{}: {}".format(self.name, value))
cla... | 3.140625 | 3 |
third_party/paprika.py | constructorfleet/rasa-actions-eddie | 0 | 12780489 | # import logging
# import sys
# import traceback
# from random import randint
# from typing import Dict, Text, Any, List
#
# from pyprika import Pyprika
# from rasa_sdk import Tracker
# from rasa_sdk.events import SlotSet
# from rasa_sdk.executor import CollectingDispatcher
#
# from . import (
# RECIPE_CATEGORIES_S... | 1.960938 | 2 |
alloy_related/alloyToRailML/parserAlloy/parser.py | pedrordgs/RailML-Utilities | 21 | 12780490 | <gh_stars>10-100
import xml.etree.ElementTree as ET
from parserAlloy.netElement import NetElement
from parserAlloy.netRelation import NetRelation
from parserAlloy.network import Network
from parserAlloy.level import Level
from parserAlloy.railway import Railway
def strToPos(pos):
if pos == 'Zero':
return ... | 2.46875 | 2 |
shim/helper/settings.py | jonathan-innis/azure-extension-foundation | 0 | 12780491 | from ctypes import *
from helper.types import GoString
import json
class Settings:
def __init__(self, lib):
self.lib = lib
self.lib.GetSettings.argtypes = []
self.lib.GetSettings.restype = c_char_p
def get_settings(self):
ret = self.lib.GetSettings()
return json.loa... | 2.375 | 2 |
app/management/commands/crawl.py | erikreed/cpotrace | 0 | 12780492 | <reponame>erikreed/cpotrace<filename>app/management/commands/crawl.py<gh_stars>0
import time
from django.core.management.base import BaseCommand
from app.models import Car
from app.crawler import COUNTRY_CODES, TeslaCrawler, CrawlerException, TeslaSlackClient
class Command(BaseCommand):
help = 'Crawls and updates... | 2.171875 | 2 |
load_vctk.py | buzem/inzpeech | 2 | 12780493 | <filename>load_vctk.py
#!/usr/bin/env python
# coding: utf-8
import os
import numpy as np
from sklearn.model_selection import train_test_split
def get_person_label(pname):
return int(pname.replace('p', ''))
def get_samples_from_person(person_path, sample_count, mics):
"""
Return path of audio samples sel... | 2.890625 | 3 |
SampleCode/5_DivideAndConquer.py | k3a-uw/tcss503 | 0 | 12780494 | import numpy as np
import time
import pandas as pd
import matplotlib.pyplot as plt
import random
def karatsuba(x, y):
""" Recursive implementation of Karatsuba's Fast Mulciplication Algoritihm
:param x: The first integer
:param y: The second integer
:return: The product of x * y
"""
if x < 10... | 3.609375 | 4 |
src/utils.py | p0werHu/articulated-objects-motion-prediction | 14 | 12780495 | <filename>src/utils.py
# implemented by JunfengHu
# create time: 7/20/2019
import sys
import time
import numpy as np
import copy
import torch
import os
def create_directory(config):
"""
crate Checkpoint directory path
modified from https://github.com/BII-wushuang/Lie-Group-Motion-Prediction
:param co... | 2.171875 | 2 |
qhard/__init__.py | qhard/qhard | 0 | 12780496 | <filename>qhard/__init__.py
# This file is part of QHard: quantum hardware modelling.
#
# Author: <NAME>, 2017 and later.
############################################################################
# Qubits and resonator.
from qhard.fluxonium import *
from qhard.transmon import *
from qhard.cavity import *
# Interac... | 1.476563 | 1 |
Acquisition/ubiment_parameters.py | LCAV/Lauzhack2020 | 0 | 12780497 | <gh_stars>0
# Socket port and baudrate are also used as systemID
BEACON_PORT = 7582
SENSORS_PORT = 7586
system_list = {
'Beacon':{
'id': BEACON_PORT,
'port': BEACON_PORT,
'tags': [444, 14954135790684542069]
},
'Sensors':{
'id': SENSORS_PORT,
'port': SENSORS_PORT,
... | 2.640625 | 3 |
operators/object_detector.py | JustusSchwan/MasterThesis | 0 | 12780498 | import dlib
import cv2
from os import path
from dataflow import ports
class ObjectDetectorOpencv:
def __init__(self, model):
self.detector = cv2.CascadeClassifier(model)
self.source_detection = ports.EventSource()
def detect_object(self, img):
detect = self.detector.detectMultiScale(i... | 2.4375 | 2 |
pymtl3/passes/tracing/test/VcdGenerationPass_test.py | mondO/pymtl3 | 0 | 12780499 | #=========================================================================
# VcdGenerationPass_test.py
#=========================================================================
# Perform limited tests on the VCD generation pass. These tests are limited
# in the sense that they do not compare the entire output against ... | 2.09375 | 2 |
src/settings/admin.py | oussamabouchikhi/Bigdeals | 2 | 12780500 | <reponame>oussamabouchikhi/Bigdeals<gh_stars>1-10
from django.contrib import admin
# Register your models here.
from .models import Brand, Variant
admin.site.register(Brand)
admin.site.register(Variant)
| 1.234375 | 1 |
ncitools/_vdimain.py | Kirill888/nci-tools | 6 | 12780501 | import click
import sys
from collections import namedtuple
from random import randint
Ctx = namedtuple('Ctx', ['ctl', 'ssh', 'ssh_cfg'])
@click.group()
@click.pass_context
@click.option('--host', default='vdi.nci.org.au', help='Customize vdi login node')
@click.option('--user', help='SSH user name, if not given will... | 2.3125 | 2 |
authors/apps/articles/views.py | andela/ah-the-answer-backend | 0 | 12780502 | <filename>authors/apps/articles/views.py
from collections import OrderedDict
import os
from rest_framework.response import Response
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.permissions import IsAuthenticated
from rest_framework.exceptions import APIException
from re... | 1.96875 | 2 |
tidb/tests/test_tidb.py | davidlrosenblum/integrations-extras | 1 | 12780503 | import pytest
# test transforming tidb check config to openmetrics check config
from datadog_checks.base.utils.tagging import GENERIC_TAGS
from datadog_checks.tidb import TiDBCheck
from .conftest import EXPECTED_PD, EXPECTED_TIDB, EXPECTED_TIKV
@pytest.mark.unit
def test_create_check_instance_transform(tidb_instanc... | 1.992188 | 2 |
tests/integration/pagure/test_service.py | mmuzila/ogr | 0 | 12780504 | import pytest
from requre.online_replacing import record_requests_for_all_methods
from tests.integration.pagure.base import PagureTests
from ogr.exceptions import OgrException
@record_requests_for_all_methods()
class Service(PagureTests):
def test_project_create(self):
"""
Remove https://pagure.i... | 2.421875 | 2 |
huaweicloud-sdk-classroom/huaweicloudsdkclassroom/v3/model/judgement_result.py | huaweicloud/huaweicloud-sdk-python-v3 | 64 | 12780505 | # coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class JudgementResult:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is... | 2.421875 | 2 |
fish_diff.py | seigo-pon/ai_tutorial | 0 | 12780506 | <reponame>seigo-pon/ai_tutorial
import cv2
import os
import shutil
img_last = None
idx = 0
save_dir = './fish'
if os.path.exists(save_dir):
shutil.rmtree(save_dir)
os.makedirs(save_dir)
cap = cv2.VideoCapture('./fish.mp4')
while True:
success, frame = cap.read()
if not success:
break
frame = cv2.resize(... | 2.515625 | 3 |
compyler/node.py | dgisolfi/Compyler | 0 | 12780507 | <filename>compyler/node.py
#!/usr/bin/python3
# 2019-2-12
# <NAME>
class Node:
def __init__(self, name, parent, nid, kind, line, pos):
self.__name = name
self.__children = []
self.__parent = parent
# id for treelib to use
self.__nid = nid
# to hold kind of node (lea... | 2.859375 | 3 |
ex6.py | ayesumon123/python-exercises | 0 | 12780508 | <filename>ex6.py
types_of_people = 10
x = f"There are {types_of_people} types of people."
binary = "binary"
do_not = "don't"
y = f"Those who know {binary} and those who {do_not}."
print(x)
print(y)
print(f"I said: {x}")
print(f"I also said: '{y}'")
hilarious = False
| 3.203125 | 3 |
examples/__init__.py | mirakels/pandevice | 34 | 12780509 | <reponame>mirakels/pandevice
__author__ = 'btorres-gil'
| 1.09375 | 1 |
test/test_pulljson.py | Teradata/PyTd | 133 | 12780510 | <filename>test/test_pulljson.py
# The MIT License (MIT)
#
# Copyright (c) 2015 by Teradata
#
# 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 ... | 1.929688 | 2 |
tests/test_user.py | samsonosiomwan/SQL-model | 0 | 12780511 | <reponame>samsonosiomwan/SQL-model<filename>tests/test_user.py
import unittest
import sys
sys.path.append('src/models')
from user import User
from datetime import datetime
class TestUser(unittest.TestCase):
def setUp(self):
self.user = User()
def test_all(self):
self.assertIsInstance(self.user.al... | 2.765625 | 3 |
tests/eth2/core/beacon/state_machines/forks/test_serenity_block_processing.py | dendisuhubdy/trinity | 0 | 12780512 | <gh_stars>0
from eth.constants import ZERO_HASH32
from eth_utils import ValidationError
from eth_utils.toolz import concat, first, mapcat
import pytest
from eth2._utils.bls import bls
from eth2.beacon.helpers import compute_start_slot_at_epoch, get_domain
from eth2.beacon.signature_domain import SignatureDomain
from e... | 1.882813 | 2 |
etc/defaults/pvAccessCPP.py | dls-controls/ADCore | 0 | 12780513 | <reponame>dls-controls/ADCore
# Builder definitions for pvAccessCPP
import iocbuilder
from iocbuilder import Device
class pvAccessCPP(Device):
LibFileList = ['pvAccess', 'pvAccessIOC', 'pvAccessCA']
DbdFileList = ['PVAServerRegister']
AutoInstantiate = True
| 1.601563 | 2 |
src/blockdiag/imagedraw/__init__.py | flying-foozy/blockdiag | 155 | 12780514 | <filename>src/blockdiag/imagedraw/__init__.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2011 <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.... | 2.109375 | 2 |
Lab1/dbManager.py | yzghurovskyi/RelationalDBsLabs | 0 | 12780515 | import math
import os
from random import random
import psycopg2
import psycopg2.extras
from config.config import config
from models.Club import Club
from models.Player import Player
from models.Position import Position
from models.Tournament import Tournament
from faker import Faker
class FootballDatabase(object):
... | 2.921875 | 3 |
sonar/ping.py | allenai/allennlp-gallery | 3 | 12780516 | # -*- coding: utf-8 -*-
import requests
import time
import math
import signal
def is_ok(url: str) -> bool:
"""
Returns True if the provided URL responds with a 2XX when fetched via
a HTTP GET request.
"""
try:
resp = requests.get(url)
except:
return False
return True if mat... | 3.015625 | 3 |
src/automata.py | ezequielbrrt/ModeloSIR-AutomataCelular | 0 | 12780517 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pylab import *
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import subprocess
#Creacion de la Poblacion
datos = open("Datos/Poblacion.txt","w")
datos.close()
datos = open("Datos/Estados.txt","w")
datos.close()
#genera... | 2.921875 | 3 |
retention_dashboard/models.py | uw-it-aca/retention-dashboard | 0 | 12780518 | <filename>retention_dashboard/models.py
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.db import models
from django.db.models import Q, F
class Week(models.Model):
QUARTER_CHOICES = ((1, 'Winter'),
(2, 'Spring'),
(3... | 2.375 | 2 |
dataset.py | Assassinsarms/Deep-Active-Learning-Network-for-Medical-Image-Segmentation | 3 | 12780519 | <gh_stars>1-10
import numpy as np
import torch
import torch.utils.data
from torchvision import datasets, models, transforms
class Dataset(torch.utils.data.Dataset):
def __init__(self, img_paths, mask_paths):
self.img_paths = img_paths
self.mask_paths = mask_paths
def __len__(self):
... | 2.359375 | 2 |
visualizer/backend/utils.py | CMU-Light-Curtains/SafetyEnvelopes | 0 | 12780520 | # This file is compatible with both Python 2 and 3
import base64
import cv2
import json
import numpy as np
from flask import Response
import time
import functools
from collections import deque
class Stream(deque):
"""
A stream stores an output sequence stream of data. It inherits from deque.
Stream conta... | 3.015625 | 3 |
network.py | Ammaruit/pwoc | 10 | 12780521 | <filename>network.py
import tensorflow as tf
import tensorflow_addons as tfa
from modules import FeaturePyramidNetwork, SceneFlowEstimator, ContextNetwork, OcclusionEstimator, CostVolumeLayer
class Network(tf.keras.Model):
def __init__(self, occlusion=True, mean_pixel=None):
super(Network, self).__init_... | 2.515625 | 3 |
platform/polycommon/polycommon/unique_urls.py | erexer/polyaxon | 0 | 12780522 | #!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, 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 ... | 2.296875 | 2 |
functions/data.py | arknano/meeku_bot.py | 2 | 12780523 | import os
import json
local_path = os.path.dirname(__file__)
def load_config_file(path):
file = open(os.path.join(local_path, os.pardir, path))
return json.load(file)
def load_loc():
return load_config_file('config/loc.json')
def load_responses_config():
return load_config_file('config/responses.... | 2.390625 | 2 |
tests/utils.py | unplugstudio/mezzanine-webinars | 1 | 12780524 | from __future__ import unicode_literals, absolute_import
from django.contrib.auth import get_user_model
from django.test import TestCase
from django_functest import FuncWebTestMixin, ShortcutLoginMixin
User = get_user_model()
class WebTestBase(FuncWebTestMixin, ShortcutLoginMixin, TestCase):
@classmethod
d... | 1.96875 | 2 |
sankaku/lib/objects.py | Slimakoi/Sankaku.py | 1 | 12780525 | <gh_stars>1-10
class UserProfile:
def __init__(self, data):
self.json = data
self.artist_update_count = None
self.avatar_rating = None
self.avatar_url = None
self.comment_count = None
self.created_at = None
self.email = None
self.email_verification_sta... | 2.28125 | 2 |
test.py | skoblov-lab/SciLK | 10 | 12780526 | import unittest
from typing import Sequence, Iterable, cast, Mapping
import tempfile
import os
import numpy as np
import joblib
from hypothesis import given, note
from hypothesis import settings, strategies as st
from scilk.corpora import genia
from scilk.util import intervals
from scilk.collections import _collectio... | 2.53125 | 3 |
entrypoint.py | brenshanny/project_lob | 1 | 12780527 | import os
import logging
import argparse
import sys
from .controllers.hot_lobs import HotLobMonitor
from .controllers.cold_lobs import ColdLobMonitor
if __name__ == "__main__":
# Check for config file
if "PROJECT_LOB_CONFIG" not in os.environ:
print("PROJECT_LOB_CONFIG must be an environment variable ... | 2.375 | 2 |
pynrc/maths/fast_poly.py | JarronL/pyNRC | 6 | 12780528 | #from __future__ import absolute_import, division, print_function, unicode_literals
# import numpy as np
# from numpy.polynomial import legendre
from webbpsf_ext.maths import jl_poly, jl_poly_fit, fit_bootstrap
| 1.125 | 1 |
tests/datatypes/test-NMTOKENS.py | thorstenb/pyxb | 0 | 12780529 | <filename>tests/datatypes/test-NMTOKENS.py
from pyxb.exceptions_ import *
import unittest
import pyxb.binding.datatypes as xsd
class Test_NMTOKENS (unittest.TestCase):
def testBasicLists (self):
v = xsd.NMTOKENS([ "one", "_two", "three" ])
self.assertEqual(3, len(v))
self.assertTrue(isinsta... | 2.484375 | 2 |
dataset-scripts/simulated_import.py | cnasikas/smpc-analytics | 12 | 12780530 | <reponame>cnasikas/smpc-analytics<gh_stars>10-100
import argparse
import sys
import json
import pandas as pd
import os
from subprocess import Popen, PIPE, STDOUT
from huepy import *
import hashlib
CURRENT_FILE_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
class ProcessError(Exception):
def __init__(self... | 2.171875 | 2 |
main.py | yaxollum/physics-calculator | 0 | 12780531 | import math
from math import pi,sqrt,radians,degrees
import sys
g=9.8
G=6.67e-11
e=1.6021917e-19
ke=8.9875e9
me=9.1095e-31
mp=1.67261e-27
mn=1.674929e-27
blocked=["exec","sys","eval","PROCESS","CMD","RESULT","block","import","math","from",]
def sin(deg):
return math.sin(radians(deg))
def cos(deg):
return mat... | 3.296875 | 3 |
src/server/db/__init__.py | ralfstefanbender/Studifix2 | 0 | 12780532 | print("db package (Mapper) wird initialisiert...") | 1.15625 | 1 |
2_7.py | JeffreyAsuncion/PCEP_training_2020_12 | 0 | 12780533 | <reponame>JeffreyAsuncion/PCEP_training_2020_12<filename>2_7.py<gh_stars>0
# Looping your code with while
# we will store the current greatest number here
max = -999999999
# get the first value *
number = int(input("Enter value or -1 to stop: "))
# if the number is not equal to -1 we will continue
while number != -1... | 4.125 | 4 |
pybar/daq/readout_utils.py | laborleben/pyBAR | 10 | 12780534 | <filename>pybar/daq/readout_utils.py
import logging
import os
import numpy as np
import tables as tb
class NameValue(tb.IsDescription):
name = tb.StringCol(256, pos=0)
value = tb.StringCol(4 * 1024, pos=0)
def save_configuration_dict(h5_file, configuation_name, configuration, **kwargs):
''... | 2.53125 | 3 |
tests/test_utils.py | eric-erki/autokeras | 1 | 12780535 | from autokeras.generator import DefaultClassifierGenerator
from autokeras.utils import *
from tests.common import get_processed_data
def test_model_trainer():
model = DefaultClassifierGenerator(3, (28, 28, 3)).generate().produce_model()
train_data, test_data = get_processed_data()
ModelTrainer(model, tra... | 2.34375 | 2 |
python/ray/serve/tests/test_config_files/pizza.py | jianoaix/ray | 0 | 12780536 | <reponame>jianoaix/ray
from enum import Enum
from typing import List, Dict, TypeVar
import ray
from ray import serve
import starlette.requests
from ray.serve.drivers import DAGDriver
from ray.serve.deployment_graph import InputNode
RayHandleLike = TypeVar("RayHandleLike")
class Operation(str, Enum):
ADDITION = ... | 2.546875 | 3 |
datafreezer/__init__.py | thirawr/django-datafreezer-sample | 0 | 12780537 | default_app_config = 'datafreezer.apps.DatafreezerConfig'
| 1.09375 | 1 |
myia/abstract/__init__.py | strint/myia | 222 | 12780538 | <reponame>strint/myia
"""Abstract data and type/shape inference."""
from .aliasing import *
from .amerge import *
from .data import *
from .infer import *
from .loop import *
from .macro import *
from .ref import *
from .to_abstract import *
from .utils import *
| 0.746094 | 1 |
gui/feature_tool_add.py | mdvandamme/PoussePousseEditData | 0 | 12780539 | # -*- coding: utf-8 -*-
"""
/***************************************************************************
Create new point. Synchonize with layer and file
-------------------
begin : 2018-07-11
git sha : $Format:%H$
author ... | 2.734375 | 3 |
credential_test.py | davidngatia/Locker | 0 | 12780540 | import unittest
from credential import Credential
class TestCredential(unittest.TestCase):
"""
Test class that defines test cases for the credential class behavioursself.
Args:
unittest.TestCase:TestCase class that helps in creating test cases
"""
def setUp(self):
"""
Set ... | 3.890625 | 4 |
practice/ai/astar-search/n-puzzle/n-puzzle.py | zeyuanxy/HackerRank | 4 | 12780541 | import copy
def main():
directions = [[-1, 0, 'UP'], [0, -1, 'LEFT'], [0, 1, 'RIGHT'], [1, 0, 'DOWN']]
n = int(input())
input_grid = []
for i in range(n * n):
x = int(input())
input_grid.append(x)
queue = []
answer_routes = None
mem = set()
queue.append([input_grid... | 3.3125 | 3 |
routers.py | LeeLeah/permov | 10 | 12780542 | <reponame>LeeLeah/permov
from handlers import Index
from handlers import Img
from handlers import Search
from handlers import User
from handlers import SomePage
from handlers import Admin
from handlers import VIP
route = [
(r"/",Index.index),
(r"/([0-9]+)/?",Img.category),
(r"/addLink/?",Img.addLink),
(r"/addCate/... | 1.859375 | 2 |
ptr_lib.py | alexBoava/ptr_lib | 0 | 12780543 | <gh_stars>0
#
# Copyright (c) 2014 R.Pissardini <rodrigo AT pissardini DOT com>
# Copyright (c) 2018 R.Pissardini <rodrigo AT pissardini DOT com> and <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
... | 1.945313 | 2 |
lessons/troubleshooting-chain/get-phone-ip-from-ext.py | wouyang628/nrelabs-curriculum | 1 | 12780544 | #!/usr/bin/python2.7
import requests
import xml.etree.ElementTree as ET
import sys
import json
def out(*args):
if sys.stdout.isatty():
print ', '.join(args[0]["hosts"])
else:
print json.dumps(args[0])
def myfunc(*args):
host = args[0]["host"][0]
port = args[0]["port"][0]
userna... | 2.578125 | 3 |
Chapter09/c9_52_impact_of_correlation_on_efficient_frontier_notWorking.py | John-ye666/Python-for-Finance-Second-Edition | 236 | 12780545 | <filename>Chapter09/c9_52_impact_of_correlation_on_efficient_frontier_notWorking.py
"""
Name : c9_52_impacto_of_correlation_on_efficient_frontier.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""... | 2.4375 | 2 |
setup.py | asottile/editdistance-s | 8 | 12780546 | import platform
import sys
from setuptools import setup
if platform.python_implementation() == 'CPython':
try:
import wheel.bdist_wheel
except ImportError:
cmdclass = {}
else:
class bdist_wheel(wheel.bdist_wheel.bdist_wheel):
def finalize_options(self) -> None:
... | 1.78125 | 2 |
mail_sender.py | PaulinaKomorek/UAM | 0 | 12780547 |
import smtplib
from email.message import EmailMessage
def send_mail(mail: str, name: str):
user = ''
password = ''
text="Hello " + name + ", \n your account has been created succesfully"
msg = EmailMessage()
msg.set_content(text)
msg['Subject'] = "Confirmation"
msg['From'] = ""
msg['To... | 2.9375 | 3 |
HACKERRANK/PROBLEM_SOLVING/DATA_STRUCTURES/TREES/BINARY_SEARCH_TREE_INSERTION.py | WarlonZeng/Big4-Hackerrank | 1 | 12780548 | <gh_stars>1-10
"""
Node is defined as
self.left (the left child of the node)
self.right (the right child of the node)
self.data (the value of the node)"""
def insert(root,val):
#Enter you code here.
if root == None:
return Node(val)
else:
if val <= root.data:
current = insert(ro... | 3.984375 | 4 |
cybox/test/common/contributor_test.py | siemens/python-cybox | 0 | 12780549 | # Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from cybox.common import Contributor
from cybox.test import EntityTestCase
class TestContributor(EntityTestCase, unittest.TestCase):
klass = Contributor
_full_dict = {
'role': "Le... | 2.21875 | 2 |
bin/delete_downstream.py | Lhior/TXPipe | 9 | 12780550 | """
This script prints out the commands to delete all files generated by a pipeline,
downstream of a specified stage.
If one stage was wrong, and you need to re-run everything it affected, this script
will print out the commands to delete the relevant files to that re-running the pipeline
with resume=True will re-run ... | 2.9375 | 3 |