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 |
|---|---|---|---|---|---|---|
todo/api/mock_helper.py | devord/todo | 0 | 12768151 | <gh_stars>0
import random
from faker import Faker
from faker.providers import lorem
from api.models import Label, Item
def random_subset(elements):
return random.sample(elements, k=int(random.triangular(0, len(elements), 2)))
def generate_mock_data(num_labels, num_items):
fake = Faker()
fake.add_provi... | 2.671875 | 3 |
setup.py | mechanicalsea/pytorch-light | 1 | 12768152 | <filename>setup.py
"""Step-by-step upload to pypi.org: https://pypi.org/project/pytorchlight/
Overview:
1. Ensuring the requirements of update
- `setuptools` and `wheel`: python -m pip install --user --upgrade setuptools wheel
- `twine`: python -m pip install --user --upgrade twine
- an account of pypi.org
2. Gen... | 2.140625 | 2 |
setup.py | mkorpela/judas | 3 | 12768153 | #!/usr/bin/env python
from distutils.core import setup
import os
from setuptools import find_packages
name = '<NAME>'
# I might be just a little bit too much afraid of those bots..
address = name.lower().replace(' ', '.')+chr(64)+'gmail.com'
setup(name='robpy',
version='0.1',
description='Test runner - R... | 1.351563 | 1 |
Chapter1/sumoftwodice.py | galinadychko/IntroToPython | 0 | 12768154 | import random
import stdio
a = random.randrange(1, 7)
b = random.randrange(1, 7)
stdio.writeln("Sum after rolling 2 dices: " + str(a) + " + " + str(b) + " = " + str(a + b))
| 3.21875 | 3 |
gui/searchAllDialog.py | JoachimCoenen/Datapack-Editor | 1 | 12768155 | import re
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional, Sequence, Union
from PyQt5.QtCore import QEventLoop, pyqtSignal, QTimer
from PyQt5.QtGui import QKeySequence
from PyQt5.QtWidgets import QDialog, QWidget, QApplication
from Cat.CatPythonGUI.GUI import CORNERS, Python... | 1.796875 | 2 |
tests/test_paypalutil.py | TreZc0/donation-tracker | 39 | 12768156 | <reponame>TreZc0/donation-tracker
from django.test import TestCase
from paypal.standard.ipn.models import PayPalIPN
from tracker import paypalutil
class TestVerifyIPNRecipientEmail(TestCase):
def test_match_is_okay(self):
ipn = PayPalIPN(business='<EMAIL>')
paypalutil.verify_ipn_recipient_email(... | 2.25 | 2 |
tabler_icons/templatetags/tabler_icons.py | alex-oleshkevich/python-tabler-icons | 0 | 12768157 | <reponame>alex-oleshkevich/python-tabler-icons<gh_stars>0
from __future__ import annotations
from django import template
from django.utils.safestring import SafeString, mark_safe
from ..icons import Stringable, get_icon
register = template.Library()
@register.simple_tag
def tabler_icon(name: str, size: Stringable ... | 2.3125 | 2 |
cozy/polynomials.py | mernst/cozy | 188 | 12768158 | <reponame>mernst/cozy
"""Class for representing polynomials of one variable."""
import functools
@functools.total_ordering
class Polynomial(object):
__slots__ = ("terms",)
def __init__(self, terms=()):
terms = list(terms)
while terms and (terms[-1] == 0):
terms.pop()
self.... | 3.265625 | 3 |
src/pybel/io/exc.py | tehw0lf/pybel | 0 | 12768159 | <filename>src/pybel/io/exc.py
# -*- coding: utf-8 -*-
"""Exceptions for input/output."""
from ..exceptions import PyBELWarning
import_version_message_fmt = 'Tried importing from PyBEL v{}. Need at least v{}'
class ImportVersionWarning(PyBELWarning, ValueError):
"""Raised when trying to import data from an old ... | 2.53125 | 3 |
pyfocal/ui/viewer.py | eteq/pyfocal | 0 | 12768160 | <reponame>eteq/pyfocal<gh_stars>0
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ..third_party.qtpy.QtCore import *
from ..third_party.qtpy.QtWidgets import *
from .qt.mainwindow import Ui_MainWindow
from .qt.plotsubwindow import Ui_SpectraSubWindow
f... | 1.859375 | 2 |
Algorithms/Easy/697. Degree of an Array/answer.py | KenWoo/Algorithm | 0 | 12768161 | <reponame>KenWoo/Algorithm<gh_stars>0
from typing import List
class Solution:
def findShortestSubArray(self, nums: List[int]) -> int:
a_min = m = len(nums)
if m == 0:
return 0
dict = {}
items = {}
for i in range(m):
n = nums[i]
if n not ... | 3.28125 | 3 |
sstcam_sandbox/d181123_tf_cell_check/apply_tf.py | watsonjj/CHECLabPySB | 0 | 12768162 | from subprocess import call
import os
from sstcam_sandbox.d181123_tf_cell_check import TF_Storage, \
TF_Sampling, all_files
def process(file, tf):
r0_path = file.r0_path
r1_name = os.path.basename(r0_path).replace("_r0", "_r1")
r1_path = os.path.join(tf.r1_dir, r1_name)
ped_path = file.ped_path
... | 2.265625 | 2 |
Algorithms/string_generator/string_generator.py | TeacherManoj0131/HacktoberFest2020-Contributions | 256 | 12768163 | <reponame>TeacherManoj0131/HacktoberFest2020-Contributions
import string,random
def string_generator(size, chars):
return ''.join(random.choice(chars) for _ in range(size))
def get_option(option):
if option == 'alphabet':
characters = string.ascii_uppercase + string.ascii_lowercase + ... | 3.6875 | 4 |
gym_trading/envs/simulator.py | AdrianP-/gym_trading | 109 | 12768164 | <reponame>AdrianP-/gym_trading<filename>gym_trading/envs/simulator.py<gh_stars>100-1000
import numpy as np
import pandas as pd
from .feature_engineering import FeatureEngineering
class Simulator(object):
def __init__(self, csv_name, train_split, dummy_period=None, train=True, multiple_trades=False):
if "E... | 2.90625 | 3 |
usaspending_api/recipient/migrations/0005_auto_20180723_1753.py | truthiswill/usaspending-api | 0 | 12768165 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-07-23 17:53
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipient', '0004_dunsprops'),
]
... | 1.695313 | 2 |
python/image_processor.py | devonlee111/Basic-Neural-Net | 0 | 12768166 | import os
import sys
from PIL import Image
numArgs = len(sys.argv)
if numArgs < 3:
print "Not Enough Arguments\n"
sys.exit()
elif numArgs == 4:
print "Not Enough Arguments\n"
sys.exit()
elif numArgs > 5:
print "Too many arguments\n"
sys.exit()
path = sys.argv[1]
outFile = open(sys.argv[2], "w+")
try:
image... | 2.90625 | 3 |
core/migrations/0030_greatmedia.py | uktrade/directory-cms | 6 | 12768167 | <reponame>uktrade/directory-cms<gh_stars>1-10
# Generated by Django 2.2.24 on 2021-10-05 14:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailmedia', '0003_copy_media_permissions_to_collections'),
('core'... | 1.734375 | 2 |
tools/autogenerate.py | Boldie/simple-youtube-api | 39 | 12768168 | import os
import sys
import argparse
import json
import re
SCHEMA_PATH = os.path.abspath("../resources/schema")
def main():
parser = argparse.ArgumentParser(description="Do stuff")
parser.add_argument("--schema", default=None)
arguments = parser.parse_args()
schema_file = arguments.schema
schema_... | 3.015625 | 3 |
source/infrastructure/personalize/step_functions/filter_fragment.py | turnoutnow/maintaining-personalized-experiences-with-machine-learning | 1 | 12768169 | # ######################################################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | 1.484375 | 1 |
sklearntools/sym/sym_transform_parts.py | modusdatascience/sklearntools | 2 | 12768170 | <reponame>modusdatascience/sklearntools<gh_stars>1-10
from .base import call_method_or_dispatch, fallback, create_registerer
from .parts import double_check
from .syms import syms
from .sym_transform import sym_transform
def sym_transform_parts_base(obj, target=None):
return (syms(obj), sym_transform(obj), target)... | 2.125 | 2 |
sdk/eventhub/azure-eventhubs/azure/eventhub/_eventprocessor/event_processor.py | mjudeikis/azure-sdk-for-python | 0 | 12768171 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 2.03125 | 2 |
src/dynamic_graph/entity.py | florent-lamiraux/dynamic-graph-python | 0 | 12768172 | """
Copyright (C) 2010 CNRS
Author: <NAME>, <NAME>
"""
import wrap, signal_base, new
from attrpath import setattrpath
if 'display' not in globals().keys():
def display(s):
print(s)
# --- FACTORY ------------------------------------------------------------------
# --- FACTORY -------------------------... | 2.578125 | 3 |
tests/integ/test_record_set.py | LastRemote/sagemaker-python-sdk | 1,690 | 12768173 | <filename>tests/integ/test_record_set.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... | 2.1875 | 2 |
lib/fetchListToAdd.py | mwoolweaver/listManager.py | 1 | 12768174 | #!/usr/bin/env python3
#
# Project homepage: https://github.com/mwoolweaver
# Licence: <http://unlicense.org/>
# Created by <NAME> <<EMAIL>>
# ================================================================================
import pandas
from lib.debug import debuginfo, debuginfoDBV, debuginfoDBVV, debuginfoDBVVV, sql... | 2.703125 | 3 |
bin/rstrip.py | cwickham/merely-useful.github.io | 190 | 12768175 | #!/usr/bin/env python
'''
Strip trailing whitespaces from lines.
Usage: rstrip.py file file...
'''
import sys
def main(filenames):
for f in filenames:
with open(f, 'r') as reader:
lines = reader.readlines()
lines = [x.rstrip() + '\n' for x in lines]
with open(f, 'w') as writ... | 3.515625 | 4 |
loca-testing/scripts/015_myway_test.py | crutchwalkfactory/jaikuengine-mobile-client | 0 | 12768176 | <filename>loca-testing/scripts/015_myway_test.py
execfile("_general.py")
execfile("015_myway.py")
def test_myway() :
dev=dict()
general=dict()
general['nodename']='<NAME>'
general['time']=local_to_unixtime(8, 8, 47)
msg=dict()
msg['successcount']=3
res = myway(general, dev, msg)
print res
print "\n----\n\... | 1.671875 | 2 |
codewars/ValidBraces.py | 1067511899/tornado-learn | 1 | 12768177 | '''
Write a function that takes a string of braces, and determines if the order of the braces is valid. It should return true if the string is valid, and false if it's invalid.
This Kata is similar to the Valid Parentheses Kata, but introduces new characters: brackets [], and curly braces {}. Thanks to @arnedag for th... | 4.40625 | 4 |
doc/source/conf.py | mmmspatz/sexpdata | 31 | 12768178 | # -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ----------------------------------------------------
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
]
# Add any paths that contain templates here, relative to this directory.... | 1.8125 | 2 |
integrations/tensorflow_v1/classification.py | clementpoiret/sparseml | 922 | 12768179 | <filename>integrations/tensorflow_v1/classification.py<gh_stars>100-1000
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License a... | 1.882813 | 2 |
Advanced_exams/16december_2020/Matching_Problem.py | petel3/Softuni_education | 2 | 12768180 | from collections import deque
matches_count=0
males=[int(el) for el in input().split() if int(el)>0]
females=deque([int(el) for el in input().split() if int(el)>0])
while males and females:
if males[-1] % 25 == 0 or females[0] % 25 == 0:
if males[-1] % 25 == 0:
males.pop()
if females[0]... | 3.390625 | 3 |
gym_delta_robot_trampoline/envs/delta_robot_trampoline_env.py | RicoJia/delta_robot_trampoline | 3 | 12768181 | import gym
import pybullet as p
import numpy as np
from gym_delta_robot_trampoline.resources.delta_robot_trampoline import Omnid_Simulator
import matplotlib.pyplot as plt
import os
import pybullet_data
"""
Action space (1,3) : [theta_1_torque, theta_2_torque, theta_3_torque]
Observation space (1,18) : [3 joint_positio... | 2.515625 | 3 |
day04zy.py | aixiaocha/test | 0 | 12768182 | #EP1
'''
def getPentagonalNumber(n):
i = 1
for i in range(1,n+1):
s = (i*(3*i-1)*1.0)/2
print (str(s)+' ',end='')
if i%10==0:
print()
getPentagonalNumber(100)
'''
#EP2
'''
def sum(n):
s= 0
while(n%10!=0):
a=n%10
b=n//10
s=s+a
n=b
p... | 3.734375 | 4 |
cc_licenses/urls.py | brylie/cc-licenses | 1 | 12768183 | """cc_licenses URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | 2.46875 | 2 |
python__OOP/04.classes_and_instances_exercise/01.point.py | EmilianStoyanov/Projects-in-SoftUni | 1 | 12768184 | <filename>python__OOP/04.classes_and_instances_exercise/01.point.py
import math
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def set_x(self, new_x):
self.x = new_x
def set_y(self, new_y):
self.y = new_y
def distance(self, x, y):
xx = abs(self.... | 4.0625 | 4 |
typhon/nano/smallcaps.py | justinnoah/typhon | 63 | 12768185 | from rpython.rlib.rbigint import BASE10
from typhon.nano import checkpoints
from typhon.quoting import quoteChar, quoteStr
def doNanoSmallCaps(expr):
expr = checkpoints.AddCheckpoints().visitExpr(expr)
expr = checkpoints.CollectCheckpoints().visitExpr(expr)
return expr
class PrettySmallCaps(checkpoints.C... | 2.1875 | 2 |
apps/user/views/registration.py | dy1zan/softwarecapstone | 0 | 12768186 | <reponame>dy1zan/softwarecapstone
"""
Registration views: GET & POST (submitting form data)
"""
from django.conf import settings
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.template.loader import render_to_string
from django.urls impo... | 2.890625 | 3 |
django_rq_jobs/management/commands/rqjobs.py | Koed00/Django-RQ-Jobs | 0 | 12768187 | <reponame>Koed00/Django-RQ-Jobs<filename>django_rq_jobs/management/commands/rqjobs.py
from ast import literal_eval
import importlib
import arrow
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext_lazy as _
import django_rq
from django_rq_... | 2.03125 | 2 |
authors/apps/authentication/renderers.py | AmosWels/ah-django | 0 | 12768188 | import json
from authors.apps.core.renderers import AuthorsJSONRenderer
class UserJSONRenderer(AuthorsJSONRenderer):
object_label = 'user'
| 1.570313 | 2 |
django_csv/admin.py | yunojuno/django-queryset-csv | 0 | 12768189 | from django.contrib import admin
from .models import CsvDownload
class CsvDownloadAdmin(admin.ModelAdmin):
list_display = ("user", "timestamp", "row_count", "filename")
list_filter = ("timestamp",)
search_fields = ("user", "filename")
raw_id_fields = ("user",)
readonly_fields = (
"user",
... | 1.765625 | 2 |
deepchem/splits/__init__.py | cjgalvin/deepchem | 3,782 | 12768190 | <gh_stars>1000+
"""
Gathers all splitters in one place for convenient imports
"""
# flake8: noqa
# basic splitter
from deepchem.splits.splitters import Splitter
from deepchem.splits.splitters import RandomSplitter
from deepchem.splits.splitters import RandomStratifiedSplitter
from deepchem.splits.splitters import Rand... | 1.867188 | 2 |
profit/run/default.py | Rykath/profit | 14 | 12768191 | """ Default Runner & Worker components
Local Runner
Memmap Interface (numpy)
Template Preprocessor
JSON Postprocessor
NumpytxtPostprocessor
HDF5Postprocessor
"""
from .runner import Runner, RunnerInterface
from .worker import Interface, Preprocessor, Postprocessor, Worker
import subprocess
from multiprocessing impor... | 2.09375 | 2 |
full-problems/amq1.py | vikas-t/DS-Algo | 0 | 12768192 | <filename>full-problems/amq1.py
# Question #1
def find_all_paths(graph, start, end, path=[]):
path = path + [start]
if start == end:
return [path]
if not graph.has_key(start):
return []
paths = []
for node in graph[start]:
if node not in path:
newpaths = find_all_paths(graph, ... | 3.296875 | 3 |
pythonProject/venv/Lib/site-packages/workbook/__init__.py | MontanhaRio/python | 0 | 12768193 | <filename>pythonProject/venv/Lib/site-packages/workbook/__init__.py
#!/usr/bin/env python
from xlwt import Workbook as _WB_, Font, XFStyle, Borders, Alignment
def print_table(data, title="", bold=True):
'''fancy ascii table'''
maxs = []
for row in data:
for i, cell in enumerate(row):
... | 3.125 | 3 |
neuralcompression/layers/_generalized_divisive_normalization.py | tallamjr/NeuralCompression | 233 | 12768194 | <reponame>tallamjr/NeuralCompression
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import functools
from typing import Callable, Optional
import torch
import torch.nn.functional
from to... | 2.65625 | 3 |
examples/sample_experiment.py | clark-mask/EvasionPaths | 2 | 12768195 | # <NAME> 3/5/20
import os
from time_stepping import *
num_sensors: int = 20
sensing_radius: float = 0.2
timestep_size: float = 0.01
unit_square: Boundary = RectangularDomain(spacing=sensing_radius)
# noinspection PyTypeChecker
billiard: MotionModel = BilliardMotion(dt=timestep_size, boundary=unit_square, vel=1, n_in... | 3.171875 | 3 |
tests/input.py | ExObsSim/Rapoc-public | 0 | 12768196 | <reponame>ExObsSim/Rapoc-public
exomol_file = 'test_data/1H2-16O__POKAZATEL__R15000_0.3-50mu.xsec.TauREx.h5'
dace_file = 'test_data/1H2-16O__POKAZATEL_e2b'
| 0.851563 | 1 |
exercise01/src/util.py | aWdas/self-organising-systems-2021 | 0 | 12768197 | from Bio import pairwise2
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.pairwise2 import format_alignment
adjacency_list = {
"A": {"R", "W", "M"},
"G": {"R", "K", "S"},
"T": {"W", "K", "Y"},
"C": {"M", "S", "Y"},
"R": {"D", "V"},
"W": {"D", "H"},
"M": {"V", "H"},
... | 2.75 | 3 |
src/pythonFEA/constraints/__init__.py | honzatomek/pythonFEA | 0 | 12768198 | from .constraint.nodal import Suppress, Prescribe
| 1.039063 | 1 |
python_scripts/11-colored_circles.py | mohammedbehjoo/DigitalFUTURES-Developing-Costum-Components-in-Grasshopper-with-Python | 1 | 12768199 | import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
import System.Drawing as sd
import Rhino.RhinoDoc as rr
import scriptcontext as sc
sc.doc=rr.ActiveDoc
def createColoredPoint(x,y,z,r,g,b):
currentColor = [r,g,b]
pt = rs.AddPoint(x,y,z)
rs.ObjectColor(pt, currentColor)
rs.EnableRe... | 2.203125 | 2 |
03-Template-basics/05-url_for-help-func.py | alehpineda/flask_bootcamp | 0 | 12768200 | from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('home.html')
@app.route('/puppy/<name>')
def pup_name(name):
return render_template('puppy.html', name=name)
if __name__ == "__main__":
app.run(debug=True)
| 2.5625 | 3 |
src/test/chirc/tests/common.py | Schrotty/sIRC | 0 | 12768201 | <reponame>Schrotty/sIRC
import os
import random
import re
import shutil
import subprocess
import tempfile
import time
import chirc.replies as replies
import pytest
from chirc.client import ChircClient
from chirc.types import ReplyTimeoutException
class IRCSession():
def __init__(self, chirc_exe=None, msg_timeou... | 2.296875 | 2 |
krankenfinder/preprocessor.py | tuxedocat/ntcir13-medweb | 0 | 12768202 | <gh_stars>0
"""Perform pre-process such as normalization by rules"""
import pandas as pd
import re
import functools
def apply_ja(s: str) -> str:
return s
def _ja_split_sentence(s: str) -> str:
return s
def _ja_normalize(s: str) -> str:
return s
| 2.734375 | 3 |
api/lib/mysqlclient/MySQL.py | NLeRoy917/indcovid | 0 | 12768203 | <gh_stars>0
import MySQLdb
import sys
import time
class MySQL():
"""
Python interface for the mysql database running on AWS EC2.
"""
def __init__(self, server, user, password, database='indcovid', port=3306):
"""
init function for the class - runs when you create an instance of the cl... | 3.40625 | 3 |
optim/optimizer.py | aiwizzard/text2text | 0 | 12768204 | <reponame>aiwizzard/text2text
import torch.optim as optim
class ScheduledOptimizer:
def __init__(
self, optimizer: optim.Optimizer, factor=2, model_dim=2048, warmup=4000
):
super(ScheduledOptimizer, self).__init__()
self.optimizer = optimizer
self.factor = factor
self.m... | 2.5 | 2 |
tests/web/user_api_test.py | Darkheir/TibetanBrownBear | 9 | 12768205 | """Tests for the User API."""
import json
import time
import jwt
import pytest
from yeti.auth.local import user_management
from yeti.common.config import yeti_config
from yeti.webapp import app
app.testing = True
client = app.test_client()
# pylint: disable=fixme
# TODO: Consider using pytest-flask for easier test... | 2.390625 | 2 |
NPTEL-Course-Lecture Programmes/KmaxKmin.py | Slow-Rain/NPTEL-The-Joy-of-Computing-using-Python | 29 | 12768206 | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 19 13:45:46 2021
@author: <NAME>
"""
mylist=input().split()
k=int(input())
k1=k
mylist1=mylist
mylist1.sort()
mylist.sort()
max1=max(mylist1)
#print(mylist,mylist1)
#remove k-1th max from list1 and print max
while(k1-1!=0):
while(max(mylist1)==max1):... | 3.203125 | 3 |
sila_library/sila2lib/sila_service_detection.py | lemmi25/sila2lib | 0 | 12768207 | <reponame>lemmi25/sila2lib
"""
________________________________________________________________________
:PROJECT: SiLA2_python
*SiLA device detection library*
:details: SiLA Device detection is based on zeroconf / bonjour.
s. zeroconf documentation for details.
server looks for services in local ... | 2.1875 | 2 |
activeClassifier/tools/test_tf_tools.py | dHonerkamp/ActiveClassifier | 0 | 12768208 | import numpy as np
import tensorflow as tf
from tools.tf_tools import binary_entropy, repeat_axis
class EntropyTest(tf.test.TestCase):
def test_binary_entropy_logits(self):
H1 = binary_entropy(logits=[0., 0.]) # i.e. sigmoid(logits) = 0.5
H0 = binary_entropy(logits=[100., -100.])
with s... | 2.53125 | 3 |
users/migrations/0005_auto_20210404_0058.py | hanahamberno/project-a-23 | 0 | 12768209 | <filename>users/migrations/0005_auto_20210404_0058.py
# Generated by Django 3.1.7 on 2021-04-04 00:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0004_auto_20210404_0050'),
]
operations = [
migrations.AlterModelOptions(
... | 1.53125 | 2 |
uniformConfig/UCStructure/DSField.py | apointea/config-normalizer | 0 | 12768210 | # @Author: <NAME> <kalif>
# @Date: 2017-03-27T01:27:02+02:00
# @Email: <EMAIL>
# @Filename: UCSField.py
# @Last modified by: kalif
# @Last modified time: 2017-04-04T00:51:36+02:00
from ..UCException import *
from ..UCValidators import *
from .Interface import *
class DSField(Interface):
def initDS(self, cn... | 2.46875 | 2 |
api/serializers.py | IronTooch/bounca | 0 | 12768211 | """Serializers for Certificate API"""
import django_countries
from dj_rest_auth.serializers import UserDetailsSerializer
from django.contrib.auth import password_validation
from django_countries.serializers import CountryFieldMixin
from rest_framework import serializers
from certificate_engine.types import Certificat... | 2.203125 | 2 |
dota2crawler/__init__.py | co2y/Wallpaper-Crawler | 0 | 12768212 | # coding=utf-8
__author__ = 'co2y'
__email__ = '<EMAIL>'
__version__ = '0.0.1'
| 0.972656 | 1 |
parse.py | Algy/Attrobject | 0 | 12768213 | # coding: utf-8
def parse_pattern(s):
try:
if s.startswith(u"**"):
return u"varkwd", None, s[2:]
elif s.startswith(u"*"):
return u"vararg", None, s[1:]
elif u"#" in s:
idx = s.rindex("#")
tag_str = s[idx + 1:]
name = s[:idx]
... | 2.890625 | 3 |
testapp/tests.py | tomi77/django-evostream | 6 | 12768214 | <reponame>tomi77/django-evostream<filename>testapp/tests.py<gh_stars>1-10
import json
import os
import django
from pyems.protocols import HTTPProtocol
from evostream.default import api
os.environ['DJANGO_SETTINGS_MODULE'] = 'testapp.settings'
if hasattr(django, 'setup'):
django.setup()
try:
from unittest im... | 2.140625 | 2 |
char_samples_gen.py | Baiy97/Ultra_light_OCR_No.5 | 1 | 12768215 | <reponame>Baiy97/Ultra_light_OCR_No.5
import os
import cv2
import numpy as np
from tqdm import tqdm
image_dir = 'data/train_data/TrainImages/'
gt_txt = 'data/train_data/LabelTrain.txt'
gt_dict = dict()
with open(gt_txt, 'r') as f:
lines = f.readlines()
for line in lines:
line = line.strip().split('\t... | 2.375 | 2 |
framedata.py | jgreer013/pymcc | 0 | 12768216 | import mss
import cv2
import numpy as np
class FrameData():
def __init__(self, fileName: str, controllerState: list, imageData):
self.fileName = fileName
self.controllerState = controllerState
self.imageData = imageData
def save(self, outfile):
self.imageData.save(self.fileNam... | 2.6875 | 3 |
apcsp/labs/bank/util.py | wiisportsresort/apcsp-labs | 0 | 12768217 | <reponame>wiisportsresort/apcsp-labs<gh_stars>0
from typing import Dict, Literal
id_counters: Dict[str, int] = {}
def create_id(namespace: str) -> str:
assert len(namespace) > 0, "Namespace cannot be empty"
if namespace not in id_counters:
id_counters[namespace] = -1
id_counters[namespace] += 1
... | 3.3125 | 3 |
userbot/modules/utils/user.py | ZJRDroid/PaperplaneRemix | 0 | 12768218 | <reponame>ZJRDroid/PaperplaneRemix<gh_stars>0
""" Userbot module for getting info
about any user on Telegram(including you!). """
from telethon.events import NewMessage
# from userbot import spamwatch
from userbot.events import register
from userbot.utils import parse_arguments, get_user_from_event
from userbot.u... | 2.359375 | 2 |
brain/src/common/mqtt_client.py | siddharthkundu/raspberry-pi-os-image-builder | 0 | 12768219 | <filename>brain/src/common/mqtt_client.py
from typing import Any, Callable, Dict, Tuple
from concurrent.futures import Future
import os
import threading
import re
import logging
from awscrt import io, mqtt
from awsiot import mqtt_connection_builder
from common.log_event import Logger
from common.config import Config
... | 2.265625 | 2 |
bmch/fileio.py | romainmartinez/bmch | 1 | 12768220 | # -*- coding: utf-8 -*-
"""fileio module."""
import pandas as pd # create_conf_file
import csv # write_conf_header, create_conf_file
import json # create_conf_file
import os # read_c3d_file
import btk # C3D class
import bmch # C3D class
import numpy as np # C3D class
def write_conf_header(metadata_path):
"... | 2.59375 | 3 |
QASMParser/codegraph/errors.py | oerc0122/QASMParser | 5 | 12768221 | <reponame>oerc0122/QASMParser
"""
Errors relating to partitioning
"""
# Partitioning
partitionWarning = ("Partitioning suggests no partitions.\n"
"Recommend running with different partitioning method or disable partitioning")
| 1.421875 | 1 |
scripts/python/merge_annotations.py | BradhamLab/scPipe | 0 | 12768222 | import pandas as pd
def combine_reciprocal_hits(keep_df, other_df):
"""
"""
missed_samples = set(other_df.index.values).difference(
set(keep_df.index.values))
for each in missed_samples:
hit = other_df.loc[each, 'B_id']
if hit not in keep_df['B_id'].values:
... | 2.53125 | 3 |
bin/blockchain/deploy-smart_contract.py | tchiunam/blockchain-alpha | 1 | 12768223 | import argparse
import getpass
import json
import os
import subprocess
import sys
from axolpy import configuration, logging, solidity
from web3 import Web3
def init_arg_parser() -> argparse.ArgumentParser:
"""
Initialize argument parser.
:return: An argument parser for inputs.
:rtype: :class:`argpar... | 2.453125 | 2 |
src/constants.py | devJWSong/transformer-nmt-pytorch | 5 | 12768224 | import torch
# Path or parameters for data
DATA_DIR = 'data'
SP_DIR = f'{DATA_DIR}/sp'
SRC_DIR = 'src'
TRG_DIR = 'trg'
SRC_RAW_DATA_NAME = 'raw_data.src'
TRG_RAW_DATA_NAME = 'raw_data.trg'
TRAIN_NAME = 'train.txt'
VALID_NAME = 'valid.txt'
TEST_NAME = 'test.txt'
# Parameters for sentencepiece tokenizer
pad_id = 0
sos_... | 2.140625 | 2 |
function.py | gvangool/wapi | 1 | 12768225 | <reponame>gvangool/wapi
# -*- coding: utf-8 -*-
# Copyright (c) 2008 <NAME> <<EMAIL>>
# 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 r... | 1.90625 | 2 |
Project - Biometric Face Recognition Attendance/signup.py | Shakir-Ali/Attendance-System-Using-Face-Recognition | 1 | 12768226 | import numpy as np
import cv2
import pandas as pd
import face_recognition as fc
import time
import random as rd
import smtplib
import xlrd
fcc=0
v=cv2.VideoCapture(0)
fd=cv2.CascadeClassifier(r"C:\Users\HP\AppData\Local\Programs\Python\Python36\Lib\site-packages\cv2\data\haarcascade_frontalface_alt2.xml")
... | 3.25 | 3 |
main/forms.py | drx/archfinch | 1 | 12768227 | <reponame>drx/archfinch
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
from django.utils.http import int_to_base36
from django.contrib.formtools.wizard import FormWizard
from django import forms
from django.conf import settings
from archfinch.main import tasks
from archf... | 1.960938 | 2 |
judgments/middleware.py | nationalarchives/ds-caselaw-public-ui | 0 | 12768228 | import json
from urllib.parse import unquote
from django.http import HttpRequest
from django.template.response import TemplateResponse
class CookieConsentMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
return self.get_response(reque... | 2.21875 | 2 |
src/decent.py | cloudzfy/pychallenge | 3 | 12768229 | # Email received from Leopold Mozart:
#
# From: "<NAME>" <<EMAIL>>
# Date: Thu, 1 Sep 2016 01:39:31 -0700
# Message-ID: <<EMAIL>>
# Subject: Re: my broken zip Re: sorry
# MIME-Version: 1.0
# Content-Type: text/plain; charset=UTF-8
# Content-Transfer-Encoding: 7bit
# Content-Disposition: inline
# Precedence: bulk
# X-Au... | 2.65625 | 3 |
QUANTAXIS_Monitor_GUI/TasksByThreading/QA_Gui_DateFetch_Task.py | simplezhang57/QUANTAXIS | 2 | 12768230 |
import time
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5 import QtCore
from QUANTAXIS.QASU.save_tdx import (QA_SU_save_stock_day,
QA_SU_save_stock_week,
QA_SU_save_stock_month,
... | 2.34375 | 2 |
richter/ml.py | bpptkg/bpptkg-richter | 3 | 12768231 | <filename>richter/ml.py
"""
Utility module for computing Richter magnitude scales, i.e. ML or local
magnitude on BPPTKG seismic network.
"""
import numpy as np
from . import paz
def filter_stream(stream, **kwargs):
"""
Filter ObsPy stream object.
:param stream: ObsPy waveform stream object.
:type st... | 2.921875 | 3 |
tests-deprecating/milvus_benchmark/milvus_benchmark/env/local.py | CyberFlameGO/milvus | 10,504 | 12768232 | <reponame>CyberFlameGO/milvus<filename>tests-deprecating/milvus_benchmark/milvus_benchmark/env/local.py
import logging
from milvus_benchmark.env.base import BaseEnv
logger = logging.getLogger("milvus_benchmark.env.local")
class LocalEnv(BaseEnv):
"""docker env class wrapper"""
env_mode = "local"
def __i... | 1.921875 | 2 |
server/headless_client.py | LeonardoPohl/DPS-2-Nitocris | 0 | 12768233 | import base64
import json
import pickle
from sys import argv
from time import sleep
import websocket
map_function = None
socket: websocket.WebSocketApp = None
def set_map_function(code: str):
global map_function
map_function = pickle.loads(base64.b64decode(code))
def execute_map(data):
decoded_data = ... | 2.796875 | 3 |
setup.py | WqyJh/winpexpect | 1 | 12768234 | #
# This file is part of WinPexpect. WinPexpect is free software that is made
# available under the MIT license. Consult the file "LICENSE" that is
# distributed together with this file for the exact licensing terms.
#
# WinPexpect is copyright (c) 2008-2010 by the WinPexpect authors. See the
# file "AUTHORS" for a com... | 1.203125 | 1 |
clusteringattacks.py | LamiaGharbi/Intelligent-IDS- | 0 | 12768235 | import warnings
import numpy as np
import pandas as pd
from matplotlib import patches
from sklearn.cluster import DBSCAN
from sklearn.decomposition import PCA
from sklearn.metrics import confusion_matrix
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import OneHotEncoder, LabelEncoder
import ... | 1.804688 | 2 |
sources/kuzzle/firmware/firmware.py | etrousset/kuzzle-iot-board | 1 | 12768236 | #!/usr/bin/python3
import signal
import RPi.GPIO as GPIO
import logging
import coloredlogs
import sys
sys.path.append("..")
import argparse
import ruamel.yaml as YAML
import time
import threading
import asyncio
from neopixeldevice import NeopixelDevice, LED_PIN, LightMode, ws as ws_
from utils import *
from pn532 i... | 2.09375 | 2 |
twitoff/__init__.py | ekoly/twitoff-app | 0 | 12768237 | #!/usr/bin/env python3
"""
App base.
- APP: flask app object
- DB: sqlalchemy database
- UTIL: utility methods
"""
import logging
from twitoff.app import make_app
APP, DB, REDIS = make_app()
application = APP
LOG = logging.getLogger("twitoff")
from twitoff import Routes
from twitoff.ser... | 2.078125 | 2 |
Python_Files/murach/book_apps/ch10/create_account.py | Interloper2448/BCGPortfolio | 0 | 12768238 | <reponame>Interloper2448/BCGPortfolio<filename>Python_Files/murach/book_apps/ch10/create_account.py
def main():
full_name = get_full_name()
print()
password = get_password()
print()
first_name = get_first_name(full_name)
print("Hi " + first_name + ", thanks for creating an account.") ... | 4.09375 | 4 |
authors/apps/articles/migrations/0025_merge_20190508_1042.py | andela/ah-the-jedi-backend | 1 | 12768239 | # Generated by Django 2.1 on 2019-05-08 10:42
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('articles', '0024_auto_20190508_0741'),
('articles', '0020_merge_20190508_0813'),
]
operations = [
]
| 1.351563 | 1 |
lib/evaluate_model.py | 98miranil/DeepLearning_Solver | 0 | 12768240 | <reponame>98miranil/DeepLearning_Solver<gh_stars>0
#EVALUATION OF THE MODEL
def evaluate_model(model, X_test, y_test):
_, score = model.evaluate(X_test, y_test, verbose = 0)
print(score)
def predict_model(model, X):
y = model.predict(X)
print(y)
def predict_class_model(model, X):
y = model.predic... | 2.625 | 3 |
Mag2021-main-code/Proactive caching/PENN/run_PENN.py | wjj19950101/Magrank_v1 | 0 | 12768241 | # #################################################################
# Python codes PENN for caching
# Codes have been tested successfully on Python 3.6.0 with TensorFlow 1.14.0.
# #################################################################
import scipy.io as sio
import numpy as np ... | 2.0625 | 2 |
eyecite/__init__.py | pombredanne/eyecite | 0 | 12768242 | <gh_stars>0
from .annotate import annotate
from .find_citations import get_citations
from .resolve import resolve_citations
from .utils import clean_text, dump_citations
__all__ = [
"annotate",
"get_citations",
"clean_text",
"resolve_citations",
"dump_citations",
]
| 1.296875 | 1 |
app/migrations/0002_auto_20200803_1017.py | raptor419/SIH2020_AN314_AMRTrack | 0 | 12768243 | # Generated by Django 2.1.1 on 2020-08-03 04:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='pathtest',
name='district',
fie... | 1.710938 | 2 |
seapy/other.py | FRidh/seapy | 8 | 12768244 | <filename>seapy/other.py
"""
Other equations.
================
This module contains all kind of additional equations than can be useful.
"""
import numpy as np
def total_loss_factor(frequency, reverberation_time):
"""
The total loss factor can be related to the reverberation time for any subsystem.
... | 2.625 | 3 |
vb2py/PythonCard/samples/minimalTree/minimalTree.py | ceprio/xl_vb2py | 0 | 12768245 | <reponame>ceprio/xl_vb2py
#!/usr/bin/python
"""
__version__ = "$Revision: 1.6 $"
__date__ = "$Date: 2004/05/05 16:53:27 $"
"""
from PythonCard import model
# events
# itemActivated, itemExpanding, itemExpanded,
# selectionChanging, selectionChanged
class Minimal(model.Background):
def on_initialize(self, even... | 2.421875 | 2 |
shot_detector/filters/compound/mean_cascade.py | w495/shot_detector | 18 | 12768246 | # -*- coding: utf8 -*-
"""
The main idea of this module, that you can combine
any number of any filters without any knowledge about their
implementation. You have only one requirement — user functions
should return a filter (or something that can be cast to a filter).
"""
from __future__ import absolu... | 2.625 | 3 |
posts/tests/test_models.py | nick-rebrik/Yatube | 0 | 12768247 | from django.contrib.auth import get_user_model
from django.test import TestCase
from posts.models import Post, Group
User = get_user_model()
class PostModelTest(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
user = User.objects.create_user(username='TestUser')
cls.... | 2.421875 | 2 |
NetworkHandler/Encoder.py | GitiHubi/deepContinualAuditing | 0 | 12768248 | <reponame>GitiHubi/deepContinualAuditing<filename>NetworkHandler/Encoder.py
# import pytorch libraries
from torch import nn
# define encoder class
class Encoder(nn.Module):
# define class constructor
def __init__(self, hidden_size, bottleneck):
# call super class constructor
super(Encoder, se... | 2.578125 | 3 |
Logistic Regression/LR.py | codeofdave/ML | 0 | 12768249 | <reponame>codeofdave/ML
import matplotlib.pyplot as plt
import numpy as np
import xlrd
def readdata():
with xlrd.open_workbook('data.xlsx') as workbook :
table = workbook.sheet_by_name('Sheet1')
x1 = table.col_values(0)[1:]
x2 = table.col_values(1)[1:]
label = table.col_values(2)[1:... | 2.9375 | 3 |
slhc/suites/module_ellone.py | kotmasha/kodlab-uma-encapsulated | 0 | 12768250 | <reponame>kotmasha/kodlab-uma-encapsulated
### module for basic operations with ellone metric
from scipy.spatial.distance import cityblock as ellone
from scipy.spatial.distance import pdist
def get_metric(params=None):
met_func=lambda pt1,pt2: ellone(pt1,pt2) if params is None else lambda pt1,pt2: ellone(para... | 2.6875 | 3 |