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 |
|---|---|---|---|---|---|---|
Dataset/Leetcode/valid/78/302.py | kkcookies99/UAST | 0 | 24900 | class Solution:
def XXX(self, nums: List[int]) -> List[List[int]]:
final = list()
# ----------------------------------------------------
if len(nums)==1:
return [[],nums]
if len(nums)==0:
return []
# ----------------------------------------------------... | 3.125 | 3 |
ems/utils.py | EMSTrack/EMS-Simulator | 1 | 24901 | <filename>ems/utils.py
import pandas as pd
def parse_headered_csv (file: str, desired_keys: list):
"""
Takes a headered CSV file and extracts the columns with the desired keys
:param file: CSV filename
:param desired_keys: Names of columns to extract
:return: pandas dataframe
"""
if file ... | 3.921875 | 4 |
plenum/test/bls/test_send_txns_no_bls.py | steptan/indy-plenum | 0 | 24902 | from plenum.test.bls.helper import check_bls_multi_sig_after_send
from plenum.test.pool_transactions.conftest import looper, clientAndWallet1, \
client1, wallet1, client1Connected
nodeCount = 4
nodes_wth_bls = 0
def test_each_node_has_bls(txnPoolNodeSet):
for node in txnPoolNodeSet:
assert node.bls_b... | 1.734375 | 2 |
Questoes/b1_q09_piso.py | viniciusm0raes/python | 0 | 24903 | metros = float(input('Quantos metros de piso vc deseja? '))
preco = 70
total = metros*preco
print('O preço total do pedido é: R$ %.2f' % (total))
| 3.40625 | 3 |
backend/serv/online_data.py | Alliance-Of-Independent-Programmers/acc-book | 0 | 24904 | import base64
import os.path
path=os.path.dirname(__file__)
misha = base64.b64encode(open(os.path.join(path, "../Pics/Miahs.jpg"), "rb").read()).decode("UTF-8")
yaroslav = base64.b64encode(open(os.path.join(path, "../Pics/Yaroslav.jpg"), "rb").read()).decode("UTF-8")
goblin = base64.b64encode(open(os.path.join(path, ... | 2.28125 | 2 |
profiles_api/serializers.py | parth-singh71/profiles-rest-api | 0 | 24905 | <filename>profiles_api/serializers.py
from rest_framework import serializers
class HelloSerializer(serializers.Serializer):
"""Serializers a name field for testing our APIView"""
name = serializers.CharField(max_length= 10)
| 1.914063 | 2 |
xpsi/PostProcessing/_cache.py | DevarshiChoudhury/xpsi | 14 | 24906 | from __future__ import division, print_function
from .. import __version__
from ._global_imports import *
try:
import h5py
except ImportError:
print('Install h5py to enable signal caching.')
raise
class _Cache(object):
""" Cache numerical model objects computed during likelihood evaluation.
:pa... | 2.3125 | 2 |
multiprocessingTest.py | lakshay1296/python-multiprocessing-sample | 0 | 24907 | from multiprocessing import Process, Manager
''' Custom Module Imports '''
from calculator.add import addition
from calculator.subtract import subtraction
from calculator.multiply import multiplication
from calculator.divide import division
class Main:
def __init__(self) -> None:
pass
d... | 2.8125 | 3 |
migrations/d7cd5138bb9b_minor_fixes.py | szkkteam/agrosys | 0 | 24908 | """minor fixes
Revision ID: <KEY>
Revises: 0<PASSWORD>
Create Date: 2020-09-18 07:56:14.159782
"""
from alembic import op
import geoalchemy2
import sqlalchemy as sa
import backend
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '0fed690a57ce'
branch_labels = ()
depends_on = None
def up... | 1.296875 | 1 |
creation/bundles.py | jim-bo/silp2 | 1 | 24909 | <reponame>jim-bo/silp2<gh_stars>1-10
#!/usr/bin/python
'''
creates bundle graph from filtered multigraph
'''
### imports ###
import sys
import os
import logging
import networkx as nx
import numpy as np
import scipy.stats as stats
import cPickle
import helpers.io as io
import helpers.misc as misc
### definitions ###... | 2.265625 | 2 |
ParadoxTrading/EngineExt/Futures/__init__.py | yutiansut/ParadoxTrading | 2 | 24910 | <reponame>yutiansut/ParadoxTrading
from .Arbitrage import ArbitrageEqualFundSimplePortfolio, \
ArbitrageEqualFundVolatilityPortfolio, ArbitrageStrategy
from .BacktestEngine import BacktestEngine
from .BacktestMarketSupply import BacktestMarketSupply
from .BarBacktestExecution import BarBacktestExecution
from .BarPo... | 1.28125 | 1 |
core/network/Swin_T/__init__.py | ViTAE-Transformer/ViTAE-Transformer-Matting | 8 | 24911 | <filename>core/network/Swin_T/__init__.py<gh_stars>1-10
from .swin_stem_pooling5_transformer import swin_stem_pooling5_encoder
from .swin_stem_pooling5_transformer import SwinStemPooling5TransformerMatting
from .decoder import SwinStemPooling5TransformerDecoderV1
__all__ = ['p3mnet_swin_t']
def p3mnet_swin_t(pretr... | 1.796875 | 2 |
tests/test_day22.py | arcadecoffee/advent-2021 | 0 | 24912 | """
Tests for Day 22
"""
from day22.module import part_1, part_2, \
FULL_INPUT_FILE, TEST_INPUT_FILE_1, TEST_INPUT_FILE_2, TEST_INPUT_FILE_3
def test_part_1_1():
result = part_1(TEST_INPUT_FILE_1)
assert result == 39
def test_part_1_2():
result = part_1(TEST_INPUT_FILE_2)
assert result == 59078... | 1.828125 | 2 |
src/kde_crime/kde_test.py | ras9841/UP-STAT-2018 | 0 | 24913 | <reponame>ras9841/UP-STAT-2018<filename>src/kde_crime/kde_test.py
from spatial_kde import *
from sklearn.model_selection import train_test_split
import pandas as pd
import matplotlib.pyplot as plt
data_loc = "../../data/RPD_crime2011toNow.csv"
data = process_RPD_data(data_loc)
print("Loaded data")
Y = data[["class"]]... | 2.625 | 3 |
setup.py | C0DK/lightbus | 0 | 24914 | # -*- coding: utf-8 -*-
# DO NOT EDIT THIS FILE!
# This file has been autogenerated by dephell <3
# https://github.com/dephell/dephell
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import os.path
readme = ""
here = os.path.abspath(os.path.dirname(__file__))
readme_p... | 1.203125 | 1 |
src/skill_algorithms/trueskill_data_processing.py | EllAchE/nba_tipoff | 0 | 24915 | import ENVIRONMENT
from src.database.database_creation import createPlayerTrueSkillDictionary
from src.skill_algorithms.algorithms import trueSkillMatchWithRawNums, trueSkillTipWinProb
from src.skill_algorithms.common_data_processing import beforeMatchPredictions, runAlgoForSeason, runAlgoForAllSeasons
# backlogtodo... | 2.078125 | 2 |
warp/utils/config_parsing.py | j-helland/warp | 0 | 24916 | <filename>warp/utils/config_parsing.py
# std
import datetime
from copy import deepcopy
from collections import deque
import yaml
# from .lazy_loader import LazyLoader as LL
# yaml = LL('yaml', globals(), 'yaml')
# json = LL('json', globals(), 'json')
# types
from typing import Dict, Any, Union, Tuple
__all__ = [
... | 2.390625 | 2 |
npword2vec/HuffmanTree.py | qiaoxiu/nlp | 0 | 24917 | __author__ = 'multiangle'
# 这是实现 霍夫曼树相关的文件, 主要用于 针对层次softmax进行 word2vec 优化方案的一种
'''
至于 为什么要进行层次softmax 可以简单理解 因为词表很大 针对上完个类别单词进行softmax 计算量大 更新参数过多 无法训练,而采用softmax 层次化 只需要 计算几个有限单词的sigmod 就可以 更新参数也非常少
提高训练速度
什么是霍夫曼树 简单理解就是 将训练文本 进行词频统计 通过构建加权最短路径来构造二叉树 这样 词频高的 位置在前 词频低的位置在后 每一个 霍夫曼编码代表一个词 路径 并且是唯一 不是其他词的前缀
'''
impo... | 3.15625 | 3 |
grama/fit/fit_scikitlearn.py | Riya-1/py_grama | 13 | 24918 | __all__ = [
"fit_gp",
"ft_gp",
"fit_lm",
"ft_lm",
"fit_rf",
"ft_rf",
"fit_kmeans",
"ft_kmeans",
]
## Fitting via sklearn package
try:
from sklearn.base import clone
from sklearn.linear_model import LinearRegression
from sklearn.gaussian_process import GaussianProcessRegresso... | 1.992188 | 2 |
VideoTranscriptClassification/video_indexer.py | MACEL94/media-services-video-indexer | 54 | 24919 | <filename>VideoTranscriptClassification/video_indexer.py
# Original source code: https://github.com/bklim5/python_video_indexer_lib
import os
import re
import time
import datetime
import requests
def get_retry_after_from_message(message):
match = re.search(r'Try again in (\d+) second', message or '')
if mat... | 2.59375 | 3 |
parameters_8560.py | ksuhr1/CMPS183-hw3 | 0 | 24920 | password="<PASSWORD>(1<PASSWORD>,20,sha512)$b24904a15adb4514$85f395bc9c1f6be8227d9f7540e54127cd4f0fdf"
| 1.101563 | 1 |
app/__init__.py | calcutec/netbard | 0 | 24921 | <filename>app/__init__.py
import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.mail import Mail
from config import ADMINS, MAIL_SERVER, MAIL_PORT, MAIL_USERNAME, \
MAIL_PASSWORD, SQLALCHEMY_DATABASE_URI
from .momentjs import momentjs
f... | 2.40625 | 2 |
src/knarrow/cli/__main__.py | InCogNiTo124/knarrow | 2 | 24922 | <reponame>InCogNiTo124/knarrow<filename>src/knarrow/cli/__main__.py<gh_stars>1-10
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from collections import Counter
from functools import partial
from pathlib import Path
from knarrow import find_knee
def gte_0(value):
x = float(value)
assert x... | 3 | 3 |
bitmovin_api_sdk/notifications/webhooks/encoding/encodings/encodings_api.py | jaythecaesarean/bitmovin-api-sdk-python | 11 | 24923 | <filename>bitmovin_api_sdk/notifications/webhooks/encoding/encodings/encodings_api.py
# coding: utf-8
from __future__ import absolute_import
from bitmovin_api_sdk.common import BaseApi, BitmovinApiLoggerBase
from bitmovin_api_sdk.common.poscheck import poscheck_except
from bitmovin_api_sdk.notifications.webhooks.enco... | 1.617188 | 2 |
notus/gtk_dbus/gtk_toaster.py | cnheider/notus | 0 | 24924 | <filename>notus/gtk_dbus/gtk_toaster.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import GdkPixbuf
import time
import dbus
__author__ = "<NAME>"
__doc__ = (
"Based on the notifications spec at: http://developer.gnome.org/notification-s... | 2.125 | 2 |
get_Exploitdb_CSV_SUPERSEDED.py | NadimKawwa/CybersecurityThreatIdentification | 3 | 24925 | <reponame>NadimKawwa/CybersecurityThreatIdentification
from time import sleep
from pymongo import MongoClient
from FakePersona import getPage
base_url = "https://www.exploit-db.com"
def getExploitCategories():
#access page as fake persona
soup = getPage(base_url)
#find all list items <li>
categories ... | 2.4375 | 2 |
example/django_example/polls/tests.py | dmsimard/dynaconf | 0 | 24926 | from django.conf import settings
from django.test import TestCase
# Create your tests here.
class SettingsTest(TestCase):
def test_settings(self):
self.assertEqual(settings.SERVER, 'prodserver.com')
self.assertEqual(
settings.STATIC_URL, '/changed/in/settings.toml/by/dynaconf/')
... | 2.5625 | 3 |
docker/dempcap/pcapminey/core/ThreadPool/Pool.py | JakubOrzol/dockerfiles | 203 | 24927 | <reponame>JakubOrzol/dockerfiles
# -*- coding: utf8 -*-
__author__ = '<NAME>'
from Queue import Queue
from Worker import Worker
class Pool:
def __init__(self, size):
self.size = size
self.workers = []
self.tasks = Queue()
def _removeDeadWorkers(self):
self.workers = [w for w i... | 2.875 | 3 |
tabnet/download_prepare_covertype.py | kiss2u/google-research | 1 | 24928 | # coding=utf-8
# Copyright 2020 The Google Research 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 applicab... | 2.46875 | 2 |
mockapi/test/urls.py | AKSharma01/mock_form | 0 | 24929 | <filename>mockapi/test/urls.py
from flask import Flask, request, render_template, url_for
from views import *
app = Flask(__name__)
app.secret_key = "mockapi.dev"
urls = [
('/', ['GET'], Start.as_view('view')),
('/login', ['GET','POST'], Log.as_view('log_alllist')), #- Login into mockapi
('/logout', ['GE... | 2.546875 | 3 |
gamer_registration_system/con/tests/test_models.py | splummer/gamer_reg | 0 | 24930 | import pytest
import datetime
from django.test import TestCase
from django.utils import timezone
from gamer_registration_system.con.models import Convention, Event, EventSchedule
# Create your tests here.
class EventScheduleModelTests(TestCase):
new_con = Convention(convention_name='Test Future Con')
new_eve... | 2.609375 | 3 |
Codes/gracekoo/interview_33.py | ghoslation/algorithm | 256 | 24931 | # -*- coding: utf-8 -*-
# @Time: 2020/7/3 10:21
# @Author: GraceKoo
# @File: interview_33.py
# @Desc: https://leetcode-cn.com/problems/chou-shu-lcof/
class Solution:
def nthUglyNumber(self, n: int) -> int:
if n <= 0:
return 0
dp, a, b, c = [1] * n, 0, 0, 0
for i in range(1, n):... | 3.078125 | 3 |
SafeCracker.py | epollinger/python | 0 | 24932 | <gh_stars>0
# Solution for the SafeCracker 50 Puzzle from Creative Crafthouse
# By: <NAME>
# 9/11/2016
#
# Function to handle the addition of a given slice
def add(slice):
if row1Outer[(index1 + slice) % 16] != -1:
valRow1 = row1Outer[(index1 + slice) % 16]
else:
valRow1 = row0Inner[sli... | 3.125 | 3 |
mul_func.py | motokimura/shake_shake_chainer | 2 | 24933 | <filename>mul_func.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import chainer
from chainer import cuda
from chainer import configuration
class Mul(chainer.function.Function):
def __init__(self):
return
def forward(self, inputs):
x1, x2 = inputs
xp = cuda.get_array_module(x1)... | 2.640625 | 3 |
client/osx/objc_test.py | nahidupa/grr | 6 | 24934 | <filename>client/osx/objc_test.py
#!/usr/bin/env python
# Copyright 2012 Google Inc. All Rights Reserved.
"""Tests for grr.client.lib.osx.objc.
These tests don't have OS X dependencies and will run on linux.
"""
import ctypes
import mox
from grr.client.osx import objc
from grr.lib import flags
from grr.lib import... | 2.015625 | 2 |
tests/test_demo.py | bruziev/security_interface | 5 | 24935 | <gh_stars>1-10
import pytest
from demo.jwt import IdentityMaker, JwtIdentityPolicy, JwtAuthPolicy
from security_interface.api import Security
SECRET = "SECRET"
identity_maker = IdentityMaker(expired_after=1, secret=SECRET)
jwt_identity = JwtIdentityPolicy(secret=SECRET)
jwt_auth = JwtAuthPolicy()
security = Securi... | 2.53125 | 3 |
demos/grasp_fusion/ros/grasp_fusion/node_scripts/bounding_box_to_tf.py | pazeshun/jsk_apc | 0 | 24936 | #!/usr/bin/env python
import rospy
import tf
from jsk_recognition_msgs.msg import BoundingBox
class BoundingBoxToTf(object):
def __init__(self):
self.tf_frame = rospy.get_param('~tf_frame', 'bounding_box')
self.broadcaster = tf.TransformBroadcaster()
self.sub = rospy.Subscriber('~inpu... | 2.40625 | 2 |
pymkup/__init__.py | psolin/pymkup | 7 | 24937 | <reponame>psolin/pymkup
from .pymkup import *
__version__ = '0.1'
| 0.800781 | 1 |
tests/import/module_getattr.py | sebi5361/micropython | 198 | 24938 | <reponame>sebi5361/micropython
# test __getattr__ on module
# ensure that does_not_exist doesn't exist to start with
this = __import__(__name__)
try:
this.does_not_exist
assert False
except AttributeError:
pass
# define __getattr__
def __getattr__(attr):
if attr == 'does_not_exist':
return Fal... | 2.671875 | 3 |
transform_pdf2image/__init__.py | SilasPDJ/maeportifolios_desktop_etc | 0 | 24939 | from defs_utils import *
import pdf2image
import os
def transforma_pdf_em_img_por_materia(materia, pdf_path=None):
searched = materia
if pdf_path:
list_files = list_dir(complete_name(searched, pre=pdf_path), True)
else:
list_files = list_dir(complete_name(searched), True)
volta = os.ge... | 2.9375 | 3 |
Own/Python/Tutorials/Lists.py | cychitivav/programming_exercises | 0 | 24940 | #<NAME>
#<EMAIL>
#12/Sept/2018
myList = ['Hi', 5, 6 , 3.4, "i"] #Create the list
myList.append([4, 5]) #Add sublist [4, 5] to myList
myList.insert(2,"f") #Add "f" in the position 2
print(myList)
myList = [1, 3, 4, 5, 23, 4, 3, 222, 454, 6445, 6, 4654, 455]
myList.sort() #Sort the list from lowest t... | 4.03125 | 4 |
src/scripts/retrive_sfd_data.py | seattlepublicrecords/revealseattle | 0 | 24941 | <reponame>seattlepublicrecords/revealseattle
import sys, traceback
from bs4 import BeautifulSoup
import rethinkdb as r
import requests
import time
import geocoder
import datetime
from dateutil.parser import parse as dtparse
from pytz import timezone
r.connect( "localhost", 28015).repl()
la = timezone('America/Los_Angel... | 2.625 | 3 |
tests/test_unasync.py | nsidnev/unasyncer | 0 | 24942 | <reponame>nsidnev/unasyncer<filename>tests/test_unasync.py
import os
import pathlib
import pytest
from unasyncer.unasync import unasync_path
@pytest.fixture
def expected_unasynced_code(sources: pathlib.Path) -> str:
with open(sources / "right_sync.py") as right_sync_file:
return right_sync_file.read()
... | 2.34375 | 2 |
baccarat.py | lnbalon/open-casino | 0 | 24943 | <reponame>lnbalon/open-casino
import random
def shuffle_shoe(n_decks=8):
cards = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K']
deck = cards * 4
shoe = deck * n_decks
random.shuffle(shoe)
return shoe
def deal_game(shoe):
# initialize a list to store cards for player and banker
player = ... | 3.40625 | 3 |
tests/amqp/test_rpc_client.py | OpenMatchmaking/sage-utils-python | 0 | 24944 | <reponame>OpenMatchmaking/sage-utils-python
import pytest
from sage_utils.amqp.clients import RpcAmqpClient
from sage_utils.amqp.extension import AmqpExtension
from sage_utils.constants import VALIDATION_ERROR
from sage_utils.wrappers import Response
from tests.fixtures import Application, FakeConfig, FakeRegisterMicr... | 1.890625 | 2 |
project4github/largest_digit.py | chinkaih319/SC101 | 0 | 24945 | """
File: largest_digit.py
Name:
----------------------------------
This file recursively prints the biggest digit in
5 different integers, 12345, 281, 6, -111, -9453
If your implementation is correct, you should see
5, 8, 6, 1, 9 on Console.
"""
def main():
print(find_largest_digit(12345)) # 5
print(find_larg... | 4.34375 | 4 |
eclipse-mosquitto/test/broker/07-will-no-flag.py | HenriqueBuzin/mosquitto-eclipse-mqtt | 2 | 24946 | #!/usr/bin/env python3
# Test whether a connection is disconnected if it sets the will flag but does
# not provide a will payload.
from mosq_test_helper import *
def do_test(proto_ver):
rc = 1
keepalive = 10
connect_packet = mosq_test.gen_connect("will-no-payload", keepalive=keepalive, will_topic="will/t... | 2.109375 | 2 |
setup.py | gsgoncalves/K-NRM | 198 | 24947 | # Copyright (c) 2017, Carnegie Mellon University. All rights reserved.
#
# Use of the K-NRM package is subject to the terms of the software license set
# forth in the LICENSE file included with this software, and also available at
# https://github.com/AdeDZY/K-NRM/blob/master/LICENSE
from setuptools import setup
from ... | 1.195313 | 1 |
tohu/v4/set_special_methods.py | maxalbert/tohu | 1 | 24948 | """
This module is not meant to be imported directly.
Its purpose is to patch the TohuBaseGenerator class
so that its special methods __add__, __mul__ etc.
support other generators as arguments.
"""
from operator import add, mul, gt, ge, lt, le, eq
from .base import TohuBaseGenerator
from .primitive_generators import... | 2.421875 | 2 |
backend/bot/bot.py | makarbaderko/hackathon_itgenio_2020.2 | 0 | 24949 | #Imports
import config
import telebot
from db_manager import SQL
import os
#Globals
restaurants = {"12345":"abc"}
current_restaurant_id = ""
current_restaurant_key = ""
couriers = {"12345":"abc"}
current_courier_id = ""
current_courier_key = ""
current_courier_altitude = 0
current_courier_longitude = 0
#DB + BOT CO... | 2.171875 | 2 |
Project/HDLT/User/getCloseUsers.py | Opty-MSc/HDS | 0 | 24950 | <filename>Project/HDLT/User/getCloseUsers.py
#!/usr/bin/env python3
from math import hypot
from sys import argv
from typing import List, Dict, Tuple
def main(fn, maxD):
with open(fn) as file:
positions: List[str] = file.readlines()
uLocations: Dict[int, Dict[str, Tuple[int, int]]] = {}
for positi... | 2.984375 | 3 |
stock/migrations/0020_stockproductcds_stockproductdis.py | unicefburundi/paludisme | 1 | 24951 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-10 20:53
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("bdiadmin", "0013_auto_20170319_1415"),
("stock", "0... | 1.6875 | 2 |
source_synphot/source.py | gnarayan/source_synphot | 0 | 24952 | # -*- coding: UTF-8 -*-
"""
Source processing routines
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import warnings
from collections import OrderedDict
from astropy.cosmology import default_cosmology
import numpy as np
import os
import pysynphot as S
import astropy.table as at
fro... | 2.375 | 2 |
objects.py | umesh0689/Mandorian | 0 | 24953 | <gh_stars>0
from random import randint
class Objects:
def __init__(self):
self._type=' '
self._arr=[]
def creating_objects(self):
times=randint(10,20)
for i in range(times):
temp=[]
temp.append(randint(1,4))#1=slant 2=horizontal 3=vertical 4=powerup
... | 3.3125 | 3 |
Code/GMM Test Scripts/yellowTest.py | Praveen1098/Gaussian_Mixture_Modelling | 0 | 24954 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import cv2
import numpy as np
from matplotlib import pyplot as plt
import os
import math
def gaussian(x, mu, sig):
return ((1/(sig*math.sqrt(2*math.pi)))*np.exp(-np.power(x - mu, 2.) / (2 * np.power(sig, 2.))))
x=list(range(0, 256))
g1=gaussian(x,np.arr... | 2.5625 | 3 |
Python/w3resource/Challenge5.py | TakaIzuki/school-work | 1 | 24955 | sample = ["abc", "xyz", "aba", "1221"]
def stringCounter(items):
amount = 0
for i in items:
if len(i) >= 2 and i[0] == i[-1]:
amount += 1
return amount
print("The amount of string that meet the criteria is:",stringCounter(sample)) | 3.859375 | 4 |
trayapp/tray_app.py | RoW171/trayPy | 3 | 24956 | <filename>trayapp/tray_app.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Robin 'r0w' Weiland"
__date__ = "2020-03-02"
__version__ = "0.1.2"
"""Library for creating system tray applications
based on Moses Palmér's 'pystray' library
See README for insntructions"""
__all__ = ('TrayApp',)
from typing impor... | 2.625 | 3 |
compiler/domain.py | cul-it/arxiv-compiler | 5 | 24957 | <reponame>cul-it/arxiv-compiler<gh_stars>1-10
"""Domain class for the compiler service."""
from typing import NamedTuple, Optional, BinaryIO, Dict
import io
from datetime import datetime
from .util import ResponseStream
from enum import Enum
class Format(Enum):
"""Compilation formats supported by this service.""... | 2.53125 | 3 |
zziplib-0.13.62/docs/make-doc.py | guangbin79/Lua_5.1.5-Android | 28 | 24958 | <filename>zziplib-0.13.62/docs/make-doc.py
#! /usr/bin/python
# -*- coding: UTF-8 -*-
import sys
import re
import string
import commands
import warnings
errors = 0
def warn(msg, error=None):
global errors
errors += 1
if error is None:
warnings.warn("-- "+str(errors)+" --\n "+msg, RuntimeWarning, 2... | 3.078125 | 3 |
cpm/cli.py | tzabal/cpm | 14 | 24959 | <filename>cpm/cli.py
# Copyright 2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | 2.46875 | 2 |
KivyApp/login.py | yeltayzhastay/jadenapp | 0 | 24960 | import pandas as pd
import numpy as np
import pickle
from sklearn.metrics.pairwise import linear_kernel
from sklearn.feature_extraction.text import TfidfVectorizer
import csv
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
... | 2.4375 | 2 |
yoyoman01_traject/scripts/set_state_model.py | Gepetto/yoyoman01_robot | 0 | 24961 | <filename>yoyoman01_traject/scripts/set_state_model.py
#!/usr/bin/env python
import rospy
import roslaunch
if __name__ == "__main__":
rospy.sleep(6.5)
uuid = roslaunch.rlutil.get_or_generate_uuid(None, False)
roslaunch.configure_logging(uuid)
launch = roslaunch.parent.ROSLaunchParent(uuid,["/home/ntestar/cat... | 1.820313 | 2 |
quiz/templatetags/quiz_tags.py | Gagan-Shenoy/sushiksha-website | 31 | 24962 | from django import template
register = template.Library()
@register.inclusion_tag('quiz/correct_answer.html', takes_context=True)
def correct_answer_for_all(context, question):
"""
processes the correct answer based on a given question object
if the answer is incorrect, informs the user
"""
answe... | 2.703125 | 3 |
pixel_gps.py | DerekGloudemans/tensorflow-yolov4-tflite | 1 | 24963 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 29 14:14:45 2020
@author: Nikki
"""
import numpy as np
import cv2
import transform as tform
import sys
import math
import scipy.spatial
import markers
###---------------------------------------------------------------------------
# Allows video to be initialized usin... | 2.234375 | 2 |
src/dal_select2/__init__.py | pandabuilder/django-autocomplete-light | 0 | 24964 | <reponame>pandabuilder/django-autocomplete-light<gh_stars>0
"""Select2 support for DAL."""
# default_app_config = 'dal_select2.apps.DefaultApp'
| 1.328125 | 1 |
AssetsApp/urls.py | Kayarn-Mechatronics/Octello | 0 | 24965 | <reponame>Kayarn-Mechatronics/Octello
from django.urls import path
from . import views
urlpatterns = [
#Assets Section
path('all', views.AssetsView.all_assets, name='AssetsList'),
path('lookup', views.AssetsView.lookup, name='Lookup_Asset'),
path('add', views.AssetsView.add_asset, name='Add_Asset'),
... | 1.59375 | 2 |
migrations/versions/597e346723ee_.py | uk-gov-mirror/alphagov.digitalmarketplace-api | 25 | 24966 | <reponame>uk-gov-mirror/alphagov.digitalmarketplace-api<filename>migrations/versions/597e346723ee_.py
"""empty message
Revision ID: 597e346723ee
Revises: <PASSWORD>
Create Date: 2015-03-25 16:36:11.552342
"""
# revision identifiers, used by Alembic.
revision = '597e346723ee'
down_revision = '<PASSWORD>'
from alembi... | 1.359375 | 1 |
cloudify_gcp/dns/dns.py | cloudify-cosmo/cloudify-gcp-plugin | 4 | 24967 | <filename>cloudify_gcp/dns/dns.py
# #######
# Copyright (c) 2014-2020 Cloudify Platform Ltd. 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 at
#
# http://www.apache.o... | 2.421875 | 2 |
SaIL/network/supervised_regression_network.py | yonetaniryo/SaIL | 12 | 24968 | <filename>SaIL/network/supervised_regression_network.py<gh_stars>10-100
#!/usr/bin/env python
"""Generic network class for supervised regression
Created on: March 25, 2017
Author: <NAME>"""
from collections import defaultdict
from planning_python.heuristic_functions.heuristic_function import EuclideanHeuristicNoAng, M... | 2.375 | 2 |
netsuite/constants.py | cart-com/netsuite | 0 | 24969 | <filename>netsuite/constants.py<gh_stars>0
import os
NOT_SET: object = object()
DEFAULT_INI_PATH: str = os.environ.get(
"NETSUITE_CONFIG", os.path.expanduser("~/.config/netsuite.ini"),
)
DEFAULT_INI_SECTION: str = "netsuite"
| 1.585938 | 2 |
delivery_merge/merge.py | astroconda/delivery_merge | 0 | 24970 | <filename>delivery_merge/merge.py
import os
import re
import sys
from .conda import conda, conda_env_load, conda_cmd_channels, ei_touch
from .utils import comment_find, git, pushd, sh
from configparser import ConfigParser
from glob import glob
from ruamel.yaml import YAML
DMFILE_RE = re.compile(r'^(?P<name>[A-z\-_l]+... | 2.390625 | 2 |
HMM/utils.py | rushill2/CS440SP21 | 0 | 24971 | # mp4.py
# ---------------
# Licensing Information: You are free to use or extend this projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to the University of Illinois at Urbana-Champaign
#
# Created Fa... | 2.796875 | 3 |
1 - Beginner/1079.py | andrematte/uri-submissions | 1 | 24972 | <reponame>andrematte/uri-submissions
# Uri Online Judge 1079
N = int(input())
for i in range(0,N):
Numbers = input()
num1 = float(Numbers.split()[0])
num2 = float(Numbers.split()[1])
num3 = float(Numbers.split()[2])
print(((2*num1+3*num2+5*num3)/10).__round__(1)) | 3.4375 | 3 |
ex4/sigmoidGradient.py | junwon1994/Coursera-ML | 3 | 24973 | from ex2.sigmoid import sigmoid
def sigmoidGradient(z):
"""computes the gradient of the sigmoid function
evaluated at z. This should work regardless if z is a matrix or a
vector. In particular, if z is a vector or matrix, you should return
the gradient for each element."""
# =====================... | 4 | 4 |
test.py | sebdah/python-inspector | 1 | 24974 | <filename>test.py<gh_stars>1-10
#!/usr/bin/env python
"""
Test the Inspector
"""
import os.path, sys
sys.path.append(os.path.dirname(__file__))
import unittest
import inspector
########################################################
#
# Inspector test
#
########################################################
de... | 3.0625 | 3 |
dynamodb.py | oliveroneill/sir | 0 | 24975 | <reponame>oliveroneill/sir
"""Util functions for accessing data via DynamoDB."""
import boto3
from boto3.dynamodb.conditions import Key
class UnknownInviteCodeError(Exception):
"""An error when an unknown invite code is entered."""
pass
def get_invitee(invite_code: str):
"""Get a dictionary of the stor... | 3.109375 | 3 |
pyvarnam/varnam.py | sebinthomas/pyvarnam | 1 | 24976 | <filename>pyvarnam/varnam.py<gh_stars>1-10
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
The main varnam module.
"""
from .library import InternalVarnamLibrary
from .utils import *
from .varnam_defs import *
from warnings import warn
import ctypes as C
class Varnam:
""" Varnam class which encapsulates all
... | 2.640625 | 3 |
classifier/bic.py | NYPL/Simplified-server-core | 8 | 24977 | from . import *
class BICClassifier(Classifier):
# These prefixes came from from http://editeur.dyndns.org/bic_categories
LEVEL_1_PREFIXES = {
Art_Design: 'A',
Biography_Memoir: 'B',
Foreign_Language_Study: 'C',
Literary_Criticism: 'D',
Reference_Study_Aids: 'G',
... | 1.859375 | 2 |
pusher/pusher.py | tkhieu/pusher-rest-python | 0 | 24978 | # -*- coding: utf-8 -*-
from __future__ import (print_function, unicode_literals, absolute_import,
division)
from pusher.config import Config
from pusher.request import Request
from pusher.sync import SynchronousBackend
from pusher.util import GET, POST, text, validate_channel
import collectio... | 2.46875 | 2 |
src/bigfix_prefetch/__main__.py | jgstew/generate-prefetch | 0 | 24979 | """
To run this module directly
"""
# pylint: disable=no-else-return
import argparse
import os
try:
from . import prefetch_from_file
except ImportError:
import prefetch_from_file
try:
from . import prefetch_from_url
except ImportError:
import prefetch_from_url
def validate_filepath_or_url(filepath_o... | 3.078125 | 3 |
workshop/sampledecoder/src/rfi_power_switch.py | arnd/aws-iot-core-lorawan | 54 | 24980 | <gh_stars>10-100
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
#
# 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, i... | 2.4375 | 2 |
src/tests/aguirregabiria_simple_tests.py | cdagnino/LearningModels | 0 | 24981 | import numpy as np
from src import const
#TODO: should be imported from aguirregabiria_simple.py
def period_profit(p: np.ndarray, lambdas: np.ndarray, betas_transition=const.betas_transition):
"""
Correct expected period return profit. See ReadMe for derivation
"""
constant_part = (p-const.c) * np.e *... | 2.78125 | 3 |
rdhyee_utils/aws/__init__.py | rdhyee/rdhyee_utils | 0 | 24982 | <filename>rdhyee_utils/aws/__init__.py
# code adapted from http://my.safaribooksonline.com/book/-/9781449308100/2dot-ec2-recipes/id2529379
def launch_instance(aws_access_key_id=None,
aws_secret_access_key=None,
ami='ami-a29943cb',
instance_type='t1.micro',
... | 3.03125 | 3 |
kinto/tests/core/test_authorization.py | swhgoon/kinto | 0 | 24983 | import mock
from pyramid.request import Request
from .support import DummyRequest, unittest
from kinto.core import authentication
from kinto.core.authorization import RouteFactory, AuthorizationPolicy
from kinto.core.storage import exceptions as storage_exceptions
class RouteFactoryTest(unittest.TestCase):
def... | 2.296875 | 2 |
src/main.py | tomaszbartoszewski/sense-hat-sokoban | 0 | 24984 | import copy
#from enum import IntFlag
from time import sleep
# I tried to use enum here, but I was having a problem with packages in the image, so I gave up as I just want to get it done
class FieldValue:
Empty = 0
Wall = 1
Player = 2
Box = 4
Goal = 8
class SenseHATColour:
Red = (204, 4, 4)
... | 3.09375 | 3 |
src/similary_reviews/repeated_review_detection.py | maxuepo/x-review-processor | 0 | 24985 | <reponame>maxuepo/x-review-processor
from __future__ import print_function
from sklearn.feature_extraction.text import TfidfVectorizer
from common.util import ReviewUtil
import numpy as np
import ntpath
import pandas as pd
import os
from common.base_task import BaseTask
class ReviewDedupTask(BaseTask):
def __init... | 2.390625 | 2 |
nipyapi/nifi/apis/parameter_contexts_api.py | oneextrafact/nipyapi | 0 | 24986 | # coding: utf-8
"""
NiFi Rest Api
The Rest Api provides programmatic access to command and control a NiFi instance in real time. Start and stop processors, monitor queues, query provenance data, and more. Each endpoint below includes a description, ... | 1.914063 | 2 |
sw/3rd_party/VTK-7.1.0/Utilities/Maintenance/vtk_reindent_code.py | esean/stl_voro_fill | 4 | 24987 | #!/usr/bin/env python
"""
Usage: python vtk_reindent_code.py [--test] <file1> [<file2> ...]
This script takes old-style "Whitesmiths" indented VTK source files as
input, and re-indents the braces according to the new VTK style.
Only the brace indentation is modified.
If called with the --test option, then it ... | 2.796875 | 3 |
example/example_list.py | vtheno/Vtools | 2 | 24988 | from util.List import *
print( dir() )
lst = list(range(9999))
hd,*tl = lst
print( hd )
print( tl )
del hd,tl
Lst = toList(lst)
try:
print( hd,tl )
except NameError as e:
with Lst as (hd,tl):
print( hd )
print( tl )
print( type(hd),type(tl) )
print( Lst.hd is hd )
print(... | 3.0625 | 3 |
scripts_for_public/05_crf_solver.py | NeLy-EPFL/Ascending_neuron_screen_analysis_pipeline | 0 | 24989 | import os.path
from scipy.optimize import fsolve
import math
import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
import utils_Florian as utils
def equations(p, t_peak, t_half):
x, y = p
return (0.5 * (math.exp(-x * t_peak) - math.exp(-y * t_peak)) - (math.exp(-x * t_half) - math.exp... | 2.421875 | 2 |
multi_prisoner/tests.py | Charlotte-exp/Multichannel-Games | 0 | 24990 | from otree.api import Currency as c, currency_range
from . import pages
from ._builtin import Bot
from .models import Constants
class PlayerBot(Bot):
def play_round(self):
if self.round_number <= self.participant.vars['last_round']:
yield pages.Decision, {"decision_high": 1, "decision_low": 1}... | 2.734375 | 3 |
plugins/zhihu/handler.py | KuangjuX/QBot | 0 | 24991 | <reponame>KuangjuX/QBot
import requests
async def req_top_topic():
url = "https://www.zhihu.com/api/v4/search/top_search"
user_agent = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko Fedora/1.9.0.8-1.fc10 Kazehakase/0.5.6"
headers = {
"User-Agent": user_agent
}
try:
resp ... | 2.640625 | 3 |
docqa/triviaqa/answer_detection.py | Willyoung2017/doc-qa | 422 | 24992 | import re
import string
import numpy as np
from tqdm import tqdm
from typing import List
from docqa.triviaqa.read_data import TriviaQaQuestion
from docqa.triviaqa.trivia_qa_eval import normalize_answer, f1_score
from docqa.utils import flatten_iterable, split
"""
Tools for turning the aliases and answer strings from... | 3.03125 | 3 |
custom_components/grocy/schema.py | smhgit/grocery_list | 1 | 24993 | <filename>custom_components/grocy/schema.py
"""Schemas for grocy."""
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (CONF_HOST, CONF_ENTITY_ID, CONF_USERNAME, CONF_PASSWORD)
from .const import (DOMAIN,
CONF_APIKEY, CONF_AMOUNT, CONF_... | 1.90625 | 2 |
examples/vacuum_send_command.py | giuseppeg88/lovelace-xiaomi-vacuum-map-card | 798 | 24994 | <filename>examples/vacuum_send_command.py
entity_id = data.get('entity_id')
command = data.get('command')
params = str(data.get('params'))
parsedParams = []
for z in params.replace(' ', '').replace('],[', '|').replace('[', '').replace(']', '').split('|'):
rect = []
for c in z.split(','):
rect.append(in... | 2.34375 | 2 |
base/migrations/0006_profile_history.py | polarity-cf/arugo | 34 | 24995 | # Generated by Django 3.2.9 on 2021-11-13 14:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0005_authquery_password'),
]
operations = [
migrations.AddField(
model_name='profile',
name='h... | 1.671875 | 2 |
nanodet/util/rank_filter.py | zjiao19/nanodet | 8 | 24996 |
def rank_filter(func):
def func_filter(local_rank=-1, *args, **kwargs):
if local_rank < 1:
return func(*args, **kwargs)
else:
pass
return func_filter
| 2.34375 | 2 |
ThreePointsCircle.py | formeo/checkio_tasks | 0 | 24997 | <gh_stars>0
import math
def checkio(data):
x1=int(data[1])
y1=int(data[3])
x2 = int(data[7])
y2 = int(data[9])
x3 = int(data[13])
y3 = int(data[15])
A = x2 - x1
B = y2 - y1
C = x3 - x1
D = y3 - y1
E = A * (x1 + x2) + B * (y1 + y2)
F = C * (x1 + x3) + D * (y1 + y3)
... | 3.234375 | 3 |
schafkopf/utils/settings_utils.py | PanchoVarallo/Schafkopf-Application | 1 | 24998 | <filename>schafkopf/utils/settings_utils.py<gh_stars>1-10
import configparser
import enum
ini = 'settings.ini'
class Database(enum.Enum):
SQLITE = 1
POSTGRES = 2
def get_db() -> Database:
return Database[get_entry('Database', 'db')]
def get_database_url() -> str:
return get_entry('Database', 'dat... | 2.75 | 3 |
tests/parser/test_lambda.py | csun-comp430-s22/lispy | 0 | 24999 | <reponame>csun-comp430-s22/lispy<gh_stars>0
import pytest
from lispyc import nodes
from lispyc.exceptions import SpecialFormSyntaxError, TypeSyntaxError
from lispyc.nodes import ComposedForm, Constant
from lispyc.nodes import FunctionParameter as Param
from lispyc.nodes import Program, Variable, types
from lispyc.pars... | 2.21875 | 2 |