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 |
|---|---|---|---|---|---|---|
hmm_data.py | vvhitedog/pystan-hmm | 0 | 21200 | <reponame>vvhitedog/pystan-hmm<gh_stars>0
#!/usr/bin/python
import numpy as np
from matplotlib import pyplot as plt
theta = np.asarray([[.8,.2],[.1,.9]])
psi = np.asarray([3.,9.])
N = 100
K = 2
# sample z
z = np.empty(N,dtype='int')
z[0] = 1
for i in range(1,N):
z[i] = np.random.choice(np.arange(K),size=1,repl... | 2.375 | 2 |
s2e_env/commands/image_build.py | michaelbrownuc/s2e-env | 0 | 21201 | """
Copyright (c) 2017 Cyberhaven
Copyright (c) 2017 Dependable Systems Laboratory, EPFL
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 right... | 1.453125 | 1 |
chart_analysis.py | DeltaEpsilon7787/SimfileLibrary | 0 | 21202 | <filename>chart_analysis.py<gh_stars>0
import collections
from functools import lru_cache
from itertools import groupby, permutations
from operator import attrgetter
from typing import Counter, FrozenSet, Generic, List, Tuple, TypeVar, Union, cast
from attr import attrs, evolve
from .basic_types import Beat, CheaperF... | 2.109375 | 2 |
websocket_chat_server.py | ringolol/ru-gpts | 0 | 21203 | <filename>websocket_chat_server.py
# WS server chat
import asyncio
import websockets
import torch
from transformers import AutoTokenizer, AutoModel, AutoModelWithLMHead
model_name = "sberbank-ai/rugpt2large" # "sberbank-ai/rugpt3large_based_on_gpt2"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoM... | 2.5625 | 3 |
mocket/utils.py | hectorcanto/python-mocket | 0 | 21204 | <reponame>hectorcanto/python-mocket<filename>mocket/utils.py
import binascii
import io
import os
import ssl
from .compat import decode_from_bytes, encode_to_bytes
SSL_PROTOCOL = ssl.PROTOCOL_SSLv23
class MocketSocketCore(io.BytesIO):
def write(self, content):
super(MocketSocketCore, self).write(content)... | 2.765625 | 3 |
exercicios_fixacao/lista04/repet_lim_ex6.py | PauloVictorSS/unicamp-mc102 | 0 | 21205 | <gh_stars>0
number = int(input())
raiz = number/2
for i in range(1,20):
raiz = ((raiz ** 2) + number) / (2 * raiz)
print(raiz) | 3.453125 | 3 |
load.py | leonjovanovic/drl-ppo-bipedal-walker | 1 | 21206 | <reponame>leonjovanovic/drl-ppo-bipedal-walker<gh_stars>1-10
import gym
import numpy as np
import torch
import Config
import NN
import json
PATH_DATA = 'models/data23.15.9.40.json'
PATH_MODEL = 'models/model23.15.9.40.p'
with open(PATH_DATA, 'r') as f:
json_load = json.loads(f.read())
obs_rms_mean = n... | 1.875 | 2 |
generate_sl4_1.8.py | qiantianpei/anonymizer | 0 | 21207 | import json
from PIL import Image
with open('/home/tianpei.qian/workspace/data_local/sl4_front_1.0/sl4_side_val_1.7.json') as f:
val_1_7 = json.load(f)
with open('sl4_side_val_1.7/results.json') as f:
new_1_8 = json.load(f)
ROOT = '/home/tianpei.qian/workspace/data_local/sl4_front_1.0/'
for old, new in zip(... | 2.34375 | 2 |
experiments/vitchyr/icml2017/watermaze_memory/generate_bellman_ablation_figure_data.py | Asap7772/rail-rl-franka-eval | 0 | 21208 | """
Generate data for ablation analysis for ICML 2017 workshop paper.
"""
import random
from torch.nn import functional as F
from railrl.envs.pygame.water_maze import (
WaterMazeMemory,
)
from railrl.exploration_strategies.ou_strategy import OUStrategy
from railrl.launchers.launcher_util import (
run_experime... | 2.140625 | 2 |
setup.py | briancappello/py-meta-utils | 1 | 21209 | <gh_stars>1-10
from setuptools import setup
with open('README.md', encoding='utf-8') as f:
long_description = f.read()
setup(
name='Py-Meta-Utils',
version='0.7.8',
description='Metaclass utilities for Python',
long_description=long_description,
long_description_content_type='text/markdown',... | 1.320313 | 1 |
wflow/doc/pcraster-for-doc-only/pcraster/pcrstat.py | quanpands/wflow | 0 | 21210 | import math
# Returns a percentile of an array. It is assumed that the array is already
# sorted.
#
# The array must not be empty.
#
# Percentile must have a value between [0, 1.0].
def percentile(array, percentile):
assert len(array)
assert percentile >= 0.0 and percentile <= 1.0
index = int(math.ceil(percentil... | 3.8125 | 4 |
asetk/format/yambo.py | ltalirz/asetk | 18 | 21211 | """Classes for use with Yambo
Representation of a spectrum.
Main functionality is to read from Yambo output, o.qp files
and also netcdf databases.
"""
import re
import copy as cp
import numpy as np
import asetk.atomistic.fundamental as fu
import asetk.atomistic.constants as atc
from . import cube
class Dispersion:
... | 2.828125 | 3 |
Chapter02/unittests/testExercise2_07.py | nijinjose/The-Supervised-Learning-Workshop | 19 | 21212 | import unittest
import os
import json
import pandas as pd
import numpy as np
class TestingExercise2_07(unittest.TestCase):
def setUp(self) -> None:
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(ROOT_DIR, '..', 'dtypes.json'), 'r') as jsonfile:
self.dtyp =... | 2.828125 | 3 |
models/cfnet.py | Cousin-Zan/Semantic-Segmentation-for-Steel-Strip-Surface-Defect-Detection | 0 | 21213 | <reponame>Cousin-Zan/Semantic-Segmentation-for-Steel-Strip-Surface-Defect-Detection<filename>models/cfnet.py<gh_stars>0
"""
The implementation of PAN (Pyramid Attention Networks) based on Tensorflow.
@Author: <NAME>
@Author: <NAME>
@Github: https://github.com/luyanger1799
@Github: https://github.com/Cousin-Zan
@Projec... | 2.203125 | 2 |
api/test/test_cli/test_bra_record_helper/test_persist.py | RemiDesgrange/nivo | 2 | 21214 | from uuid import UUID
from sqlalchemy import select, bindparam
from nivo_api.cli.bra_record_helper.persist import persist_zone, persist_massif
from nivo_api.core.db.connection import connection_scope
from nivo_api.core.db.models.sql.bra import ZoneTable, DepartmentTable, MassifTable
from test.pytest_fixtures import... | 2.234375 | 2 |
FractionalKnapsack.py | shatheesh171/greedy-algos | 0 | 21215 | <reponame>shatheesh171/greedy-algos
class Item:
def __init__(self,weight,value) -> None:
self.weight=weight
self.value=value
self.ratio=value/weight
def knapsackMethod(items,capacity):
items.sort(key=lambda x: x.ratio,reverse=True)
usedCapacity=0
totalValue=0
for i in items:... | 3.734375 | 4 |
jspp_imageutils/image/chunking.py | jspaezp/jspp_imageutils | 0 | 21216 | import itertools
import numpy as np
from jspp_imageutils.image.types import GenImgArray, GenImgBatch
from typing import Tuple, Iterable, Iterator
# TODO: fix everywhere the x and y axis nomenclature
"""
chunk_image_on_position -> returns images
chunk_image_generator -> returns images
chunk_data_image_generator -> re... | 2.328125 | 2 |
python/craftassist/ttad/generation_dialogues/build_scene_flat_script.py | satyamedh/craftassist | 626 | 21217 | <reponame>satyamedh/craftassist
if __name__ == "__main__":
import argparse
import pickle
import os
from tqdm import tqdm
from build_scene import *
from block_data import COLOR_BID_MAP
BLOCK_DATA = pickle.load(
open("/private/home/aszlam/minecraft_specs/block_images/block_data", "rb"... | 2.296875 | 2 |
modules/transfer/scripts/info.py | sishuiliunian/falcon-plus | 7,208 | 21218 | <gh_stars>1000+
import requests
# Copyright 2017 Xiaomi, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 2.125 | 2 |
pyhpecw7/features/interface.py | zhangshilinh3c/pyhpecw7 | 0 | 21219 | """Manage interfaces on HPCOM7 devices.
"""
from pyhpecw7.utils.xml.lib import reverse_value_map
from pyhpecw7.features.errors import InterfaceCreateError, InterfaceTypeError,\
InterfaceAbsentError, InterfaceParamsError, InterfaceVlanMustExist
from pyhpecw7.features.vlan import Vlan
from pyhpecw7.utils.xml.lib im... | 2.890625 | 3 |
backend/src/urls.py | Ornstein89/LeadersOfDigital2021_FoxhoundTeam | 0 | 21220 | from django.contrib import admin
from django.urls import path, include
from src.base import urls as base_api
urlpatterns = [
path('admin/', admin.site.urls),
path('rest_api/', include(
base_api.urlpatterns
)),
] | 1.617188 | 2 |
mobilib/voronoi.py | simberaj/mobilib | 0 | 21221 | """Compute ordinary Voronoi diagrams in Shapely geometries."""
import operator
import numpy
import scipy.spatial
import shapely.geometry
import shapely.geometry.base
import shapely.prepared
def pointset_bounds(coords):
return (
min(coords, key=operator.itemgetter(0))[0],
min(coords, key=operator... | 2.53125 | 3 |
ml4tc/scripts/plot_composite_saliency_map.py | thunderhoser/ml4tc | 2 | 21222 | """Plots composite saliency map."""
import argparse
import numpy
import matplotlib
matplotlib.use('agg')
from matplotlib import pyplot
from gewittergefahr.gg_utils import general_utils as gg_general_utils
from gewittergefahr.gg_utils import file_system_utils
from gewittergefahr.plotting import imagemagick_utils
from m... | 2.328125 | 2 |
Autocoders/Python/src/fprime_ac/models/CompFactory.py | LeStarch/lgtm-fprime | 1 | 21223 | <gh_stars>1-10
#!/usr/bin/env python3
# ===============================================================================
# NAME: CompFactory.py
#
# DESCRIPTION: This is a factory class for instancing the Component
# and building up the Port and Arg configuration required.
#
# AUTHOR: reder
# EMAIL: <EMAIL>... | 2.53125 | 3 |
Algo_Ds_Notes-master/Algo_Ds_Notes-master/A_Star_Search_Algorithm/A_Star_Search_Algorithm.py | rajatenzyme/Coding-Journey- | 0 | 21224 | class Node:
"""
A node class used in A* Pathfinding.
parent: it is parent of current node
position: it is current position of node in the maze.
g: cost from start to current Node
h: heuristic based estimated cost for current Node to end Node
f: total cost of present n... | 4.28125 | 4 |
setup.py | ikonst/dql | 0 | 21225 | """ Setup file """
import os
from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(HERE, "README.rst")).read()
CHANGES = open(os.path.join(HERE, "CHANGES.rst")).read()
REQUIREMENTS = [
"dynamo3>=0.4.7",
"future>=0.15.0",
"pyparsing==2.1.... | 1.539063 | 2 |
runner.py | leodenault/mhw_optimizer | 0 | 21226 | import multiprocessing
import csv_exporter
from combination.brute_force_combination_algorithm import \
BruteForceCombinationAlgorithm
from combination.combiner import Combiner
from combination.constrained_combination_algorithm import \
ConstrainedCombinationAlgorithm
from config.config_importer import ConfigIm... | 2.375 | 2 |
setup.py | AurelienLourot/lsankidb | 26 | 21227 | from setuptools import setup
import src
setup(name='lsankidb',
version=src.__version__,
install_requires=['AnkiTools'],
description='"ls" for your local Anki database.',
#FIXME this duplicates README.md
long_description="""
.. image:: https://cdn.jsdelivr.net/gh/AurelienLourot/lsankidb@c... | 1.554688 | 2 |
output/models/ibm_data/valid/s3_12/s3_12v06_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 21228 | from output.models.ibm_data.valid.s3_12.s3_12v06_xsd.s3_12v06 import (
ChildTypeBase,
ChildTypeDerived,
CtAlt1,
CtAlt2,
CtBase,
Root,
)
__all__ = [
"ChildTypeBase",
"ChildTypeDerived",
"CtAlt1",
"CtAlt2",
"CtBase",
"Root",
]
| 1.328125 | 1 |
main/component/database.py | nguyentranhoan/uit-mobile | 0 | 21229 | import logging
from injector import inject, singleton
from starlette.config import Config
from common.database import BaseDatabase
LOGGER = logging.getLogger(__name__)
@singleton
@inject
class MasterDatabase(BaseDatabase):
def __init__(self, config: Config) -> None:
super().__init__(config)
se... | 2.296875 | 2 |
preml/showtime/showie.py | 5amron/pre-ml | 3 | 21230 | <reponame>5amron/pre-ml
from . import baco_show
# solution === (new_dataset, best_ant_road, acc_before_run, best_fit_so_far, total_feature_num, best_selected_features_num, best_fitnesses_each_iter, average_fitnesses_each_iter ,num_of_features_selected_by_best_ant_each_iter, time_temp, sample_num)
def draw_baco(sol... | 2.625 | 3 |
PyFlow/UI/EncodeResources.py | QuentinTournier40/AnimationFreeCAD | 0 | 21231 | <reponame>QuentinTournier40/AnimationFreeCAD<filename>PyFlow/UI/EncodeResources.py
# Copyright 2015-2019 <NAME>, <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... | 2.09375 | 2 |
stix_shifter_modules/secretserver/stix_transmission/delete_connector.py | grimmjow8/stix-shifter | 129 | 21232 | from stix_shifter_utils.modules.base.stix_transmission.base_delete_connector import BaseDeleteConnector
class DeleteConnector(BaseDeleteConnector):
def __init__(self, api_client):
self.api_client = api_client
def delete_query_connection(self, search_id):
return {"success": True}
| 2.0625 | 2 |
cron/sync_cs_schedule.py | vovagalchenko/onsite-inflight | 0 | 21233 | <gh_stars>0
#!/usr/bin/env python
import sys
import pprint
from model.cs_rep import CS_Rep
from pytz import timezone, utc
from datetime import datetime, timedelta
from lib.calendar import Google_Calendar, google_ts_to_datetime, DEFAULT_DATE, LOS_ANGELES_TZ
from lib.conf import CFG
from model.db_session import DB_Sessi... | 2.40625 | 2 |
hardware/opentrons_hardware/drivers/can_bus/can_messenger.py | anuwrag/opentrons | 0 | 21234 | <filename>hardware/opentrons_hardware/drivers/can_bus/can_messenger.py
"""Can messenger class."""
from __future__ import annotations
import asyncio
from inspect import Traceback
from typing import List, Optional, Callable, Tuple
import logging
from opentrons_hardware.drivers.can_bus.abstract_driver import AbstractCanD... | 2.125 | 2 |
document.py | miguelps/web-document-scanner | 23 | 21235 | <gh_stars>10-100
import cv2
import rect
import numpy as np
class Scanner(object):
def __init__(self):
pass
def __del__(self):
pass
def auto_canny(self, image, sigma=0.33):
v = np.median(image)
lower = int(max(0, (1.0 - sigma) * v))
upper = int(min(255, (1.0 + s... | 2.609375 | 3 |
54.py | geethakamath18/Leetcode | 0 | 21236 | <reponame>geethakamath18/Leetcode<filename>54.py
#LeetCode problem 54: Spiral Matrix
class Solution:
def spiralOrder(self, matrix: List[List[int]]) -> List[int]:
if(len(matrix)==0 or len(matrix[0])==0):
return []
res=[]
rb=0
re=len(matrix)
cb=0
ce=len(matr... | 3.46875 | 3 |
pytype/pyi/parse_pyi.py | CyberFlameGO/pytype | 0 | 21237 | # python3
"""Testing code to run the typed_ast based pyi parser."""
import sys
from pytype import module_utils
from pytype.pyi import parser
from pytype.pyi.types import ParseError # pylint: disable=g-importing-member
from pytype.pytd import pytd_utils
if __name__ == '__main__':
filename = sys.argv[1]
with op... | 2.453125 | 2 |
backend/university/admin.py | andriyandrushko0/univowl | 0 | 21238 | from django.contrib import admin
from .models import *
admin.site.register(University)
admin.site.register(Faculty)
admin.site.register(Subject)
admin.site.register(Teacher)
| 1.242188 | 1 |
src/train.py | shuvoxcd01/neural_tic_tac_toe | 0 | 21239 | <filename>src/train.py
from pettingzoo.classic import tictactoe_v3
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
import tensorflow as tf
if tf.test.gpu_device_name():
print('GPU found')
else:
print("No GPU found")
from src.q_learning.agent.agent import Agent
from src.q_learning.network.dqn import DQN
fro... | 2.296875 | 2 |
app/gunicorn_settings.py | jsonbinit/jsonbinit-api | 3 | 21240 | import multiprocessing
import os
bind = "{0}:{1}".format(os.environ.get('HOST', '0.0.0.0'), os.environ.get('PORT', '8080'))
workers = os.environ.get('WORKERS', multiprocessing.cpu_count() * 2 + 1)
| 2.4375 | 2 |
tests/test_crud/conftest.py | amisadmin/fastapi_amis_admin | 166 | 21241 | <filename>tests/test_crud/conftest.py<gh_stars>100-1000
import pytest
from tests.test_crud.main import app
@pytest.fixture(scope='session', autouse=True)
def startup():
import asyncio
# asyncio.run(app.router.startup())
loop = asyncio.get_event_loop()
loop.run_until_complete(app.router.startup())
| 1.992188 | 2 |
Ehemalige/models.py | wmles/olymp | 0 | 21242 | <filename>Ehemalige/models.py<gh_stars>0
from django.db import models
""" Konzept:
Man soll sich als Ehemaliger in die DB eintragen können (Nutzeraccount
dafür nötig?)
Es gibt ein Textfeld für den Lebenslauf und die Auswahl des aktuellen Ortes
und der Tätigkeit.
ehem, das kommt mir ziemlich eng vor, so wie die alt... | 2.328125 | 2 |
market_maker/market_maker.py | Quant-Network/sample-market-maker | 0 | 21243 | <reponame>Quant-Network/sample-market-maker
from __future__ import absolute_import
from time import sleep
import sys
from datetime import datetime
from os.path import getmtime
import random
import requests
import atexit
import signal
import logging
from market_maker.bitmex import BitMEX
from market_maker.settings impo... | 1.867188 | 2 |
pythonfiles/scoring.py | amrut-prabhu/loan-default-prediction | 2 | 21244 | import numpy as np
def import_accuracy(y_test, predictions):
errors = abs(predictions - y_test)
mape = 100 * (errors / y_test)
accuracy = 100 - np.mean(mape)
return accuracy
| 2.25 | 2 |
app/core/tests/test_admin.py | ido777/newish | 0 | 21245 | <filename>app/core/tests/test_admin.py
import pytest
from django.urls import reverse
@pytest.mark.skip(reason="WIP moving to pytest tests")
def test_with_authenticated_client(client, django_user_model):
email = '<EMAIL>'
password = '<PASSWORD>'
admin_user = django_user_model.objects.create_superuser(
... | 2.4375 | 2 |
XOconv/pycgtypes/mat4.py | jsburg/xdsme | 16 | 21246 | ######################################################################
# mat4 - Matrix class (4x4 matrix)
#
# Copyright (C) 2002, <NAME> (<EMAIL>)
#
# You may distribute under the terms of the BSD license, as
# specified in the file license.txt.
###################################################################... | 2.984375 | 3 |
dataloader/data.py | yuhogun0908/Forward-Convolutive-Prediction | 3 | 21247 | import numpy as np
import os
import torch
import torch.utils.data as data
import pdb
import pickle
from pathlib import Path
from scipy import signal
import librosa
import scipy
from itertools import permutations
from numpy.linalg import solve
import numpy as np
import soundfile as sf
from convolutive_prediction import ... | 2.125 | 2 |
tests/bugs/core_4160_test.py | reevespaul/firebird-qa | 0 | 21248 | <reponame>reevespaul/firebird-qa
#coding:utf-8
#
# id: bugs.core_4160
# title: Parameterized exception does not accept not ASCII characters as parameter
# decription:
# tracker_id: CORE-4160
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
from firebird.qa import db_... | 1.679688 | 2 |
12_TreeClassification3D/main.py | ManMohan291/PyProgram | 2 | 21249 | <filename>12_TreeClassification3D/main.py
import TreeClassification as T
T.clearScreen()
dataTraining= T.loadData("dataTraining.txt")
X=dataTraining[:,0:3]
y=dataTraining[:,3:4]
Threshold=30
#Training
TrainedTree = T.SplitTree(X, y,ThresholdCount=Threshold)
newX,newY=T.PredictTree(X,y,TrainedTree)
#CheckAccuracy
Xy... | 3.203125 | 3 |
uhelpers/tests/test_archive_helpers.py | Johannes-Sahlmann/uhelpers | 0 | 21250 | <filename>uhelpers/tests/test_archive_helpers.py
#!/usr/bin/env python
"""Tests for the jwcf hawki module.
Authors
-------
<NAME>
"""
import netrc
import os
from astropy.table import Table
import pytest
from ..archive_helpers import get_exoplanet_orbit_database, gacs_list_query
local_dir = os.path.dirname(os.p... | 2.3125 | 2 |
TP3/test.py | paul-arthurthiery/IAMethodesAlgos | 0 | 21251 | <filename>TP3/test.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 2 14:33:13 2018
@author: Nathan
"""
import numpy as np
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
# load dataset
data,target =... | 2.578125 | 3 |
HUGGINGFACE.py | mkingopng/NBME_score_clinical_patient_notes | 1 | 21252 | import os
TRANSFORMERS = '/home/noone/documents/github/transformers'
TOKENIZERS = '/home/noone/documents/github/tokenizers'
DATASETS = '/home/noone/documents/github/datasets'
MODELS = os.path.join(TRANSFORMERS, 'src/transformers/models')
DEBERTA_V2 = os.path.join(MODELS, 'deberta_v2')
DEBERTA_V3 = os.path.join(MO... | 1.257813 | 1 |
Curso_em_Video_Exercicios/ex068.py | Cohuzer/Exercicios-do-Curso-em-Video | 0 | 21253 | #Par ou Impar- para qnd o jogador perder e mostra o tanto de vitoria consecutivas
from random import randint
c = 0
while True:
print('\033[1;33m-' * 30)
n = int(input('ESCOLHA UM NÚMERO: '))
e = str(input('PAR OU IMPAR? ')).strip().upper()[0]
print('-' * 30)
j = randint(0, 10)
if e == 'P':
... | 3.625 | 4 |
tests/test_write.py | AlexsanderShaw/libdesock | 88 | 21254 | """
This file tests that sendmmsg works correctly.
Target files:
- libdesock/src/write.c
"""
import ctypes
import desock
import helper
data = bytes(range(65, 115))
cursor = 0
def _get_data(size):
global cursor
ret = bytes(data[cursor: cursor + size])
assert(len(ret) == size)
cursor += size
r... | 2.171875 | 2 |
ratin_cpython/common/common.py | openearth/eo-rivers | 2 | 21255 | <filename>ratin_cpython/common/common.py
import numpy as np
from math import factorial
import scipy.signal
#Gaussian filter with convolution - faster and easier to handle
## Degree is equal to the number of values left and right of the central value
## of the gaussian window:
## ie degree=3 yields a window of length... | 3.1875 | 3 |
discordbot/stocks/technical_analysis/rsi.py | Aerex/GamestonkTerminal | 3 | 21256 | <reponame>Aerex/GamestonkTerminal<filename>discordbot/stocks/technical_analysis/rsi.py
import os
from datetime import datetime, timedelta
import discord
from matplotlib import pyplot as plt
import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers
from gamest... | 2.671875 | 3 |
train.py | xushenkun/vae | 1 | 21257 | import argparse
import os
import shutil
import numpy as np
import torch as t
from torch.optim import Adam
from utils.batch_loader import BatchLoader
from utils.parameters import Parameters
from model.rvae_dilated import RVAE_dilated
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='RV... | 2.1875 | 2 |
renovation_core_graphql/auth/otp.py | e-lobo/renovation_core_graphql | 1 | 21258 | <reponame>e-lobo/renovation_core_graphql
from graphql import GraphQLResolveInfo
import frappe
from renovation_core.utils.auth import generate_otp, verify_otp
VERIFY_OTP_STATUS_MAP = {
"no_linked_user": "NO_LINKED_USER",
"no_otp_for_mobile": "NO_OTP_GENERATED",
"invalid_otp": "INVALID_OTP",
"verified... | 1.960938 | 2 |
solaris/utils/core.py | mananeau/solaris | 0 | 21259 | <filename>solaris/utils/core.py
import os
import numpy as np
from shapely.wkt import loads
from shapely.geometry import Point
from shapely.geometry.base import BaseGeometry
import pandas as pd
import geopandas as gpd
import rasterio
import skimage
from fiona._err import CPLE_OpenFailedError
from fiona.errors import Dri... | 2.078125 | 2 |
model/__init__.py | Pearl-UTexas/DUST-net | 0 | 21260 | from .von_mises_stiefel import *
from .von_mises_fisher import *
from .model import *
from .metrics import *
from .loss import *
| 1.101563 | 1 |
blog_app/templatetags/blog_app_tags.py | axkiss/FirstBlog | 0 | 21261 | <gh_stars>0
from django import template
from blog_app.models import Post
from django.utils import timezone
register = template.Library()
@register.simple_tag(name='list_tags')
def get_list_tags(pos, cnt_head_tag, cnt_side_tag):
list_tags = Post.tag.most_common()
if pos == 'head':
return list_tags[:cn... | 2.25 | 2 |
flow/core/azure_blob_filesystem.py | hwknsj/synergy_flow | 0 | 21262 | __author__ = '<NAME>'
from os import path
from azure.storage.blob import BlockBlobService
from flow.core.abstract_filesystem import AbstractFilesystem, splitpath
class AzureBlobFilesystem(AbstractFilesystem):
""" implementation of Azure Page Blob filesystem
https://docs.microsoft.com/en-us/azure/storage/b... | 2.421875 | 2 |
asyncworker/types/registry.py | etandel/async-worker | 0 | 21263 | <reponame>etandel/async-worker
from typing import Type, Any, Dict, Optional
class RegistryItem:
def __init__(self, type: Type, value: Any) -> None:
self.type = type
self.value = value
class TypesRegistry:
def __init__(self):
self.__data: Dict[Type, RegistryItem] = {}
self.__b... | 2.3125 | 2 |
kpe/BertKPE/MyCode/functions/filer/filesaver.py | thunlp/COVID19IRQA | 32 | 21264 | <filename>kpe/BertKPE/MyCode/functions/filer/filesaver.py
from tqdm import tqdm
import json
import os
def save_jsonl(data_list, filename):
with open(filename, 'w', encoding='utf-8') as fo:
for data in data_list:
fo.write("{}\n".format(json.dumps(data)))
fo.close()
print("Success sav... | 2.921875 | 3 |
tests/conftest.py | HenryTraill/morpheus | 0 | 21265 | import asyncio
import pytest
import re
import uuid
from aiohttp.test_utils import teardown_test_loop
from aioredis import create_redis
from arq import ArqRedis, Worker
from atoolbox.db import prepare_database
from atoolbox.db.helpers import DummyPgPool
from atoolbox.test_utils import DummyServer, create_dummy_server
fr... | 1.835938 | 2 |
gratify_proj/gratify_proj/urls.py | ConnorH2582/grat_proj | 0 | 21266 | from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import View
urlpatterns = [
url(r'^client/', include('client.urls', namespace = 'client', app_name = 'client')),
url(r'^app/', include('app.urls', namespace = 'app', app_name = 'app')),
url('', include('django.... | 1.726563 | 2 |
Server/prediction/admin.py | mohanj098/Item-Price-Forecasting | 0 | 21267 | <filename>Server/prediction/admin.py<gh_stars>0
from django.contrib import admin
from prediction.models import product
from prediction.models import price
# Register your models here.
admin.site.register(product)
admin.site.register(price)
| 1.40625 | 1 |
imutils/big/make_shards.py | JacobARose/image-utils | 0 | 21268 | """
imutils/big/make_shards.py
Generate one or more webdataset-compatible tar archive shards from an image classification dataset.
Based on script: https://github.com/tmbdev-archive/webdataset-examples/blob/7f56e9a8b978254c06aa0a98572a1331968b0eb3/makeshards.py
Added on: Sunday March 6th, 2022
Example usage:
pytho... | 2.484375 | 2 |
wetterdienst/util/network.py | meteoDaniel/wetterdienst | 0 | 21269 | # -*- coding: utf-8 -*-
# Copyright (c) 2018-2021, earthobservations developers.
# Distributed under the MIT License. See LICENSE for more info.
import os
from io import BytesIO
from typing import List, Optional, Union
from fsspec.implementations.cached import WholeFileCacheFileSystem
from fsspec.implementations.http ... | 2.09375 | 2 |
mode/examples/Topics/Motion/Reflection1/Reflection1.pyde | kazimuth/processing.py | 4 | 21270 | <reponame>kazimuth/processing.py<filename>mode/examples/Topics/Motion/Reflection1/Reflection1.pyde
"""
Non-orthogonal Reflection
by <NAME>.
Based on the equation (R = 2N(N * L) - L) where R is the reflection vector, N
is the normal, and L is the incident vector.
"""
# Position of left hand side of floor.
base1 = None... | 2.8125 | 3 |
linear.py | AliRzvn/HW1 | 0 | 21271 | <reponame>AliRzvn/HW1
import numpy as np
from module import Module
class Linear(Module):
def __init__(self, name, input_dim, output_dim, l2_coef=.0):
super(Linear, self).__init__(name)
self.l2_coef = l2_coef # coefficient of l2 regularization.
self.W = np.random.randn(input_dim, output_... | 3.359375 | 3 |
iot/common_functions/all_imports.py | sankaet/IOT-DB | 1 | 21272 | from pymongo import MongoClient
from bson import ObjectId
from bson.json_util import dumps
from json import loads
client = MongoClient('localhost', 27017)
IOT_DB = client.iot_db
IOT_SCHEMAS = IOT_DB.iot_schemas
IOT_DATA = IOT_DB.iot_data | 2.25 | 2 |
pages/login_page.py | 0verchenko/PageObject | 0 | 21273 | <reponame>0verchenko/PageObject
from .base_page import BasePage
from .locators import LoginPageLocators
class LoginPage(BasePage):
def should_be_login_page(self):
self.should_be_login_url()
self.should_be_login_form()
self.should_be_register_form()
def should_be_login_url(self):
... | 2.671875 | 3 |
tests/test_schema.py | LeafyLappa/starlette-jsonapi | 16 | 21274 | <filename>tests/test_schema.py
import pytest
from marshmallow_jsonapi import fields
from starlette.applications import Starlette
from starlette_jsonapi.resource import BaseResource
from starlette_jsonapi.schema import JSONAPISchema
def test_schema_urls(app: Starlette):
class TResource(BaseResource):
type... | 2.25 | 2 |
demo/demo/settings.py | ikcam/django-boilerplate | 5 | 21275 | # -*- coding: utf-8 -*-
"""
Django settings for demo project.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
# Build paths inside the project like this: os.path.j... | 1.773438 | 2 |
pem_recover.py | EggPool/gpg-experiments | 0 | 21276 | from Cryptodome.PublicKey import RSA
import hashlib
import json
def recover(key):
private_key_readable = key.exportKey().decode("utf-8")
public_key_readable = key.publickey().exportKey().decode("utf-8")
address = hashlib.sha224(public_key_readable.encode("utf-8")).hexdigest()
wallet_dict = {}
wal... | 2.890625 | 3 |
arcade/python/arcade-theCore/06_LabyrinthOfNestedLoops/043_IsPower.py | netor27/codefights-arcade-solutions | 0 | 21277 | def isPower(n):
'''
Determine if the given number is a power of some non-negative integer.
'''
if n == 1:
return True
sqrt = math.sqrt(n)
for a in range(int(sqrt)+1):
for b in range(2, int(sqrt)+1):
if a ** b == n:
return True
return False | 4.28125 | 4 |
plugins/pick/choices.py | rbracken/internbot | 1 | 21278 | <reponame>rbracken/internbot
# Add your own choices here!
fruit = ["apples", "oranges", "pears", "grapes", "blueberries"]
lunch = ["pho", "timmies", "thai", "burgers", "buffet!", "indian", "montanas"]
situations = {"fruit":fruit, "lunch":lunch}
| 2.46875 | 2 |
testing.py | blairg23/rename-images-to-datetime | 0 | 21279 | '''
Stolen straight from https://stackoverflow.com/a/51337247/1224827
'''
try:
import PIL
import PIL.Image as PILimage
from PIL import ImageDraw, ImageFont, ImageEnhance
from PIL.ExifTags import TAGS, GPSTAGS
import os
import glob
except ImportError as err:
exit(err)
class Worker(object):
... | 2.546875 | 3 |
tftool/access/__init__.py | antsfamily/tftool | 0 | 21280 | <filename>tftool/access/__init__.py
from __future__ import absolute_import
from .load import load_ckpt
from .save import save_ckpt
| 1.132813 | 1 |
scripts/box3d_trpo/sweep_ddpg_0.py | fredshentu/public_model_based_controller | 0 | 21281 | <filename>scripts/box3d_trpo/sweep_ddpg_0.py<gh_stars>0
import os
from rllab.envs.normalized_env import normalize
from rllab.misc.instrument import stub, run_experiment_lite
from sandbox.rocky.tf.envs.base import TfEnv
from rllab.envs.gym_env import GymEnv
from railrl.algos.ddpg import DDPG
from railrl.policies.nn_pol... | 1.625 | 2 |
tests/test_engine.py | popravich/hiku | 0 | 21282 | <filename>tests/test_engine.py
import re
import pytest
from hiku import query as q
from hiku.graph import Graph, Node, Field, Link, Option, Root
from hiku.types import Record, Sequence, Integer, Optional, TypeRef
from hiku.utils import listify
from hiku.engine import Engine, pass_context, Context
from hiku.builder im... | 2.125 | 2 |
helper.py | b-nguyen/cs3240-labdemo | 0 | 21283 | __author__ = '<NAME>'
def greeting(msg):
print("We would like to say: " + msg) | 2.390625 | 2 |
twitter_verified_blocker.py | antoinemcgrath/twitter_blocker_tool | 0 | 21284 | #!/usr/bin/python3
#### A tool for blocking all verified users on Twitter.
## You may want to create a (public or private) Twitter list named 'exceptions' and add verified users to it.
## This 'exceptions' list that you create on Twitter is for verified accounts that you like and do not want to block.
#### Import dep... | 3 | 3 |
src/pktmapper/common.py | Sapunov/pktmapper | 0 | 21285 | <filename>src/pktmapper/common.py
"""
Common functions
---
Package: PACKET-MAPPER
Author: <NAME> <<EMAIL>>
"""
import netaddr
import socket
def ip2str(address):
"""
Print out an IP address given a string
Args:
address (inet struct): inet network address
Returns:
str: Printable/reada... | 2.984375 | 3 |
custom_packages/CustomNeuralNetworks/test_CustomNeuralNetworks/test_resnet50_unet.py | davidelomeo/mangroves_deep_learning | 0 | 21286 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This script tests the function that builds the Un-Net model combined
# with the ResNet50 model as an encoder. The test does not look for
# numerical values but checks if the model returns am object or not.
# This is because there are several tests within the ... | 2.875 | 3 |
htb/Knife/exploit/49933.py | oonray/Notes | 0 | 21287 | # Exploit Title: PHP 8.1.0-dev - 'User-Agentt' Remote Code Execution
# Date: 23 may 2021
# Exploit Author: flast101
# Vendor Homepage: https://www.php.net/
# Software Link:
# - https://hub.docker.com/r/phpdaily/php
# - https://github.com/phpdaily/php
# Version: 8.1.0-dev
# Tested on: Ubuntu 20.04
# References:
... | 2.078125 | 2 |
flashcards/cli.py | elliott-king/flashcards | 0 | 21288 | """
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -mflashcards` python will execute
``__main__.py`` as a... | 2.546875 | 3 |
C2C/simple_server.py | muhammedabdelkader/python_collection | 0 | 21289 | import aiohttp
import asyncio
import time
start_time = time.time()
async def get_pokemon(session,url):
async with session.get(url) as resp:
pokemon = await resp.json()
return pokemon["name"]
async def main():
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(limit=64,verif... | 3.0625 | 3 |
Important_data/Thesis figure scripts/six_sigmoids.py | haakonvt/LearningTensorFlow | 5 | 21290 | <gh_stars>1-10
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)
rc('legend',**{'fontsize':11}) # Font size for legend
from mpl_toolkits.axes_grid.axislines import SubplotZero
import matplotlib as mpl
mpl.rcParams['lines.linewidth'] = 2.5
import matplotli... | 2.640625 | 3 |
src/web/modules/search/controllers/search/control.py | unkyulee/elastic-cms | 2 | 21291 | import json
import urllib2
import traceback
import cgi
from flask import render_template, request
import web.util.tools as tools
import lib.http as http
import lib.es as es
from web import app
from lib.read import readfile
def get(p):
host = p['c']['host']; index = p['c']['index'];
# debug
p['debug'] = ... | 2.515625 | 3 |
Go6/policy_probabilistic_player.py | skyu0221/cmput496 | 0 | 21292 | <gh_stars>0
#!/usr/bin/python3
from board_util import GoBoardUtil
from gtp_connection import GtpConnection
class PolicyPlayer(object):
"""
Plays according to the Go4 playout policy.
No simulations, just random choice among current policy moves
"""
version = 0.1
name = "Policy Probabil... | 2.453125 | 2 |
test_models.py | ChirilaLaura/covid-z | 2 | 21293 | <gh_stars>1-10
from keras.preprocessing.image import img_to_array
from keras.models import load_model
import numpy as np
import argparse
import imutils
import cv2
ap = argparse.ArgumentParser()
ap.add_argument("-m1", "--model1", required=True, help="path to model1")
ap.add_argument("-m2", "--model2", required=True, h... | 2.75 | 3 |
src/settings.py | MichaelJWelsh/bot-evolution | 151 | 21294 | <reponame>MichaelJWelsh/bot-evolution
"""
This module contains the general settings used across modules.
"""
FPS = 60
WINDOW_WIDTH = 1100
WINDOW_HEIGHT = 600
TIME_MULTIPLIER = 1.0
| 0.863281 | 1 |
katana-nbi/katana/api/nfvo.py | afoteas/katana-slice_manager | 0 | 21295 | # -*- coding: utf-8 -*-
import logging
from logging import handlers
import pickle
import time
import uuid
from bson.binary import Binary
from bson.json_util import dumps
from flask import request
from flask_classful import FlaskView
import pymongo
from requests import ConnectTimeout, ConnectionError
from katana.share... | 2.1875 | 2 |
helpers.py | mochja/ISA-DNS | 0 | 21296 | import threading
import traceback
import socketserver
import struct
import time
import sys
import http.client
import json
import uuid
import config
import dns.rdatatype
import dns.rdataclass
args = config.args
QTYPES = {1:'A', 15: 'MX', 6: 'SOA'}
custom_mx = uuid.uuid4().hex
# https://github.com/shuque/pydig GNUv2... | 2.46875 | 2 |
convert/templatetags/convert_tags.py | aino/aino-convert | 1 | 21297 | <reponame>aino/aino-convert<filename>convert/templatetags/convert_tags.py<gh_stars>1-10
from django.template import Library, Node, TemplateSyntaxError
from django.utils.encoding import force_unicode
from convert.base import MediaFile, EmptyMediaFile, convert_solo
from convert.conf import settings
register = Lib... | 2.125 | 2 |
tests/utils_test.py | lovetrading10/tda-api | 7 | 21298 | from unittest.mock import MagicMock
import datetime
import json
import unittest
from tda.orders import EquityOrderBuilder
from tda.utils import Utils
from . import test_utils
class MockResponse:
def __init__(self, json, ok, headers=None):
self._json = json
self.ok = ok
self.headers = hea... | 2.484375 | 2 |
aiida/orm/entities.py | PercivalN/aiida-core | 1 | 21299 | <reponame>PercivalN/aiida-core
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 1.882813 | 2 |