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 |
|---|---|---|---|---|---|---|
Heapsort/Heapsort.py | CrypticCalamari/Algorithms | 0 | 12795451 | #!/usr/bin/python
import random
class Heapsort:
"""Heapsort"""
@staticmethod
def bubble_down(a, begin, end):
root = begin
child = root * 2 + 1
while (child <= end):
if ((child + 1 <= end) and (a[child] < a[child + 1])):
child += 1
if (a[root] < a[child]):
a[root], a[child] = a[child], a[root]
... | 4.09375 | 4 |
tests/unit/pipelines.py | ethanjli/phylline | 0 | 12795452 | <reponame>ethanjli/phylline
"""Test the pipelines module."""
# Builtins
# Packages
from phylline.links.clocked import DelayedEventLink
from phylline.links.events import EventLink
from phylline.links.links import ChunkedStreamLink
from phylline.links.loopback import TopLoopbackLink
from phylline.links.streams import ... | 2.28125 | 2 |
fullcyclepy/tests/test_utils.py | dfoderick/fullcyclemining | 26 | 12795453 | <filename>fullcyclepy/tests/test_utils.py<gh_stars>10-100
import unittest
import datetime
import backend.fcmutils as utils
import messaging.schema as schema
class TestUtilityFunctions(unittest.TestCase):
def test_safe_string_null(self):
nullstring = utils.safestring(None)
self.assertFalse(nullstrin... | 2.265625 | 2 |
src/oci/apm_traces/models/query_result_metadata_summary.py | Manny27nyc/oci-python-sdk | 249 | 12795454 | <gh_stars>100-1000
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LIC... | 2.03125 | 2 |
signal_interpreter_server/tests/unit_tests/test_json_parser.py | mtormane/signal-interpreter-server | 0 | 12795455 | import json
import os
from unittest.mock import patch, mock_open
import pytest
from signal_interpreter_server.json_parser import JsonParser
from signal_interpreter_server.exceptions import SignalError
@pytest.mark.parametrize("identifier, expected_result", [
("11", "ECU Reset"),
("99", "Not existing"),
])
... | 2.375 | 2 |
test/test_gpu.py | tranlethaison/learnRL | 0 | 12795456 | <reponame>tranlethaison/learnRL
if __name__ == "__main__":
print("> Test tensorflow-gpu")
import tensorflow as tf
is_gpu_available = tf.test.is_gpu_available()
print(">> __version__: ", tf.__version__)
print(">> is_gpu_available:", is_gpu_available)
| 2.3125 | 2 |
examples/with_signals.py | vBLFTePebWNi6c/Flask-Shell2HTTP | 0 | 12795457 | # web imports
from flask import Flask
from blinker import Namespace # or from flask.signals import Namespace
from flask_executor import Executor
from flask_executor.futures import Future
from flask_shell2http import Shell2HTTP
# Flask application instance
app = Flask(__name__)
# application factory
executor = Execut... | 2.578125 | 3 |
synergy/db/dao/unit_of_work_dao.py | eggsandbeer/scheduler | 0 | 12795458 | __author__ = '<NAME>'
from threading import RLock
from bson.objectid import ObjectId
from pymongo import ASCENDING
from pymongo.errors import DuplicateKeyError as MongoDuplicateKeyError
from synergy.system import time_helper
from synergy.system.time_qualifier import *
from synergy.system.decorator import thread_safe... | 2.0625 | 2 |
c_translator/formative/m_ifelse.py | mahudu97/ANSI-C_Compiler | 0 | 12795459 | def main():
a=0
b=0
if(1<2):
a = 1
else:
a = 2
if(1>2):
b = 1
else:
b = 2
return a + b
# Boilerplate
if __name__ == "__main__":
import sys
ret=main()
sys.exit(ret)
| 3.375 | 3 |
models/Stereo/PSMNetDown.py | pidan1231239/SR-Stereo | 2 | 12795460 | import os
import time
import torch.optim as optim
import torch
import torch.nn.functional as F
import torch.nn as nn
from evaluation import evalFcn
from utils import myUtils
from .RawPSMNet import stackhourglass as rawPSMNet
from .RawPSMNet_TieCheng import stackhourglass as rawPSMNet_TieCheng
from ..Model import Model
... | 2.125 | 2 |
learned_optimization/population/examples/simple_cnn/common.py | Sohl-Dickstein/learned_optimization | 70 | 12795461 | # coding=utf-8
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | 2.109375 | 2 |
performance/zero_copy_prc1.py | lukasdean/robust_python | 0 | 12795462 | <gh_stars>0
#!/user/bin/env python
# -*-coding:utf-8 -*-
# @CreateTime : 2021/10/25 22:52
# @Author : xujiahui
# @Project : robust_python
# @File : zero_copy_prc1.py
# @Version : V0.0.1
# @Desc : ?
# 借助于 memoryview 来实现零拷贝
import timeit
data = b"shave and a haircut, two bits"
view ... | 2.59375 | 3 |
test/ursina/test.py | rahul38888/opworld | 0 | 12795463 | from ursina import *
class Inventory(Entity):
def __init__(self, capacity):
super(Inventory, self).__init__(
parent=camera.ui, model='quad',
origin=(-0.5, 0.5), texture="white_cube",
color=color.dark_gray
)
self.capacity = capacity
self.scale=(ca... | 2.46875 | 2 |
p575e/distribute_candies.py | l33tdaima/l33tdaima | 1 | 12795464 | <reponame>l33tdaima/l33tdaima<gh_stars>1-10
from typing import List
class Solution:
def distributeCandies(self, candyType: List[int]) -> int:
return min(len(candyType) // 2, len(set(candyType)))
# TESTS
for candyType, expected in [
([1, 1, 2, 2, 3, 3], 3),
([1, 1, 2, 3], 2),
([6, 6, 6, 6], 1... | 3.65625 | 4 |
04Cuarto/Redes_MultiServicio_RMS/01_Lector_de_etiquetas_MPLS/src/controller/controllers/Main.py | elsudano/Facultad | 2 | 12795465 | <gh_stars>1-10
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""Lista de controladores del programa.
En este fichero podemos encontrarnos todos los controladores,
de todas las vistas de nuestro programa.
"""
from src.controller.Controller import Controller
from src.model import models
from src.controller import controlle... | 2.703125 | 3 |
examples/petting_zoo/waterworld.py | LuisFMCuriel/ai-traineree | 22 | 12795466 | """
This example is for demonstartion purpose only.
No agent learns here anything useful, yet.
Well, maybe they do but it might take a long time to check.
Ain't nobody got time for that.
"""
from pettingzoo.sisl import waterworld_v3
from ai_traineree.agents.ppo import PPOAgent
from ai_traineree.multi_agents.independe... | 2.5 | 2 |
queue/queue.py | Sherlock-dev/algos | 1,126 | 12795467 | class Queue(object):
def __init__(self):
self._list = []
def count(self):
return len(self._list)
def is_empty(self):
return self.count() == 0
def enqueue(self, item):
self._list.append(item)
def dequeue(self):
try:
return self._list.pop(0)
... | 4.03125 | 4 |
anagrams/anagrams.py | learnalgorithms/problems | 0 | 12795468 | <gh_stars>0
def isAnagram(s: str, t: str) -> bool:
if len(s) == len(t):
s_map = {}
t_map = {}
for l in s:
if l in s_map:
s_map[l] += 1
else:
s_map[l] = 0
for l in t:
if l in t_map:
t_map[l] += 1
... | 3.25 | 3 |
imgtoxl.py | findsarfaraz/ImageToXL | 0 | 12795469 | <filename>imgtoxl.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'imgtoxl.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
... | 1.84375 | 2 |
tests/SharedDataFrameTest.py | pywash/pywash | 7 | 12795470 | from unittest import TestCase
from src.PyWash import SharedDataFrame
from src.Exceptions import *
import pandas as pd
verbose = False
class TestDecorators(TestCase):
""" TestClass for SharedDataFrame methods """
def test_is_mergeable_column_names(self):
if verbose:
print("Testing: is_mer... | 2.953125 | 3 |
assessment_03/gameplay/PlayerAction.py | DominicSchiller/osmi-module-datascience | 0 | 12795471 | from enum import Enum
from . import PlayerAction
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__ = '1.0'
__license__ = 'MIT'
class PlayerAction(Enum):
"""
Enumeration of possible player actions.
"""
HIT = 0
STAND = 1
YES = 2
NO = 3
@staticmethod
def get_action(action_name... | 3.4375 | 3 |
src/config/settings.py | kents00/Django | 1 | 12795472 | import os
import logging
import environ
from pathlib import Path
SUPPORTED_NONLOCALES = ['media', 'admin', 'static']
# Build paths inside the project like this: BASE_DIR / 'subdir'.
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__) + "../../../")
env = environ.Env()
# reading .env file
environ.Env.read_env(... | 2 | 2 |
opencv_project_python-master/opencv_project_python-master/05.geometric_transform/remap_barrel.py | dongrami0425/Python_OpenCV-Study | 0 | 12795473 | <reponame>dongrami0425/Python_OpenCV-Study
import cv2
import numpy as np
# 왜곡 계수 설정 ---①
k1, k2, k3 = 0.5, 0.2, 0.0 # 배럴 왜곡
#k1, k2, k3 = -0.3, 0, 0 # 핀큐션 왜곡
img = cv2.imread('../img/girl.jpg')
rows, cols = img.shape[:2]
# 매핑 배열 생성 ---②
mapy, mapx = np.indices((rows, cols),dtype=np.float32)
# 중앙점 좌표로 -1~1 정규화 및 ... | 2.75 | 3 |
computer_network/UDPclient.py | WhiteHyun/Network | 1 | 12795474 | from socket import *
serverName = 'localhost'
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_DGRAM)
message = input('Input lowercase sentence:')
clientSocket.sendto(message.encode(), (serverName, serverPort))
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
print(modifiedMessage.decode())
clie... | 2.84375 | 3 |
test_proj/data/data_tcA009.py | leeltib/vizsgamunka_ref | 0 | 12795475 | # A009 - enter users for scrolling function test
# test with randomly generated users (arbitrary number of users, default is 2)
import random
import string
title = 'Hello, én egy A009 test User vagyok!.'
class MyRND():
chars_lo = string.ascii_lowercase
chars_int = string.digits
chars_up = string.ascii_up... | 3.5 | 4 |
notebooks/MS_Functions.py | malwinasanjose/anomaly_detection | 0 | 12795476 | <filename>notebooks/MS_Functions.py
import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
def clean_df(df):
# drop columns containing only NAs
df_clean = df.dropna(how='all', axis=1)
print(f'dropped {df.shape[1] - df_clean.shape[1]} columns')
# drop rows... | 2.890625 | 3 |
src/steampunk_scanner/cli.py | xlab-steampunk/steampunk-scanner-cli | 3 | 12795477 | <gh_stars>1-10
import argparse
import inspect
import sys
from steampunk_scanner import commands
class ArgParser(argparse.ArgumentParser):
"""An argument parser that displays help on error"""
def error(self, message: str):
"""
Overridden the original error method
:param message: Error... | 2.96875 | 3 |
lambda_function.py | cesarbruschetta/ses-receive-email-forward | 0 | 12795478 | <gh_stars>0
import sys
import os
import json
import logging
from typing import Dict
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from forward_recieved_email.utils import logger as c_logger
from forward_recieved_email.config import settings
from forward_recieved_email import processing
... | 1.953125 | 2 |
orm/db/migrations/0001_initial.py | madelinkind/twitter_crawler | 0 | 12795479 | # Generated by Django 3.1.2 on 2021-01-25 08:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='TwitterUser',
fields=[
... | 1.929688 | 2 |
sagas/api/info_mod.py | samlet/stack | 3 | 12795480 | from sanic import Blueprint
from sanic.response import json
info = Blueprint('info', url_prefix='/info')
@info.route("/ping")
async def ping(request):
"""
$ curl localhost:1700/info/ping
:param request:
:return:
"""
return json({ "hello": "world" })
@info.route('/env/<tag>')
async def env_han... | 2.4375 | 2 |
chatbot/views.py | G-sharp/ChatBot | 3 | 12795481 | from django.shortcuts import render
# Create your views here.
# -*- coding: utf-8 -*-
import json
import datetime
from DataBase import DBOPs
from django.http import HttpResponse
from chatbot import aimlKernel
def chat(request):
"""
Function:
对话接口
Args:
request: 请求
Returns:
返回... | 2.109375 | 2 |
test_palindrome.py | zhonchik/python_examples | 0 | 12795482 | <gh_stars>0
from palindrome import is_palindrome
def test_is_palindrome_1():
assert is_palindrome('a')
def test_is_palindrome_2():
assert is_palindrome('aa')
assert not is_palindrome('ab')
def test_is_palindrome_3():
assert is_palindrome('aba')
assert not is_palindrome('abc')
def test_is_pali... | 2.453125 | 2 |
The_Codes/Problem_1/XML.py | MertYILDIZ19/ADM-HW1 | 0 | 12795483 | ############### XML 1 - Find the Score ################
import sys
import xml.etree.ElementTree as etree
def get_attr_number(node):
# your code goes here
count = 0
for i in root.iter():
count += len(i.attrib)
return count
if __name__ == '__main__':
sys.stdin.readline()
... | 3.9375 | 4 |
pipelines/voc-2007/sched.py | fenwuyaoji/approx-vision | 61 | 12795484 | #! /usr/bin/env python
from __future__ import unicode_literals
from PIL import Image
from subprocess import check_call
from concurrent import futures
import subprocess ... | 2.375 | 2 |
parser.py | rougier/shadergraph | 3 | 12795485 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015, <NAME>
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
from pyparsing imp... | 2.015625 | 2 |
src/AtmNu_Recoildistribution.py | cajohare/AtmNuFloor | 1 | 12795486 | <gh_stars>1-10
import os
import sys
sys.path.append('../src')
from numpy import *
from numpy import random
from Params import *
from NeutrinoFuncs import *
from LabFuncs import *
# This file doesn't save all its recoils because we need a large number to
# make a nice plot of energy/phi/costh distribution. So everytime... | 2.234375 | 2 |
coinnews/pipelines.py | jlparadox/coinnews | 0 | 12795487 | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymongo
from scrapy.conf import settings
from scrapy.exceptions import DropItem
from scrapy import log
class Coinnews... | 2.578125 | 3 |
tests/shunit/data/bad_i18n_newline_4.py | saloniig/TWLight | 67 | 12795488 | <filename>tests/shunit/data/bad_i18n_newline_4.py
# Single-quoted string is preceded by newline.
# Translators: This is a helpful comment.
_(
'4')
| 0.863281 | 1 |
ticketNumber.py | brocchirodrigo/ValidadorBoletosSantanderPython | 0 | 12795489 | def verifyTicket(ticket):
ticket = ticket[::-1]
t01 = int(ticket[0]) * 2
t02 = int(ticket[1]) * 3
t03 = int(ticket[2]) * 4
t04 = int(ticket[3]) * 5
t05 = int(ticket[4]) * 6
t06 = int(ticket[5]) * 7
t07 = int(ticket[6]) * 8
t08 = int(ticket[7]) * 9
t09 = int(ticket[8]) *... | 3.265625 | 3 |
matchengine/internals/utilities/update_match_utils.py | AveraSD/matchengine-V2 | 18 | 12795490 | from __future__ import annotations
import asyncio
import datetime
import logging
from typing import TYPE_CHECKING
from pymongo import UpdateMany, InsertOne
from matchengine.internals.typing.matchengine_types import RunLogUpdateTask, UpdateTask, MongoQuery
from matchengine.internals.utilities.list_utils import chunk_... | 2.09375 | 2 |
tests/test_makeload.py | hansroh/aquests | 8 | 12795491 | import aquests
CONCURRENT = 50
MAX_REQ = 1000
_ID = 0
def makeload (response):
global _ID
print (response.meta ['_id'], response.code, response.msg, response.version)
if aquests.countreq () < MAX_REQ:
aquests.get ("http://127.0.0.1:5000/", meta = {'_id': _ID})
_ID += 1
def test_makeload ():
aquests.configu... | 2.453125 | 2 |
aids/strings/reverse_string.py | ueg1990/aids | 0 | 12795492 | '''
Reverse a string
'''
def reverse_string_iterative(string):
result = ''
for char in range(len(string) - 1, -1 , -1):
result += char
return result
def reverse_string_recursive(string):
if string:
return reverse_string_recursive(string[1:]) + string[0]
return ''
def reverse_string_pythonic(string... | 4.34375 | 4 |
nuke_stubs/nuke/nuke_classes/Undo.py | sisoe24/Nuke-Python-Stubs | 1 | 12795493 | <gh_stars>1-10
from numbers import Number
from typing import *
import nuke
from . import *
class Undo(object):
"""
Undo
"""
def __hash__(self, ):
"""
Return hash(self).
"""
return None
def __new__(self,*args, **kwargs):
"""
Create and return a new o... | 3.109375 | 3 |
get_events.py | malcolmvr/o365_linux_meeting_alerts | 0 | 12795494 | <filename>get_events.py
from datetime import datetime
from os import getenv
from os.path import isfile
from dotenv import load_dotenv
from O365 import Account
load_dotenv()
credentials = (getenv('APPLICATION_ID'), getenv('CLIENT_SECRET'))
print(credentials)
account = Account(credentials, auth_flow_type='authorization... | 2.59375 | 3 |
python_basics/5.data_conversion/string_to_integer.py | edilsonmatola/Python_Master | 2 | 12795495 | string_number = '15'
# converting to integer
# integer_number will contain 15
integer_number = int(string_number)
print(integer_number) # Output: 15
| 3.703125 | 4 |
get_next_person.py | jbarry1506/python_unittest | 0 | 12795496 | def get_next_person(user):
person = get_random_person()
while person in user['people_seen']:
person = get_random_person()
return person
| 2.890625 | 3 |
copycat/codelet_methods.py | jalanb/co.py.cat | 27 | 12795497 | import logging
import random
from . import formulas
from . import temperature
from .bond import Bond
from .bond import possible_group_bonds
from .coderack import coderack
from .correspondence import Correspondence
from .group import Group
from .letter import Letter
from .replacement import Replacement
from .slipnet im... | 2.34375 | 2 |
src/grpc_infer.py | huyhoang17/kuzushiji_recognition | 16 | 12795498 | import os
import math
import time
import functools
import random
from tqdm import tqdm
import cv2
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image, ImageDraw
from pylab import rcParams
rcParams['figure.figsize'] = 20, 20 # noqa
from consts import FONT_SIZE
from utils import (
make_contour... | 2.0625 | 2 |
mpire/signal.py | synapticarbors/mpire | 505 | 12795499 | from inspect import Traceback
from signal import getsignal, SIG_IGN, SIGINT, signal as signal_, Signals
from types import FrameType
from typing import Type
class DelayedKeyboardInterrupt:
def __init__(self, in_thread: bool = False) -> None:
"""
:param in_thread: Whether or not we're living in a t... | 2.375 | 2 |
scripts/create_shell_link.py | DatGuy1/Windows-Toasts | 1 | 12795500 | #!/usr/bin/env python
import argparse
import os
import sys
from pathlib import Path
from typing import Any, Optional
try:
import pythoncom
from win32com.propsys import propsys
from win32com.shell import shell
except ImportError:
raise ImportError(
"pywin32 is required to run create_shell_link.... | 2.40625 | 2 |
oteltrace/contrib/mysql/__init__.py | ocelotl/opentelemetry-auto-instr-python-1 | 2 | 12795501 | # Copyright 2019, OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 1.648438 | 2 |
src/smartystreets/__init__.py | bennylope/smartystreets.py | 12 | 12795502 | # -*- coding: utf-8 -*-
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__version__ = "1.0.0"
from smartystreets.client import Client # noqa
__all__ = ["Client"]
| 1.304688 | 1 |
api/system/node/events.py | klebed/esdc-ce | 97 | 12795503 | from api.event import Event
from que import TT_DUMMY, TG_DC_UNBOUND
from que.utils import DEFAULT_DC, task_id_from_string
class NodeSystemRestarted(Event):
"""
Called from node_sysinfo_cb after erigonesd:fast is restarted on a compute node.
"""
_name_ = 'node_system_restarted'
def __init__(self, ... | 2.0625 | 2 |
lib/proxies/aws_long.py | jhong93/aws-lambda-proxy | 7 | 12795504 | <reponame>jhong93/aws-lambda-proxy
import boto3
import json
import logging
from base64 import b64decode
from random import SystemRandom
from concurrent.futures import ThreadPoolExecutor
from lib.proxy import AbstractRequestProxy, ProxyResponse
from lib.stats import LambdaStatsModel, S3StatsModel
from lib.wo... | 2.09375 | 2 |
TS3GatherBot.py | ikinz/TS3GatherBot | 0 | 12795505 | <reponame>ikinz/TS3GatherBot
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created by <NAME>
This bot will make it easier to set up gathers, all
from your teamspeak 3 server.
The bot requires access to the Teamspeak 3 server
query!
"""
__author__ = '<NAME>'
__copyright__ = 'Copyright... | 2.203125 | 2 |
learningPygame/McKinley/00-MovingSmile/04-Drawing.py | Rosebotics/catapult2019 | 0 | 12795506 | # TODO: In this module we'll start drawing a simple smiley face
# Yellow circle for the head
# Two black circle eyes
# Red rectangle (rect) mouth
# Red circle nose.
import pygame
import sys
pygame.init()
screen = pygame.display.set_mode((600, 600))
while True:
for event in pygame.event.get():
if even... | 3.921875 | 4 |
airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_full_refresh.py | koji-m/airbyte | 6,215 | 12795507 | <filename>airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_full_refresh.py
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import pytest
from airbyte_cdk.models import Type
from source_acceptance_test.base import BaseTest
from source_acceptance_test.utils import Connect... | 1.976563 | 2 |
medical_prescription/user/test/test_forms_patient.py | thiagonf/Sprint-3-GPP | 0 | 12795508 | from django.test import TestCase
from user.forms import PatientForm
from user.models import User
class TestPatientForm(TestCase):
def setUp(self):
self.name_valid = '<NAME>'
self.name_invalid = 'a12'
self.name_invalid_TYPE = 'a@hjasgdjasd1al'
self.name_invalid_MAX = 'aasdkgasghdhja... | 2.3125 | 2 |
PassGen.py | CoderMP/PythonPassGen | 0 | 12795509 | <reponame>CoderMP/PythonPassGen<gh_stars>0
####### REQUIRED IMPORTS #######
import os
import sys
import click
import random
import string
from time import sleep
####### FUNCTIONS ######
def displayHeader():
"""
() -> ()
Function that is responsible for printing the application header
and menu
"""
... | 3.109375 | 3 |
device.py | JCLemme/letterbox | 0 | 12795510 | <filename>device.py
#!/usr/bin/env python3
import os
import sys
import time
import zmq
def main():
frontend = None
backend = None
context = None
try:
context = zmq.Context(1)
# Socket facing clients
frontend = context.socket(zmq.SUB)
frontend.bind("tcp://*:5559")
... | 2.40625 | 2 |
src/__init__.py | Nardri/rbac-service | 0 | 12795511 | <reponame>Nardri/rbac-service
"""Blueprint module"""
from flask import Blueprint
# instantiating the blue print
rbac_blueprint = Blueprint('rbac-service', __name__, url_prefix='/v1')
| 1.578125 | 2 |
myGym/generate_dataset.py | incognite-lab/myGym | 18 | 12795512 | <filename>myGym/generate_dataset.py<gh_stars>10-100
## script to generate train/test sets from the simulator in COCO or DOPE format. Used for vision training.
import gym
from myGym import envs
from matplotlib.pyplot import imshow, show
import cv2
import numpy as np
import os
import glob
import json
import commentjson
... | 2.75 | 3 |
assetoolz/assets.py | aspyatkin/assetoolz | 0 | 12795513 | import os
from .cache import Cache
from .models import CacheEntry
from .utils import get_file_hash, save_file, load_file
import shutil
import io
from .compiler import ExpressionProcessor
from .expressions import stylesheets, scripts, html
import subprocess
import tempfile
class AssetCollection(object):
def __init... | 2.265625 | 2 |
PIP/Class Program/ClassQuestion1.py | ankitrajbiswal/SEM_5 | 10 | 12795514 | def rectangle(breadth,length):
return breadth*length,2*(length+breadth)
x,y=rectangle(float(input("Enter breatdh ")),float(input("Enter length ")))
print("Area ",x,"Perimeter ",y)
| 4.09375 | 4 |
data_mgmt/data_prep/gen_motif.py | theandyb/smaug-redux | 0 | 12795515 | from itertools import product
alpha = ['A', 'T', 'C', 'G']
motifs = [a+b+c+d+e+f+g for a,b,c,d,e,f,g in product(alpha, repeat=7)]
with open('motifs7.txt', 'w') as f:
for item in motifs:
f.write("%s\n" % item)
| 2.875 | 3 |
bak/extract/misc.py | ashlinrichardson/bcstats_ohcs_craigslist | 2 | 12795516 | <filename>bak/extract/misc.py
import os
import sys
import csv
import time
args = sys.argv
def err(msg):
print("Error:", msg)
sys.exit(1)
# parallel for loop
def parfor(my_function, my_inputs):
# evaluate function in parallel, and collect the results
import multiprocessing as mp
pool = mp.Pool(mp... | 2.59375 | 3 |
TPP_RL.py | SudoMishra/mtech_thesis | 0 | 12795517 | import networkx as nx
graph = nx.DiGraph()
nodes = [f"{i}" for i in range(1, 13)]
nodes.extend([chr(i) for i in range(1, 13)])
graph.add_nodes_from([])
class Node:
def __init__(self, name, direct, sig):
self.name = name
self.direct = direct
self.sig = sig
class Edge:
def __init__(se... | 3.28125 | 3 |
djangoflutterwave/tests/test_template_tags.py | bdelate/django-flutterwave | 9 | 12795518 | <reponame>bdelate/django-flutterwave
# stdlib imports
from unittest.mock import patch
# django imports
from django.test import TestCase
# 3rd party imports
# project imports
from djangoflutterwave.tests.factories import FlwPlanModelFactory, UserFactory
from djangoflutterwave.templatetags.djangoflutterwave_tags impor... | 2.515625 | 3 |
torchnet/containers/models/__init__.py | a5chin/torchnet | 0 | 12795519 | <reponame>a5chin/torchnet
from .classification import Classifier
| 0.976563 | 1 |
datastructure/practice/c7/r_7_1.py | stoneyangxu/python-kata | 0 | 12795520 | import unittest
from datastructure.links.Node import Node
def from_second(head):
if head is None:
raise ValueError("Linked list is empty")
return head._next
class MyTestCase(unittest.TestCase):
def test_something(self):
head = Node(0, None)
current = head
for i in range(1... | 3.515625 | 4 |
backend/project/dica/migrations/0001_initial.py | rafaelsanches123/megahack-segunda-edicao-2020 | 1 | 12795521 | <gh_stars>1-10
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='DicaModel',
fields=[
('descricao', models.CharField(max_length=200,... | 1.828125 | 2 |
Project1-MinNE-python/src/layer/net.py | MrCaiDev/uestc-CNTProject | 1 | 12795522 | <gh_stars>1-10
from time import sleep
from utils.coding import *
from utils.frame import *
from utils.params import *
from layer._abstract import AbstractLayer
class NetLayer(AbstractLayer):
"""主机网络层。
实现了主机应用层 <-> 主机网络层 <-> 主机物理层的消息收发。
"""
def __init__(self, device_id: str) -> None:
"""初始化... | 2.4375 | 2 |
gammapy/astro/population/tests/test_simulate.py | Rishank2610/gammapy | 155 | 12795523 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from numpy.testing import assert_allclose, assert_equal
import astropy.units as u
from astropy.table import Table
from gammapy.astro.population import (
add_observed_parameters,
add_pulsar_parameters,
add_pwn_parameters,
add_snr_parameters,... | 1.953125 | 2 |
SRD-onef.py | sankeyad/strongly-regular-designs | 0 | 12795524 | <reponame>sankeyad/strongly-regular-designs<gh_stars>0
# SRD-onef.py
# Reads a single text file of strongly regular graph parameters.
# Output is feasible parameter sets for strongly regular designs admitting
# strongly regular decomposition, in which two graphs from the input file are
# the SRGs on the two fibres of t... | 2.90625 | 3 |
foreshadow/smart/intent_resolving/core/data_set_parsers/base_data_set_parser.py | adithyabsk/foreshadow | 25 | 12795525 | """Class definition for the DataSetParser ABC and FeaturizerMixin."""
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Callable, Generator, List, Tuple, Type
import numpy as np
import pandas as pd
from sklearn.preprocessing import RobustScaler
class FeaturizerMixin:
"""Mixin to pr... | 2.984375 | 3 |
DIN/model.py | daxixi/Context-Aware-Compilation-of-DNN-Training-Pipelines-across-Edge-and-Cloud | 0 | 12795526 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class MLP(nn.Module):
def __init__(self, MLPInfo, activation='PReLU', PReLuInit=0.25, isUseBN=True, dropoutRate=0.0, initStd=0.0001):
super(MLP, self).__init__()
self.multiLayerPerceptro... | 2.65625 | 3 |
mmflow/__init__.py | gaotongxiao/mmflow | 1 | 12795527 | <reponame>gaotongxiao/mmflow
from .version import __version__, parse_version_info, version_info
__all__ = ['__version__', 'version_info', 'parse_version_info']
| 0.976563 | 1 |
py/probe/runtime_probe/probe_config_types_unittest.py | arccode/factory | 3 | 12795528 | #!/usr/bin/env python3
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import re
import unittest
from cros.factory.probe.runtime_probe import probe_config_types
from cros.factory.utils import json_util... | 2.09375 | 2 |
backend/submissions/migrations/0007_auto_20191119_2132.py | marcoacierno/pycon | 56 | 12795529 | # Generated by Django 2.2.7 on 2019-11-19 21:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('submissions', '0006_merge_20191113_0542'),
]
operations = [
migrations.CreateModel(
name='SubmissionTag',
fields=[
... | 1.5625 | 2 |
_static/src/python/SignalProcessing/Digital/Basic/Interpolation/demo_SincInterpolation0.py | metai/aitrace | 1 | 12795530 | import numpy as np
import matplotlib.pyplot as plt
PI = np.pi
# =========================define sinc
# ---------------normalized
def sinc1(x):
PI = np.pi
x = np.array(x)
y = np.where(np.abs(PI * x) < 1e-38, 1.0, np.sin(PI * x) / (PI * x))
return y
def sinc_interpolation(x, t, T):
ns = np.arange... | 3.0625 | 3 |
parsec/commands/workflows/import_workflow_dict.py | abretaud/parsec | 0 | 12795531 | <gh_stars>0
import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, dict_output, _arg_split
@click.command('import_workflow_dict')
@click.argument("workflow_dict", type=str)
@pass_context
@custom_exception
@dict_output
def cli(ctx, workflow_dict):
"""Imports a... | 2.203125 | 2 |
RWL.py | MarcinAman/Python-AGH | 0 | 12795532 | from string import ascii_lowercase
import functools
from itertools import combinations
def generate_binary(n):
"""
Function returns generator with binary sequences of a set length
:param n: length of a binary sequence
:return: generator with binary sequence
"""
if n == 0:
yield ""
... | 4.21875 | 4 |
python-ca/bjorn/migrations/0010_alter_certificate_revocation_reason.py | AS207960/bjorn | 4 | 12795533 | # Generated by Django 3.2.6 on 2021-09-08 14:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bjorn', '0009_auto_20210908_1427'),
]
operations = [
migrations.AlterField(
model_name='certificate',
name='revocati... | 1.53125 | 2 |
codershq/users/migrations/0004_auto_20210805_1832.py | Buhannad/CodersHQ | 45 | 12795534 | <filename>codershq/users/migrations/0004_auto_20210805_1832.py<gh_stars>10-100
# Generated by Django 3.0.11 on 2021-08-05 14:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20210805_1818'),
]
operations = [
migrati... | 1.679688 | 2 |
pypkgcreator/__init__.py | somtud/create-python-package | 1 | 12795535 | <reponame>somtud/create-python-package<filename>pypkgcreator/__init__.py<gh_stars>1-10
#!/usr/bin/env python
__version__ = 'v0.0.1'
| 1.273438 | 1 |
tables/wikipedia-scripts/weblib/web.py | yash-srivastava19/sempre | 812 | 12795536 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib, urllib2, urlparse, socket
import json, sys, os, hashlib, subprocess, time
from blacklist import BLACKLIST
BASEDIR = os.path.dirname(os.path.realpath(os.path.join(__file__, '..')))
class WebpageCache(object):
def __init__(self, basedi... | 2.359375 | 2 |
Toonland-2013-master/toonland/security/HackerCrypt.py | BarcodeALT/Toonland-2003 | 0 | 12795537 | ########################## THE TOON LAND PROJECT ##########################
# Filename: HackerCrypt.py
# Created by: Cody/Fd Green Cat Fd (January 31st, 2013)
####
# Description:
#
# Encryption method written by Team FD in 2011 for their personal releases.
# The script has been modified to meet Toon Land's coding stand... | 2.546875 | 3 |
core/management/commands/advance_turn.py | johnpooch/diplomacy | 1 | 12795538 | <filename>core/management/commands/advance_turn.py
import json
from django.core.management.base import BaseCommand, CommandError
from core import models
from core.game import process_turn
from core.models.base import GameStatus
from . import DiplomacyManagementCommandMixin
class Command(BaseCommand, DiplomacyManage... | 2.140625 | 2 |
dominant_colour.py | tawilkinson/dominant-colour | 0 | 12795539 | <reponame>tawilkinson/dominant-colour
import numpy as np
import time
from cv2 import cv2
from sklearn.cluster import KMeans
from skimage import io
from skimage.transform import rescale
def cv2_dominant_colour(img_url, colours=10, timing=False):
'''
Dominant Colour method using open cv, based on
https://s... | 3 | 3 |
ingest/tools/cb.py | ivmfnal/striped | 1 | 12795540 | <filename>ingest/tools/cb.py
import json, getopt, sys
import numpy as np
from striped.client import CouchBaseBackend
Usage = """
python cb.py get [-j] [-o <file>|-d <dtype>] <bucket> <key>
-n means show data as numpy array of given dtype and shape
python cb.py put [-j] [-f <file>|-d <data>] <bucket> <key>
"""
if ... | 2.4375 | 2 |
rules/private/phases/phase_coda.bzl | hmemcpy/rules_scala-1 | 0 | 12795541 | #
# PHASE: coda
#
# Creates the final rule return structure
#
def phase_coda(ctx, g):
return struct(
java = g.ijinfo.intellij_info,
providers = g.out.providers,
)
| 1.804688 | 2 |
scrapli_cfg/platform/core/arista_eos/base_platform.py | m1009d/scrapli_cfg | 15 | 12795542 | """scrapli_cfg.platform.core.arista_eos.base"""
import json
import re
from datetime import datetime
from logging import LoggerAdapter
from typing import Iterable, List, Tuple, Union
from scrapli.driver import AsyncNetworkDriver, NetworkDriver
from scrapli.response import Response
from scrapli_cfg.exceptions import Scr... | 1.859375 | 2 |
backend/lib/google/cloud/grpc/datastore/v1/datastore_pb2_grpc.py | isaiah-solo/Droptalk | 0 | 12795543 | <reponame>isaiah-solo/Droptalk<gh_stars>0
import grpc
from grpc.framework.common import cardinality
from grpc.framework.interfaces.face import utilities as face_utilities
import google.cloud.grpc.datastore.v1.datastore_pb2 as google_dot_cloud_dot_grpc_dot_datastore_dot_v1_dot_datastore__pb2
import google.cloud.grpc.da... | 1.203125 | 1 |
nikolaBase/conf_base.py | diSimplex/nikolaBase | 0 | 12795544 | # -*- coding: utf-8 -*-
import time
# !! This is the configuration of Nikola. !! #
# !! You should edit it to your liking. !! #
# Data about this site
BLOG_AUTHOR = "<NAME>" # (translatable)
BLOG_TITLE = "My Nikola Site" # (translatable)
# This is the main URL for your site. It will be used
# in a prominent link... | 1.9375 | 2 |
Programinhas_python/busca/Fetch_words.py | xDanielz/python_exercicios_pessoais | 0 | 12795545 | while True:
search = str(input('Informe a palavra que gostaria de procurar: '))
try:
with open(f'acounts.txt', 'r') as file:
for lines in file.readlines():
if search in lines:
print(lines)
break
else:
print('... | 3.828125 | 4 |
tests/data_sources/gsp/test_gsp_data_source.py | openclimatefix/nowcasting_dataset | 15 | 12795546 | """ Tests for GSPDataSource """
import os
from datetime import datetime
import pandas as pd
import nowcasting_dataset
from nowcasting_dataset.data_sources.gsp.gsp_data_source import (
GSPDataSource,
drop_gsp_north_of_boundary,
)
from nowcasting_dataset.geospatial import osgb_to_lat_lon
def test_gsp_pv_data_... | 2.34375 | 2 |
S4/S4 Library/simulation/services/__init__.py | NeonOcean/Environment | 1 | 12795547 | <gh_stars>1-10
import argparse
import functools
import gc
import time
from services.tuning_managers import InstanceTuningManagers
from sims4.resources import INSTANCE_TUNING_DEFINITIONS
from sims4.tuning.instance_manager import TuningInstanceManager
from sims4.tuning.tunable import Tunable, TunableReference
import game... | 1.960938 | 2 |
src/modules/encoder.py | Neptune1201/ASIM | 3 | 12795548 | # coding=utf-8
# Copyright (C) 2019 Alibaba Group Holding Limited
#
# 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 app... | 2.1875 | 2 |
EXERCICIOS/exercicios_curso_linkedin/Cap. 1 - Linguagem/01_codingstyle_resposta.py | raphael-d-cordeiro/Python_Public | 0 | 12795549 | # cada import deve ter a sua própria linha
import sys
import os
# duas linhas em branco separam classes de outras funções
class MinhaClasse():
def __init__(self):
self.descricao = "Minha Classe"
# dentro de uma classe, usamos uma linha em branco entre métodos
def meu_metodo(self, arg1):
p... | 3.78125 | 4 |
tests/unit/custom/test_table.py | matthewgdv/sqlhandler | 0 | 12795550 | <filename>tests/unit/custom/test_table.py
# import pytest
class TestTable:
def test___new__(self): # synced
assert True
| 1.867188 | 2 |