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 |
|---|---|---|---|---|---|---|
abc/226/a/answer.py | TakuyaNoguchi/atcoder | 0 | 12788051 | X = input()
a, b = X.split('.')
answer = int(a)
if int(b[0]) >= 5:
answer += 1
print(answer) | 3.234375 | 3 |
boj/bruteforce/boj_1107.py | ruslanlvivsky/python-algorithm | 3 | 12788052 | import sys
num = int(sys.stdin.readline().strip())
n = int(sys.stdin.readline().strip())
if n:
btn = sys.stdin.readline().strip().split()
else:
btn = []
result = abs(100 - num)
for i in range(1_000_000):
for j in str(i):
if j in btn:
break
else:
result = min(result, len(st... | 2.5 | 2 |
zagred/tools/receptor.py | kaetaen/zagred | 1 | 12788053 | import speech_recognition
import pyttsx3
class Receptor:
def listen(self):
microphone = speech_recognition.Recognizer()
phrase = ''
with speech_recognition.Microphone() as source:
microphone.adjust_for_ambient_noise(source)
audio = microphone.listen(source)
... | 3.015625 | 3 |
proxygrab/package/__init__.py | Divkix/ProxyGrab | 15 | 12788054 | """initialise main workplace."""
| 0.980469 | 1 |
django_mongoengine/__init__.py | lsaint/django-mongoengine | 0 | 12788055 | from .document import (
Document,
DynamicDocument,
EmbeddedDocument,
DynamicEmbeddedDocument,
)
from .queryset import QuerySet, QuerySetNoCache
__all__ = [
"QuerySet",
"QuerySetNoCache",
"Document",
"DynamicDocument",
"EmbeddedDocument",
"DynamicEmbeddedDocument",
]
# default_a... | 1.679688 | 2 |
test/test_alert_definition_api.py | hpcc-systems/uptrends-python | 0 | 12788056 | # coding: utf-8
"""
Uptrends API v4
This document describes Uptrends API version 4. This Swagger environment also lets you execute API methods directly. Please note that this is not a sandbox environment: these API methods operate directly on your actual Uptrends account. For more information, please visit ... | 1.671875 | 2 |
tests/test_utils.py | jannikluhn/ethereum-accounts | 0 | 12788057 | <filename>tests/test_utils.py<gh_stars>0
import pytest
from ethereum.utils import (
privtoaddr,
privtopub,
)
from eth_utils import (
remove_0x_prefix,
encode_hex,
decode_hex,
is_0x_prefixed,
is_checksum_address,
is_hex,
is_same_address,
)
from eth_accounts import (
random_priv... | 2.453125 | 2 |
Python/Examples/Macros/Tracker_CreatePoints.py | halmusaibeli/RoboDK-API | 0 | 12788058 | <reponame>halmusaibeli/RoboDK-API
# This macro shows how we can take a group of laser tracker measurements
# from a laser tracker and save it to a file
CREATE_MEASUREMENTS = False
# Set the name of the reference frame to add measurements attached to id
REFERENCE_NAME = "Tracker Reference"
#REFERENCE_NAME = None
MEAS... | 2.703125 | 3 |
Python2.x/Python2.x-0-basic/004_loop_1.1_while.py | mrxuyong/Python-dev | 0 | 12788059 | # -*- coding: UTF-8 -*-
# @desc while loop
count = 10
while (count > 0):
print 'the count is:', count;
count = count - 1;
print 'it is over...'
| 3.921875 | 4 |
Q-A.py | lzps/Q-A | 1 | 12788060 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 存在utf8显示问题
import os, random
t = os.listdir(os.path.split(os.path.realpath(__file__))[0])
f, j, csv = [], 0, []
for i in t:
if '.csv' in i:
j = j + 1
f.append(i)
print(str(j) + ' --> ' + i[0:-4])
with open(f[int(input('\n 请选择:... | 2.75 | 3 |
django_mt/mt_core/mysql/base.py | maheshgawali/django-multi-tenancy | 0 | 12788061 | from importlib import import_module
import logging
import time
import json
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
import django.db.backends.mysql.base
WRAPPED_BACKEND = import_module('django.db.backends.mysql.base')
LOGGER = logging.getLogger('django_mt')
def lower_d... | 2.109375 | 2 |
tests/heartbeat_test.py | buraksezer/hazelcast-python-client | 3 | 12788062 | <reponame>buraksezer/hazelcast-python-client<filename>tests/heartbeat_test.py
from hazelcast import HazelcastClient
from hazelcast.core import Address
from tests.base import HazelcastTestCase
from hazelcast.config import ClientConfig, ClientProperties
from tests.util import configure_logging, open_connection_to_address... | 2.203125 | 2 |
digital_badge/urls.py | CSElonewolf/Digital_Badge | 1 | 12788063 | <gh_stars>1-10
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path,include
from . import views
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.home,name='home'),
path('badge/', include('badge.urls')),
]+ s... | 1.515625 | 2 |
Python/URI 1435.py | LGUSTM/URI | 0 | 12788064 | #-*- coding: utf-8 -*-
x = [][]
while True:
n = int(input())
if n == 0:
break;
else:
for i in range(n):
for j in range(n)
x.append(0)
for i in range(n):
for j in range(n)
x.insert(j, +1)
if n-2 > 0:
for i i... | 3.328125 | 3 |
modules/registration.py | diSp1rIt/Bot-channels-info | 0 | 12788065 | <filename>modules/registration.py<gh_stars>0
from telethon import TelegramClient, sync
from cfg_loader import *
client_data = load_configs()
API_ID = client_data['API_ID']
API_HASH = client_data['API_HASH']
client = TelegramClient('bot', API_ID, API_HASH)
client.connect()
loop = None
async def send_code(phone: str) ... | 2.171875 | 2 |
python/ranks.py | alanc10n/snippets | 0 | 12788066 | """
Rank Vectors
Given an array (or list) of scores, return the array of ranks for each value in the array. The largest value has rank 1, the second largest value has rank 2, and so on. Ties should be handled by assigning the same rank to all tied values. For example:
ranks([9,3,6,10]) = [2,4,3,1] and ranks([3,3,3,3,... | 4.15625 | 4 |
src/pcbLibraryManager/libraries/libraryAVR.py | NiceCircuits/pcbLibraryManager | 0 | 12788067 | <reponame>NiceCircuits/pcbLibraryManager
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 2 18:04:03 2015
@author: piotr at nicecircuits.com
"""
from libraryManager.library import libraryClass
from libraryManager.part import part
from footprints.footprintSmdQuad import footprintQfp
from footprints.footprintSmdDualRow ... | 2.03125 | 2 |
tests/utils.py | frwickst/pyhuum | 1 | 12788068 | <reponame>frwickst/pyhuum<filename>tests/utils.py<gh_stars>1-10
from typing import Any
class MockResponse:
def __init__(
self, json_data: dict[str, Any], status_code: int, text: str = ""
) -> None:
self._json = json_data
self._text = text
self.status = status_code
async d... | 2.484375 | 2 |
tests/test_router.py | elizabrock/adventofcode | 0 | 12788069 | import unittest
from day3 import Router, Path, Traveler
class TestRouter(unittest.TestCase):
def test_houses_visited_single_visitor_2(self):
input = '>'
expected = 2
path = Path()
Router.route(input, Traveler(path))
self.assertEqual(expected, path.houses_visited())
def... | 3.640625 | 4 |
src/portfolio/test/test_models.py | dunneff/stock-price-app | 0 | 12788070 | <filename>src/portfolio/test/test_models.py
from django.test import TestCase
from portfolio.models import StockPortfolio, StockPortfolioItem
class StockPortfolioTestCase(TestCase):
def test_portfolio(self):
StockPortfolio.objects.create(title='Test Portfolio')
portfolio = StockPortfolio.objects.get... | 2.390625 | 2 |
tests/case_manager/test_database.py | IfengAutomation/uitester | 4 | 12788071 | # @Time : 2016/9/1 19:09
# @Author : lixintong
import unittest
import time
from uitester.case_manager.database import DBCommandLineHelper, Tag, Case, DB
class TestDataBase(unittest.TestCase):
def setUp(self):
self.db_helper = DBCommandLineHelper()
def test_operate_tag_data(self):
ms_str... | 2.515625 | 3 |
venv/lib/python3.8/site-packages/pylint_django/tests/input/func_noerror_gettext_lazy_format.py | DiegoSilvaHoffmann/Small-Ecommerce | 1 | 12788072 | """
Checks that Pylint does not complain about django lazy proxy
when using gettext_lazy
"""
from django.utils.translation import gettext_lazy
gettext_lazy('{something}').format(something='lala')
| 1.867188 | 2 |
cogs/owner/__init__.py | iomintz/Chiaki-Nanami | 1 | 12788073 | <gh_stars>1-10
"""**For the bot owner only!"""
__hidden__ = True
| 1.203125 | 1 |
debug/debug.py | MacHu-GWU/crawl_trulia-project | 1 | 12788074 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from dataIO import js, textfile
from crawl_trulia import trulia_urlencoder, trulia_htmlparser
from crawl_trulia.packages.crawlib.spider import spider
PATH = "test.html"
address = "22 Yew Rd"
city = "Baltimore"
zipcode = "21221"
# url = urlencoder.by_address_an... | 2.765625 | 3 |
setup.py | K0lb3/pvrtc_decoder | 2 | 12788075 | import os
from setuptools import Extension, setup
try:
from Cython.Build import cythonize
except ImportError:
cythonize = None
extensions = [
Extension(
name="pvrtc_decoder",
version="1.0.2",
author="K0lb3",
author_email="",
description="A PVRTC decoder for PIL",
long_description=open('README.md', 'r... | 1.632813 | 2 |
src/ts_analysis/utilities/func.py | tedchengf/ts_analysis | 1 | 12788076 | # func.py
import numpy as np
from numba import njit, jit, prange
#------------------------ Distance Functions -----------------------#
def corr_dist(A):
return 1 - np.corrcoef(A)
def abs_diff(A):
target_matrix = np.zeros((len(A), len(A)))
mat_dim = target_matrix.shape[0]
for r in range(mat_dim):
for c in ra... | 2.84375 | 3 |
vk_air/objects/pretty.py | sultan1k/vk_air | 5 | 12788077 | <gh_stars>1-10
"""
MIT License
Copyright (c) 2021 sultan1k
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge... | 2.515625 | 3 |
src/data_manager/urls.py | MonkeyApproved/RealEstateScraper | 0 | 12788078 | from django.urls import path, include
from django.views.generic import TemplateView
from rest_framework.schemas import get_schema_view
from rest_framework.routers import DefaultRouter
from . import views
from scraping.xe import PropertyType, Xe
router = DefaultRouter()
router.register(r'load_config', views.LoadConfig... | 1.835938 | 2 |
criticalConnections.py | sarveshbhatnagar/CompetetiveProgramming | 0 | 12788079 | <filename>criticalConnections.py<gh_stars>0
from collections import defaultdict
class Solution:
def criticalConnections(self, connections):
dis = [0] * len(connections)
low = [0] * len(connections)
self.time = 0
res = []
visited = set()
g = defaultdict(list)
... | 3.078125 | 3 |
chapter2/old/10_armed_bandits_UCB/main.py | otaviojacobi/rl_an_introduction | 0 | 12788080 | <gh_stars>0
import matplotlib.pyplot as plt
from ArmedBandit import *
def main():
'''
- ε-greedy policy implementation for a stateless problem
'''
STEPS = 1000
RUNS = 2000
reward_regular, _ = ArmedBanditRunner(STEPS, RUNS, bandits=10, episolon=0.1).run()
reward_UCB, _ = ArmedBanditRunner(... | 2.65625 | 3 |
unittest/employee.py | petsan/coding-challenges | 0 | 12788081 | <filename>unittest/employee.py
import requests
import unittest
from unittest.mock import patch
class TestEmployee(unittest.TestCase):
def setUp(self):
self.emp_1 = Employee('Jane', 'Doe', 50000)
self.emp_2 = Employee('Jim', 'James', 60000)
def tearDown(self):
pass
def... | 3.125 | 3 |
platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/panther/calculators/calc_dsa.py | lmnotran/gecko_sdk | 82 | 12788082 | from pyradioconfig.parts.nixi.calculators.calc_dsa import CALC_DSA_nixi
class CALC_DSA_panther(CALC_DSA_nixi):
pass | 1.195313 | 1 |
amplicons/make-ILMN_V34_primers.py | taejoonlab/microbe-toolbox | 1 | 12788083 | <filename>amplicons/make-ILMN_V34_primers.py
#!/usr/bin/env python3
# Source: https://stackoverflow.com/questions/27551921/how-to-extend-ambiguous-dna-sequence
from Bio import Seq
from itertools import product
def extend_ambiguous_dna(seq):
"""return list of all possible sequences given an ambiguous DNA input"""
... | 2.828125 | 3 |
office365/planner/tasks/check_list_items.py | theodoriss/Office365-REST-Python-Client | 544 | 12788084 | from office365.planner.tasks.check_list_item import PlannerChecklistItem
from office365.runtime.client_value_collection import ClientValueCollection
class PlannerChecklistItems(ClientValueCollection):
"""The plannerChecklistItemCollection resource represents the collection of checklist items on a task.
It is ... | 2.125 | 2 |
main.py | hantabaru1014/youtube_live-highlighter | 0 | 12788085 | import json
import os
import argparse
import re
from comment_getter import CommentGetter
from analyzer import Analyzer
from settings_loader import SettingsLoader
DEFAULT_SETTINGS_JSON_PATH = "default_settings.json"
YOUTUBE_VIDEO_ID_PATTERN = r"\?v=([^&]+)"
def get_timed_link(video_id, sec):
return f"https://www... | 2.671875 | 3 |
neuralpredictors/data/datasets/statics/__init__.py | Shahdsaf/neuralpredictors | 9 | 12788086 | from .base import StaticImageSet
from .filetree import FileTreeDataset
| 1.023438 | 1 |
fwks/stage/stage_misc.py | Zantyr/fwks | 0 | 12788087 | <filename>fwks/stage/stage_misc.py
"""
Things that do not fit elsewhere
"""
from .stage_meta import ToDo, Analytic, DType
from functools import reduce
import numpy as np
class Pointwise(ToDo):
"""
Squash and so on
"""
class LogPower(Analytic):
def __init__(self, negative=True):
self.ne... | 2.296875 | 2 |
bisellium/lib/pagan/pagan.py | colosseum-project/app-bisellium | 0 | 12788088 | from . import generator
import os
MD5 = generator.HASH_MD5
SHA1 = generator.HASH_SHA1
SHA224 = generator.HASH_SHA224
SHA256 = generator.HASH_SHA256
SHA384 = generator.HASH_SHA384
SHA512 = generator.HASH_SHA512
class Avatar:
DEFAULT_OUTPUT_PATH = os.path.join(os.getcwd(), "output/")
DEFAULT_FILENAME = "pagan"... | 3.09375 | 3 |
app/main/routes.py | Island-Daoist/CS50-Project | 0 | 12788089 | from app.main import bp
from app import db
from flask import render_template, url_for, flash, redirect, request, current_app
from flask_login import login_required, fresh_login_required, current_user
from app.main.forms import UpdateProfileForm, StatusForm, MessageForm
from app.models import Users, Status, Messages, Bl... | 2.171875 | 2 |
Codeforces Online Judge Solve/47A - Triangular numbers.py | Remonhasan/programming-solve | 0 | 12788090 | <gh_stars>0
# <NAME>
n = int(input())
triangular = 1
i = 1
while triangular < n:
i += 1
triangular += i
if triangular == n:
print("YES")
else:
print("NO")
| 3.515625 | 4 |
tests/test_views.py | markliederbach/nm-launch-api | 0 | 12788091 | <gh_stars>0
"""
Tests for the nm_launch_api module.
"""
import os
import json
import unittest
from unittest import mock
from werkzeug.datastructures import ImmutableMultiDict
from nm_launch_api import app
from nm_launch_api.api.v1 import views as v1_views
from tests.mock_clients import launch_library
from tests import... | 2.28125 | 2 |
svc/eonbackup.py | undure/eonbackup | 2 | 12788092 | import os
import hashlib
import base64
from binascii import hexlify
import datetime
import getpass
import select
import socket
import sys
import time
import traceback
import json
import logging
import paramiko
import subprocess
import config
from wificlient import get_active_clients
logger = logging.getLogger('eonba... | 2.203125 | 2 |
humanoid_2d/ocp/humanoid_ocp.py | Ipuch/Humanoid2D | 0 | 12788093 | import warnings
import biorbd_casadi as biorbd
import numpy as np
from scipy import interpolate
from bioptim import (
OdeSolver,
Node,
OptimalControlProgram,
ConstraintFcn,
DynamicsFcn,
ObjectiveFcn,
QAndQDotBounds,
QAndQDotAndQDDotBounds,
ConstraintList,
ObjectiveList,
Dyna... | 2.125 | 2 |
LianJia-Crawler/LianJia.py | xrandx/Python-Items | 0 | 12788094 | # 需要安装 openpyxl, pandas, BeautifulSoup
# pip install 即可
import requests
import re
import pandas as pd
from bs4 import BeautifulSoup
region = ['ganjingzi', 'shahekou', 'zhongshan', 'xigang', 'gaoxinyuanqu']
#这个变量里放区域名称的拼音
regnam = ['甘井子', '沙河口', '中山', '西岗', '高新园']#这个变量里放区域名称的中文
page = 5
reTryTime = 5
pr... | 2.84375 | 3 |
Main.py | DNLINYJ/Biilibili_All_Danmu | 13 | 12788095 | from GetAllDanmuInfo_V2 import GetAllDanmuInfo
from GetClearCommandInstruction import GetClearCommandInstruction
from GetVideoTitle import GetVideoTitle
from ExportAllDanmu import ExportAllDanmu
from CheckLoginSituation import CheckLoginSituation
import base64
import Sqlite3_Bilibili
import sys
import os
headers = {
... | 2.3125 | 2 |
utils/build_samplers.py | MoonBlvd/deeplabv3 | 0 | 12788096 | <gh_stars>0
import torch
import samplers
def make_data_sampler(dataset, shuffle, distributed, is_train=True):
# Only do weighted sampling for training
if distributed:
# if is_train:
# return samplers.DistributedWeightedSampler(dataset, shuffle=shuffle)
# else:
return sampler... | 2.34375 | 2 |
app/auth/views.py | kangangi/pitchIP | 1 | 12788097 | <filename>app/auth/views.py
from flask import render_template,redirect,url_for,flash, request
from app.models import User
from .forms import RegistrationForm, LoginForm
from .. import db
from flask_login import login_user, login_required, logout_user
from . import auth
from ..email import mail_message
#Views
@auth.ro... | 2.703125 | 3 |
venv/lib/python3.6/site-packages/ansible_collections/community/hashi_vault/.github/actions/ansible-codecov/process.py | usegalaxy-no/usegalaxy | 1 | 12788098 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, <NAME> (@briantist)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import subprocess
import re
import g... | 2.265625 | 2 |
cellphonedb/src/tests/cellphone_flask_test_case.py | chapuzzo/cellphonedb | 278 | 12788099 | import os
import random
import string
import time
from flask_testing import TestCase
from cellphonedb.src.app.cellphonedb_app import cellphonedb_app
from cellphonedb.src.local_launchers.local_collector_launcher import LocalCollectorLauncher
from cellphonedb.utils import utils
class CellphoneFlaskTestCase(TestCase):... | 2.09375 | 2 |
Python/qaly/qaly.py | rvrheenen/OpenKattis | 12 | 12788100 | <reponame>rvrheenen/OpenKattis
years = int(input())
qaly = 0
for _ in range(years):
q, p = [float(x) for x in input().split()]
qaly += q * p
print(qaly)
| 3.125 | 3 |
bindings/python/hgdb/__init__.py | mithro/hgdb | 0 | 12788101 | try:
from .client import HGDBClient, HGDBClientException
from .symbol import (SymbolTableProvider, VariableSymbol, GeneratorVariableSymbol, ContextVariableSymbol,
BreakpointSymbol)
except ImportError:
pass
from .db import DebugSymbolTable
| 1.34375 | 1 |
scripts/kernelshap_ssd.py | dentou/detex | 1 | 12788102 | <gh_stars>1-10
import warnings
import context
import os
import torchvision
import torchvision.transforms.functional as TF
import torch
import captum
from captum.attr import visualization as captumvis
from detex.models import SSDWrapper
import numpy as np
import argparse
from detex.utils import (
draw_img_boxes,
... | 1.804688 | 2 |
hw3/test.py | danieltsai0/CS294-112-HW3 | 0 | 12788103 | <gh_stars>0
import tensorflow as tf
import numpy as np
x = tf.placeholder(tf.int32, [None])
act_t = tf.one_hot(x, depth=5, on_value=1.0, off_value=0.0, dtype=tf.float32, name="action_one_hot")
y = tf.placeholder(tf.float32, [4,5])
k = tf.reduce_max(tf.multiply(y, act_t), axis=1)
# ind = tf.transpose(tf.stack([tf.to_i... | 2.046875 | 2 |
mandiokito/main.py | alefemoreira/mandiokito | 0 | 12788104 | from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
import re
#from kivy.config import Config
from telas import *
#from kivy.garden.mapview import MapView, MapMarker
from kivy.uix.textinput import TextInput
from kivy.clock import Clock, mainthread
from kivy.uix.popup import Popup
#from pl... | 2.171875 | 2 |
main/courses/exams/tasks.py | csev/class2go | 2 | 12788105 | from celery import task
from c2g.models import ExamRecord, Course, Exam
from django.core.mail import EmailMessage, get_connection
from django.core.mail import send_mail
from storages.backends.s3boto import S3BotoStorage
import json
import settings
import datetime
FILE_DIR = getattr(settings, 'FILE_UPLOAD_TEMP_DIR', '... | 1.984375 | 2 |
src/braket/circuits/noise.py | orclassiq/amazon-braket-sdk-python | 0 | 12788106 | <filename>src/braket/circuits/noise.py
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/... | 3 | 3 |
tests/step_1_unit/test_orbs.py | logikal-code/pyorbs | 7 | 12788107 | from collections import namedtuple
from pytest import fixture, raises
from pyorbs.orbs import Orbs
@fixture
def orbs(tmp_path):
orbs = Orbs(str(tmp_path))
orbs.orbs = ['test']
return orbs
@fixture
def orb(mocker, orbs):
mocker.patch('pyorbs.orbs.exists', return_value=True)
return orbs.orb('tes... | 2.171875 | 2 |
src/preprocess.py | KushalBKusram/AdvancedLaneFinder | 32 | 12788108 | <reponame>KushalBKusram/AdvancedLaneFinder
import cv2
import numpy as np
def grayscale(image):
return cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
def warp(image):
w = image.shape[1]
h = image.shape[0]
src = np.float32([[200, 460], [1150, 460], [436, 220], [913, 220]])
dst = np.float32([[300, 720], [1... | 2.8125 | 3 |
exercises/test_01_05_02.py | rly/nwb-python-course | 8 | 12788109 | def test():
# only check that the code runs and x is in the last line of the solution
assert "nwbfile.acquisition['MyTimeSeries']" in __solution__.strip().splitlines()[-1], "Use the name of the time series to get it from nwbfile.acquisition"
__msg__.good("Nice work!")
| 1.859375 | 2 |
django_giropay/admin.py | ParticulateSolutions/django-giropay | 3 | 12788110 | from django.contrib import admin
from .models import GiropayTransaction
class GiropayTransactionAdmin(admin.ModelAdmin):
list_display = ('merchant_tx_id', 'reference', 'latest_response_code')
list_filter = ('latest_response_code',)
ordering = ('-created_at',)
fields = ('merchant_tx_id', 'reference', ... | 1.679688 | 2 |
tests/test_job.py | jschnurr/scrapyscript | 96 | 12788111 | import pytest
from scrapyscript import Job, Processor, ScrapyScriptException
from spiders import ParamReturnSpider, TitleSpider
def test_job_raises_if_no_spider_provided():
with pytest.raises(TypeError):
Job()
def test_create_valid_job():
spider = TitleSpider
job = Job(spider)
assert isinst... | 2.359375 | 2 |
runut.py | yzhang3beatit/dcdetector | 0 | 12788112 | import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../'))
import unittest
from test import test_rc
if __name__ == '__main__':
SeTestSuite = unittest.defaultTestLoader.discover(start_dir='./')
unittest.TextTestRunner(verbosity=2).run(unittest.TestSuite(SeTestSuite))
| 1.960938 | 2 |
secu/controls/todo_work.py | wancy86/tornado-seed | 0 | 12788113 | from ..base.request import BaseHandler, JsonResponse
from ..base.decrators import handle_request_exception, authenticated
from ..models import Work, PersonInCharge
from sqlalchemy import and_
from common.json import json_by_result
class WorkHandler(BaseHandler):
@authenticated
def post(self):
... | 2.078125 | 2 |
mininet/examples/helpful/exemplo_1/exemplo_1.py | gustavo978/helpful | 0 | 12788114 | <reponame>gustavo978/helpful
from mininet.net import Mininet
from mininet.node import Node, Switch, RemoteController
from mininet.link import Link, Intf
from mininet.log import setLogLevel, info
from mininet.cli import CLI
from p4_mininet import P4Switch, P4Host
import mininet.ns3
from mininet.ns3 import WIFISegment
... | 2.1875 | 2 |
tests/mdts/tests/functional_tests/test_midolman_and_interfaces.py | abel-navarro/midonet | 1 | 12788115 | # Copyright 2014 Midokura SARL
#
# 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 in writing... | 2.046875 | 2 |
src/pyheatintegration/temperature_range.py | tarao1006/pyheatexchanger | 0 | 12788116 | from __future__ import annotations
from .base_range import BaseRange, flatten, get_ranges, merge
class TemperatureRange(BaseRange):
"""温度範囲を表すクラス。"""
BaseRange.register(TemperatureRange)
def merge_temperature_range(
range_: TemperatureRange,
other: TemperatureRange
) -> TemperatureRange:
return m... | 3.15625 | 3 |
Milestone 2 - Blackjack/main.py | spacedrabbit/PythonBootcamp | 1 | 12788117 | import Deck
class Blackjack(object):
def __init__(self):
self.start()
def start(self):
deck = Deck.Deck(1)
deck.display_decks()
Blackjack().start() | 2.375 | 2 |
news.py | stuartelimu/liverpool-bot | 0 | 12788118 | <filename>news.py
import random
import time
from commentary import create_api, NLTK_DATA_PATH
import nltk
nltk.data.path.append(NLTK_DATA_PATH)
import requests
from bs4 import BeautifulSoup
import tweepy
url = 'https://theathletic.com'
tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
HEADERS = {
... | 3.1875 | 3 |
ietf/xml/rfc.py | lafrenierejm/ietf-cli | 0 | 12788119 | import sqlalchemy.orm
import xml.etree.ElementTree
from ietf.sql.rfc import (Abstract, Author, FileFormat, IsAlso, Keyword,
ObsoletedBy, Obsoletes, Rfc, SeeAlso, Stream,
UpdatedBy, Updates,)
import ietf.xml.parse as parse
def _add_keyword(session: sqlalchemy.orm.ses... | 2.359375 | 2 |
python/numericVector.py | radioactivit/big-data | 4 | 12788120 | <filename>python/numericVector.py<gh_stars>1-10
class Vector:
def __init__(self, anIterable):
self.values = list(anIterable)
def assertt(boolean, text=None):
if text is None:
assert boolean
return 0
assert boolean, text
def isFloatOrInteger(aValue):
return isinstance(aValue, ... | 3.453125 | 3 |
2TLCS/web_agent_training.py | GameDisplayer/Deep-QLearning-Multi-Agent-Perspective-for-Traffic-Signal-Control | 1 | 12788121 | <reponame>GameDisplayer/Deep-QLearning-Multi-Agent-Perspective-for-Traffic-Signal-Control
from flask import Flask, request, jsonify
import numpy as np
from memory import Memory
from model import TrainModel
from waitress import serve
#Remove verbose except errors
import logging
log = logging.getLogger('werkzeug')
log... | 2.34375 | 2 |
example/example/urls.py | nicokant/django-htmx | 0 | 12788122 | <gh_stars>0
from django.urls import path
from example.core.views import attribute_test, index
urlpatterns = [
path("", index),
path("attribute-test", attribute_test),
]
| 1.460938 | 1 |
cogs/music.py | dev-shah-2204/discord-music-bot | 0 | 12788123 | <reponame>dev-shah-2204/discord-music-bot
import discord
import youtube_dl
import urllib.request
import re
from asyncio import sleep
from discord.ext import commands
#Static functions/variables that don't need to be in the class
pause_time = {}
playlist = {}
playlist_with_names = {}
FFMPEG_OPTIONS = {
... | 2.921875 | 3 |
Baseline/num_to_words.py | shreyansh26/RevOpiD-IJCNLP-17- | 6 | 12788124 | import re
import pickle
with open('words2num_dict.pickle', 'rb') as handle:
words2num = pickle.load(handle)
num2words = {v: k for k, v in words2num.items()}
freq_raw = []
with open('output.txt') as f:
for i in range(31):
f.readline()
for line in f:
line = re.sub('\[\w+\]', '',... | 3.21875 | 3 |
src/ehr_classification/classifier.py | obi-ml-public/EHR-automatic-event-adjudication | 0 | 12788125 | import os
from pathlib import Path
import numpy as np
import pandas as pd
import spacy
from spacy.compat import pickle
import lz4.frame
from tqdm import tqdm
from tensorflow.keras.callbacks import ModelCheckpoint, TensorBoard, EarlyStopping
from ehr_classification.tokenizer import get_features, get_custom_tokenizer
fro... | 2.140625 | 2 |
write_qpid_json.py | bendoerr/collectd-write-qpid-json | 0 | 12788126 | # The MIT License (MIT)
#
# Copyright (c) 2015 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | 1.289063 | 1 |
stardate/migrations/0010_remove_blog_social_auth.py | blturner/django-stardate | 0 | 12788127 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-10 23:25
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('stardate', '0009_auto_20170301_0155'),
]
operations = [
migrations.RemoveField(
... | 1.460938 | 1 |
smo-install/test/pythonsdk/src/oransdk/policy/policy.py | ShixiongQi/o-ran-ric | 0 | 12788128 | <reponame>ShixiongQi/o-ran-ric
#!/usr/bin/env python3
###
# ============LICENSE_START=======================================================
# ORAN SMO PACKAGE - PYTHONSDK TESTS
# ================================================================================
# Copyright (C) 2021-2022 AT&T Intellectual Property. All r... | 1.476563 | 1 |
curriculum/profile/migrations/0002_profile_photo.py | ro199/Hoja-de-Vida | 0 | 12788129 | # Generated by Django 3.1 on 2020-08-17 21:14
from django.db import migrations, models
import profile.models
class Migration(migrations.Migration):
dependencies = [
('profile', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='profile',
name='pho... | 1.6875 | 2 |
main.py | sguo1123/SimpleMMO-Notifier | 0 | 12788130 | <filename>main.py
"""
SMMO API NOTIFICATIONS
Author: HugTed
Date: 3/25/2022
"""
import sys
import time
from threading import Thread
from tkinter import *
from tkinter import ttk
import requests
from discord_webhook import DiscordWebhook
from win10toast import ToastNotifier
class MyWindow:
def __init_... | 2.75 | 3 |
nssrc/com/citrix/netscaler/nitro/resource/config/protocol/__init__.py | benfinke/ns_python | 2 | 12788131 | __all__ = ['protocolhttpband'] | 1.15625 | 1 |
cobl/lexicon/migrations/0003_dyen_name_data_migration.py | Bibiko/CoBL-public | 3 | 12788132 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def dyenname_to_languagedata(apps, schema_editor):
# move (possible) contents of the DyenName table to
# Language.data["dyen_name"] in preparation for dropping
# DyenName table
DyenName = ap... | 1.976563 | 2 |
分类代表题目/动态规划/股票类型问题/指定K次交易.py | ResolveWang/algorithm_qa | 79 | 12788133 | <reponame>ResolveWang/algorithm_qa<filename>分类代表题目/动态规划/股票类型问题/指定K次交易.py
"""
问题: 假设把股票价格按时间先后顺序存储在数组中,可以最多买卖K次,请问
该股票可能获得的最大利润是多少?
""" | 1.21875 | 1 |
tests/test_api_key.py | Thierryvil/escolhedor-de-filme | 0 | 12788134 | """ Tests File"""
import requests
from website import API_KEY
def test_api_key_is_not_null():
""" Get API_KEY value and compare """
assert API_KEY != None
def test_request_api_key():
""" Test a request with api_key value """
assert requests.get(f'https://api.themoviedb.org/3/movie/76341?api_key={API_K... | 3.046875 | 3 |
python/lib/tensor_embedding.py | ajoudaki/Project2020-seq-tensor-sketching | 7 | 12788135 | <filename>python/lib/tensor_embedding.py
# TENSOR EMBEDDING
from lib.base import *
# a_1...a_t is mapped to index A^{t-1} a_1 + ... + A * a_{t-1} + 1 * a_t
@jitclass(sketchparams_spec + [('pow', nb.int32[:])])
class TE(Sketcher):
# https://github.com/numba/numba/issues/1694
__init__Sketcher = Sketcher.__init... | 2.484375 | 2 |
users/migrations/0007_images_date.py | alerin345/Instagram | 1 | 12788136 | # Generated by Django 3.1.3 on 2020-11-26 02:30
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('users', '0006_auto_20201126_0321'),
]
operations = [
migrations.AddField(
... | 1.828125 | 2 |
transformer/seq2seq.py | christofid/DomainUnderstanding | 0 | 12788137 | <filename>transformer/seq2seq.py
import torch.nn as nn
import torch
class Seq2Seq(nn.Module):
def __init__(self,
encoder,
decoder,
src_pad_idx,
trg_pad_idx,
device):
super().__init__()
self.encoder = encoder
... | 2.6875 | 3 |
projects/views.py | medfiras/Bazinga | 0 | 12788138 | from django import forms
from projects.models import *
from django.views.decorators.csrf import csrf_exempt
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import render
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestC... | 2.09375 | 2 |
github-webhooks/Event.py | srnd/mattermost-code-review | 2 | 12788139 | class Event:
def __init__(self,data,event=None):
assert type(data) is dict, "data is of type {} not dict".format(type(data))
self.data = data
def __getattr__(self, item):
if item not in self.data:
return False
output = self.data[item]
while type(output) is di... | 3.4375 | 3 |
setup.py | karimbahgat/iPandoc | 1 | 12788140 | <gh_stars>1-10
try: from setuptools import setup
except: from distutils.core import setup
setup( long_description=open("README.rst").read(),
name="""iPandoc""",
license="""MIT""",
author="""<NAME>""",
author_email="""<EMAIL>""",
py_modules=['ipandoc'],
url="""http://github.com/karimbahgat/iPandoc""",
version="... | 1.398438 | 1 |
thinkutils_plus/common/think_hashlib.py | ThinkmanWang/thinkutils_plus | 0 | 12788141 | import os
import sys
import hashlib
import requests
def md5_str(szText):
return str(hashlib.md5(szText).hexdigest())
def MD5(szText):
m = hashlib.md5()
m.update(szText)
return m.digest()
def md5_file(filePath):
with open(filePath, 'rb') as fh:
m = hashlib.md5()
whi... | 2.953125 | 3 |
lib/efelMeasurements.py | ForthePareto/SpikOpt | 0 | 12788142 | import math
import warnings
from collections import OrderedDict
from enum import Enum
import efel
import matplotlib.pyplot as plt
import numpy as np
from lib.Model import Model
from lib.NrnModel import NrnModel
class Level(Enum):
HIGH = 0.5
MID = 5.0
LOW = 10.0
VLOW = 50.0
EFEL_NAME_MAP = {
... | 2.21875 | 2 |
tests/test_svg.py | topology-gg/caistring | 6 | 12788143 | <filename>tests/test_svg.py
import pytest
import os
from starkware.starknet.testing.starknet import Starknet
import asyncio
from random import choices
@pytest.mark.asyncio
async def test_svg ():
starknet = await Starknet.empty()
print()
#
# Test tpg svg
#
contract_tpg = await starknet.deploy('... | 2.328125 | 2 |
fruit_classification_cnn.py | marshall4471/fruit_prediction_from_the_fruits_360datset | 0 | 12788144 | <reponame>marshall4471/fruit_prediction_from_the_fruits_360datset
# -*- coding: utf-8 -*-
"""fruit_classification_cnn.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1Aofwv5h3BbHf_PoSantjIgg6AlbvMsCK
"""
from keras.models import Sequenti... | 2.4375 | 2 |
downpour_downloader/downloader.py | ErinMorelli/em-downpour-downloader | 5 | 12788145 | <gh_stars>1-10
"""
Copyright (C) 2021 <NAME>.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in t... | 2 | 2 |
tests/unit/identity_parser_test.py | vrepsys/blockstats | 5 | 12788146 | <gh_stars>1-10
import json
import pytest
from blockstats import parser
def test_parse_subdomain_identity():
assert parser.parse_identity('val.id.blockstack') == \
{'address': 'val.id.blockstack', 'namespace': 'blockstack', 'name': 'id', 'subdomain': 'val'}
def test_parse_name_identity():
assert parser.... | 2.359375 | 2 |
mylibs/dnslib.py | NobuyukiInoue/pyDNSdump | 0 | 12788147 | # -*- coding: utf-8 -*-
import mylibs.recordtype
def is_ipv4_addr(resolvstr):
flds = resolvstr.split(".")
if len(flds) != 4:
return False
for oct in flds:
if not oct.isdecimal():
return False
if int(oct) < 0 or int(oct) > 255:
return False
return True
... | 2.625 | 3 |
App/Blockchain/blockchain.py | ptenteromano/Blockchain-Tech | 0 | 12788148 | # Implementatin of our blockchain
# <NAME>
# Object Oriented blockchain
# The container + chain where our blocks live
# Bring in some needed libraries
from datetime import datetime
import hashlib
import json
from urllib.parse import urlparse
import requests
from timeit import default_timer as timer
class Blockchain... | 3.3125 | 3 |
crawler/qq_music/crawler.py | MerleLiuKun/daily_mail | 0 | 12788149 | """
Get singer songs by qq music.
Refer: https://github.com/yangjianxin1/QQMusicSpider
``` bash
cd crawler/qq_music
python crawler.py initdb
python crawler.py crawler -s {singer_mid}
```
"""
import sqlite3
import sys
import time
import click
import requests
from requests.adapters import ... | 2.71875 | 3 |
admin_tweaks/image.py | RRMoelker/django-admin-tweaks | 0 | 12788150 | <reponame>RRMoelker/django-admin-tweaks<filename>admin_tweaks/image.py<gh_stars>0
# -*- coding: utf-8 -*-
from easy_thumbnails.files import get_thumbnailer
def icon_view(image_field):
"""Create thumbnail for use in admin list display"""
alias = 'admin_preview'
if not image_field:
return "no image"
thumb = get_th... | 1.914063 | 2 |