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 |
|---|---|---|---|---|---|---|
vanila_rnn.py | spencerpomme/torchlight | 0 | 12796851 | """
Minimal character-level Vanilla RNN model. Written b_y <NAME> (@karpathy)
BSD License
"""
import numpy as np
import unicodedata
import string
import codecs
# data I/O
data = codecs.open('data/potter.txt', 'r', encoding='utf8', errors='ignore').read()
fake = codecs.open('data/output.txt', 'w', encoding='utf8')
char... | 3.125 | 3 |
GeneralOutputAnalysis_FLYCOP/Utilities/FitnessRanks.py | ivanmm25/FLYCOPtools | 1 | 12796852 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 21 21:20:59 2021
@author: <NAME>
"""
"""
OUTPUT ANALYSIS AFTER FLYCOP (UTILITIES)
DESCRIPTION
ORGANIZATION OF FITNESS RANKS & ASSOCIATED STATS DESCRIPTION
Series of functions to define and process fitness ranks (utility for scripts related... | 3 | 3 |
core/tests/test_trezor.crypto.hashlib.sha3_512.py | Kayuii/trezor-crypto | 0 | 12796853 | <gh_stars>0
from common import *
from trezor.crypto import hashlib
class TestCryptoSha3_512(unittest.TestCase):
# vectors from http://www.di-mgt.com.au/sha_testvectors.html
vectors = [
(b'', 'a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6... | 2.375 | 2 |
bot/bot_manager.py | NgLamVN/HiBot | 0 | 12796854 | <reponame>NgLamVN/HiBot<gh_stars>0
from discord.ext import commands
from bot_constant import bot_constant
from command_handler import command_handler
from bot_listener import bot_listener
class bot_manager:
def __init__(self):
self.bot = commands.Bot(command_prefix=bot_constant.bot_prefix, descr... | 2.359375 | 2 |
statistics_check.py | bugo99iot/airbnb_k_nearest | 9 | 12796855 | <filename>statistics_check.py<gh_stars>1-10
import pandas as pd
import numpy as np
from scipy.spatial import distance
import sys
import json
import math
columns = ["price", "room_type", "accommodates", "bedrooms", "bathrooms", "beds", "number_of_reviews", "latitude", "longitude", "review_scores_value"]
#load cities' ... | 3.203125 | 3 |
13975.py | WaiNaat/BOJ-Python | 0 | 12796856 | import sys
input = sys.stdin.readline
import heapq as hq
# input
t = int(input())
for _ in range(t):
chapter = int(input())
pages = list(map(int, input().split()))
# process
'''
각 장이 섞여도 됨.
>> 힙에서 제일 작은 거 두 개 합치고 다시 넣음.
'''
sol = 0
hq.heapify(pages)
for _ in range(chapter - 1):
cost = hq.heappop(pages) + hq.... | 3.0625 | 3 |
pypesto/result/optimize.py | m-philipps/pyPESTO | 0 | 12796857 | """Optimization result."""
import warnings
from collections import Counter
from copy import deepcopy
from typing import Sequence, Union
import numpy as np
import pandas as pd
from ..objective import History
from ..problem import Problem
from ..util import assign_clusters, delete_nan_inf
OptimizationResult = Union['... | 2.9375 | 3 |
lecture_dl_21_examples/002_cifar10/01_dataset_test.py | Daniel1586/Initiative_tensorflow_tutorials | 1 | 12796858 | <filename>lecture_dl_21_examples/002_cifar10/01_dataset_test.py<gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import tensorflow as tf
if not os.path.exists('example_pic'):
os.makedirs('example_pic/')
with tf.Session() as sess:
filename = ['A.jpg', 'B.jpg', 'C.jpg']
# string_input_prod... | 2.625 | 3 |
tests/test_q0505.py | mirzadm/ctci-5th-py | 0 | 12796859 | <filename>tests/test_q0505.py
"""Unit tests for q0505.py."""
import unittest
from src.q0505 import count_unequal_bits
class TestCountUnequalBits(unittest.TestCase):
def test_count_unequal_bits(self):
self.assertRaises(ValueError, count_unequal_bits, -1, 1)
self.assertEqual(count_unequal_bits(0b... | 2.5 | 2 |
mafComparator/comparatorSummarizer.py | dadidange/mafTools | 0 | 12796860 | <gh_stars>0
#!/usr/bin/env python
"""
comparatorSummarizer.py
dent earl, dearl (a) soe ucsc edu
22 November 2011
Simple utility to summarize output of mafComparator
for use with alignathon competetition.
"""
# Note: Actually belongs to https://github.com/dentearl/mwgAlignAnalysis
# but was moved in here for convenie... | 1.765625 | 2 |
tests/test_blocks.py | regulusweb/wagtail-extensions | 3 | 12796861 | import datetime
import pytest
from unittest.mock import patch
from django.core.exceptions import ValidationError
from freezegun import freeze_time
from phonenumber_field.phonenumber import PhoneNumber
from wagtail.core.models import Page
from wagtail_extensions.blocks import (
DepartmentBlock, ImagesBlock, LinkBl... | 2.140625 | 2 |
django_workflow_system/utils/response_schema_handlers/__init__.py | eikonomega/django-workflow-system | 2 | 12796862 | """Convenience imports."""
from .date_range_question import get_response_schema as date_range_question_schema
from .free_form_question import get_response_schema as free_form_question_schema
from .multiple_choice_question import (
get_response_schema as multiple_choice_question_schema,
)
from .numeric_range_questio... | 1.0625 | 1 |
utils/start.py | shadowcompiler/Jo | 0 | 12796863 | <filename>utils/start.py
# coding:utf-8
# open start message file
start_file = open('ressources/start.txt', 'r', encoding='utf-8')
message = start_file.read()
start_file.close()
| 2.078125 | 2 |
bluebird/sim_client/bluesky/sim_client.py | rkm/bluebird | 8 | 12796864 | """
BlueSky simulation client class
"""
# TODO: Need to re-add the tests for string parsing/units from the old API tests
import os
from typing import List
from semver import VersionInfo
from .bluesky_aircraft_controls import BlueSkyAircraftControls
from .bluesky_simulator_controls import BlueSkySimulatorControls
from... | 2.546875 | 3 |
Stability.py | ahmadborzou/Study_DM_in_Galaxies-master | 0 | 12796865 | <reponame>ahmadborzou/Study_DM_in_Galaxies-master<gh_stars>0
"""
Created on May 19 2019
author : <NAME>, PhD
email : <EMAIL>
affiliation: Baylor University
"""
import numpy as np
from Galaxies import profile
import Constants as co
import Inputs as ins
import warnings
## a galaxy(DM mass,n0,T0)
gal = prof... | 2.265625 | 2 |
gerateData_RuleClass.py | rafael-veiga/Classification-algorithm-of-Congenital-Zika-Syndrome-characterizations-diagnosis-and-validation | 0 | 12796866 | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 27 08:49:21 2020
@author: rafae
"""
import pandas as pd
import numpy as np
def gerarbanco():
banco = pd.read_stata("Microcefalia MS analysis 20160609.dta")
circ = pd.read_csv("circumference.csv",sep=";",index_col='sem')
banco.index = range(... | 2.53125 | 3 |
itertools_ex.py | byaka/functionsEx_new | 0 | 12796867 | <gh_stars>0
# -*- coding: utf-8 -*-
import types, collections
"""
Collection of methods for working with Generators, which respects `yield .. send ..` ability.
"""
def gExtend(prepend, g, append=None):
_gType=types.GeneratorType
_iType=collections.Iterable
if not isinstance(g, _gType):
raise TypeError(... | 2.859375 | 3 |
iseq/gencode.py | EBI-Metagenomics/iseq | 0 | 12796868 | <filename>iseq/gencode.py
# NCBI genetic code table version 4.6
from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple
__all__ = ["GeneticCode"]
genetic_codes: List[Tuple[str, str, int]] = []
names: Dict[str, int] = {}
alt_names: Dict[str, int] = {}
ids: Dict[int, int] = {}
@dataclass
clas... | 2.484375 | 2 |
questions/permutations/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 12796869 | '''
Given a collection of distinct integers, return all possible permutations.
Example:
Input: [1,2,3]
Output:
[
[1,2,3],
[1,3,2],
[2,1,3],
[2,3,1],
[3,1,2],
[3,2,1]
]
'''
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
def generate_permutation(nums, ret, curr, visited... | 3.8125 | 4 |
Redis/sentinel.py | Oliver-Yan-2019/algorithm | 1 | 12796870 | from redis import StrictRedis
class SentinelClient(object):
def __init__(self, url, db=None, name='default', health_check_interval=30):
"""create a redis client.
Args:
url: redis server url.
db: redis database, default 0.
name: client name, default 'default'.
... | 2.90625 | 3 |
pymaster/field.py | LSSTDESC/NaMaster | 37 | 12796871 | <reponame>LSSTDESC/NaMaster
from pymaster import nmtlib as lib
import numpy as np
from pymaster.utils import NmtWCSTranslator
class NmtField(object):
"""
An NmtField object contains all the information describing the fields to
correlate, including their observed maps, masks and contaminant templates.
... | 2.515625 | 3 |
data-structures/p482.py | sajjadt/competitive-programming | 10 | 12796872 | <filename>data-structures/p482.py
from os import linesep
num_tests = int(input())
for i in range(num_tests):
input()
perms = list(map(int, input().split()))
nums = list(map(str, input().split()))
out = [0] * len(perms)
for j in range(len(perms)):
out[perms[j]-1] = str(nums[j])
print(linesep.join(ou... | 3.109375 | 3 |
gem/constants.py | praekeltfoundation/Molo-Merge-CMS-Scratchpad | 1 | 12796873 | from django.utils.translation import ugettext_lazy as _
MALE = "m"
FEMALE = "f"
UNSPECIFIED = "-"
GENDERS = {(MALE, _("male")),
(FEMALE, _("female")),
(UNSPECIFIED, _("don't want to answer"))}
| 1.9375 | 2 |
BaseTools/PythonLibrary/Uefi/Capsule/CatGenerator_test.py | StefMa/mu_basecore | 0 | 12796874 | import os
import logging
import unittest
from Uefi.Capsule.CatGenerator import *
#must run from build env or set PYTHONPATH env variable to point to the PythonLibrary folder
class CatGeneratorTest(unittest.TestCase):
def test_win10_OS(self):
o = CatGenerator("x64", "win10")
self.assertEqual(o.OperatingSyst... | 2.5 | 2 |
src/goa/utils.py | deeplego/goa | 0 | 12796875 | import numpy as np
import matplotlib.pyplot as plt
from typing import Tuple, Union, TypeVar, Iterable, Dict
from goa import problems
T = TypeVar("T")
def plot_population(
problem: problems.BaseProblem,
X: Union[T, Iterable[T]],
ax: plt.Axes = None,
c: str = "darkblue",
linestyle: str = ":",
... | 2.890625 | 3 |
generate_crypto_key.py | erictapia/cryptography | 0 | 12796876 | # Standard library
import os
from pathlib import Path
# Third party
from cryptography.fernet import Fernet
from dotenv import load_dotenv
# Constants
CRYPTO_KEY_ENV_VAR = 'CRYPTO_KEY'
ENV_VAR_EXIST = f'The {CRYPTO_KEY_ENV_VAR} environment variable already exist. Cannot continue as the crypto key may still be in use.... | 2.578125 | 3 |
getelhid.py | dlindem/ahotsak-wikibase | 0 | 12796877 | import csv
import config
import awb
infilename = config.datafolder+'wikidata/wdlid_ElhId.csv'
resourceitem = "Q19" #Q19: Elhuyar
#positem = "Q8" # Q7: substantibo, Q8: aditza
with open(infilename, encoding="utf-8") as csvfile:
sourcedict = csv.DictReader(csvfile)
lex_elh = {}
for row in sourcedict:
lex_elh[row['... | 2.484375 | 2 |
tests/test_calculations.py | godzilla-but-nicer/cellularautomata | 0 | 12796878 | import numpy as np
from casim.calculations import word_entropy
def test_word_entropy():
test_arr = np.array([1, 0, 0, 1, 1, 0, 1, 0])
assert np.round(word_entropy(test_arr, 3), decimals=1) == 2.5
| 2.484375 | 2 |
mtp_api/apps/security/migrations/0018_auto_20181003_1117.py | ministryofjustice/mtp-api | 5 | 12796879 | <reponame>ministryofjustice/mtp-api
# Generated by Django 2.0.8 on 2018-10-03 10:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('prison', '0016_auto_20171121_1110'),
('security', '0017_auto_20180914_1613'),
]
operations = [
m... | 1.585938 | 2 |
main.py | LCRT215/Conways-Game-of-Life | 0 | 12796880 | <filename>main.py
import pygame
import sys
from game_window_class import *
WIDTH, HEIGHT = 800, 800
BACKGROUND = (33, 47, 60)
#initial game setup
def get_events():
global running
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
def update():
game_window.u... | 3.25 | 3 |
mp_calc/app/serverlibrary.py | seancze/d2w_mini_project_mp_sort | 0 | 12796881 | <gh_stars>0
def mergesort(array, byfunc=None):
if len(array) > 1:
start, end = 0, len(array)
mid = len(array) // 2
left = array[start:mid]
right = array[mid:end]
i, j, k = 0, 0, 0
# Sort recursively (I.e. Starting from 2 elements)
mergesort(left, byfunc=byfunc)
mergesort(right,... | 3.71875 | 4 |
seqseqpan/modifier.py | sekang2/seq-seq-pan | 0 | 12796882 | <reponame>sekang2/seq-seq-pan<gh_stars>0
import collections
import itertools
from operator import itemgetter
import math
from Bio import pairwise2
from seqseqpan.base import *
class Separator:
def separate_lcbs(self, alignment, length):
separated = Alignment(alignment.xmfa_file)
for nr, genome i... | 2.6875 | 3 |
generator/txmultivariablegenerator.py | zarppy/MUREIL_2014 | 0 | 12796883 | <filename>generator/txmultivariablegenerator.py
#
#
# Copyright (C) University of Melbourne 2013
#
#
#
#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 with... | 2.078125 | 2 |
backend/app/controllers/interval_controller.py | codestrange/calendario-matcom | 8 | 12796884 | from flask import jsonify
from . import api
from ..database import Interval
@api.route('/intervals')
def get_intervals():
intervals = Interval.query.all()
return jsonify([{
'id': interval.id,
'name': interval.name,
'start': str(interval.start),
'end': str(interval.end)
} fo... | 2.640625 | 3 |
ImgEdit.py | yujiecong/PyQt-Digit-Image-Process | 3 | 12796885 | class Edit:
@staticmethod
| 1.25 | 1 |
tests/unit/asynchronous/test_expand_dict.py | GQMai/mbed-cloud-sdk-python | 12 | 12796886 | from mbed_cloud.subscribe.subscribe import expand_dict_as_keys
from tests.common import BaseCase
class Test(BaseCase):
def test_empty(self):
self.assertEqual(expand_dict_as_keys(dict()), [
tuple()
])
def test_static(self):
self.assertEqual(expand_dict_as_keys(dict(a=1, b=... | 2.296875 | 2 |
other/py/dmopc14c5p4.py | tylertian123/CompSciSolutions | 0 | 12796887 | n, m = input().split()
n = int(n)
m = int(m)
good = []
bad = []
for _ in range(n):
s, p = input().split()
if p == "1":
bad.append(int(s))
else:
good.append(int(s))
good.sort()
bad.sort()
prot = 0
space = 0
gi = 0
bi = 0
while space < m:
g = good[gi] if gi < len(good) else None
b = ... | 3.28125 | 3 |
src/components/kankeiforms/__init__.py | BigJerBD/Kankei-Backend | 0 | 12796888 | <reponame>BigJerBD/Kankei-Backend<gh_stars>0
from components.kankeiforms.kankeiform import KankeiForm
def init(config):
KankeiForm.timeout = config.DB_TIMEOUT_SEC
from . import exploration
from . import comparison
from . import random
def get_kankeiforms(config):
init(config)
return KankeiFo... | 2.3125 | 2 |
Roller.py | AndrewTruett/histogrammer | 0 | 12796889 | <gh_stars>0
from Roll import Roll
class Roller:
def __init__(self, user):
self._rolls = []
self._user = user
def add_roll(self, roll):
self._rolls.append(roll)
def clear_rolls(self):
self._rolls = []
@property
def rolls(self):
return self._rolls
... | 2.75 | 3 |
openmm/plot_osmp.py | aakognole/osmp-calc | 0 | 12796890 | import numpy as np
import matplotlib.pyplot as plt
import glob
from sys import argv
from os.path import exists as file_exists
methods = ['drude', 'c36']
mol1, mol2 = str(argv[1]), str(argv[2])
sysname = mol1+'_'+mol2
def blockavg(x,nblocks=30):
lblock = int(len(x)/nblocks)
m = []
for i in range(nblocks):
... | 2.375 | 2 |
training/data_lib.py | vsewall/frame-interpolation | 521 | 12796891 | # Copyright 2022 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... | 2.078125 | 2 |
7 kyu/Consecutive letters.py | mwk0408/codewars_solutions | 6 | 12796892 | def solve(s):
s=list(s)
s.sort()
s=''.join(s)
if len(s)==1:
return True
for i in range(1,len(s),1):
if ord(s[i])-ord(s[i-1])!=1:
return False
return True | 3.125 | 3 |
Homework/BAB_homework_task2.py | kc9jud/ShellCorretta | 0 | 12796893 | import matplotlib.pyplot as plt
import numpy as np
#returns the binding energy predicted by nuclear liquid drop model
def BE_liquidDrop(N,Z): #N=num of neutrons, Z=num of protons
#num of nucleons
A = N+Z
#physical constants (from Alex's notes, in MeV)
a1 = 15.49
a2 = 17.23
a3 = 0.697
a4 = 22.6
#nuclear li... | 2.859375 | 3 |
src/DNAAnimBuilding.py | Toonerz/libdna | 1 | 12796894 | <reponame>Toonerz/libdna<filename>src/DNAAnimBuilding.py
from pandac.PandaModules import *
from panda3d.core import *
from DNAInteractiveProp import DNAInteractiveProp
class DNAAnimBuilding(DNAInteractiveProp):
def __init__(self):
DNAInteractiveProp.__init__(self)
self.anim = ''
def setAnim(self, anim):
self.... | 1.75 | 2 |
tests/__init__.py | ymber/surface | 5 | 12796895 | """
Surface control station tests.
"""
| 0.890625 | 1 |
gcraft/application/wx.py | ddomurad/gcraft | 0 | 12796896 | <gh_stars>0
from OpenGL.GLUT import *
from gcraft.core.app import GCraftApp
from gcraft.core.input_event import InputEvent
import wx
from wx import glcanvas
class GCraftCanvas(wx.glcanvas.GLCanvas):
def __init__(self, parent: wx.Window, gc_app: GCraftApp):
wx.glcanvas.GLCanvas.__init__(self, parent, -1)
... | 1.984375 | 2 |
lr.py | xyk2000/LogisticsRegression | 1 | 12796897 | <reponame>xyk2000/LogisticsRegression<filename>lr.py
import numpy as np
np.random.seed(10)
def sigmoid(x):
return 1 / (1 + np.exp(-x))
class LogisticsReg():
def __init__(self,learn_rate=1e-3,niter=100000):
self.lr=learn_rate
self.iter=int(niter)
def fit(self,x,y):
x=np... | 3.015625 | 3 |
kalamine/layout.py | qwerty-fr/kalamine | 0 | 12796898 | <reponame>qwerty-fr/kalamine
#!/usr/bin/env python3
import datetime
import os
import re
import sys
import yaml
from .template import xkb_keymap, \
osx_keymap, osx_actions, osx_terminators, \
klc_keymap, klc_deadkeys, klc_dk_index, \
web_keymap, web_deadkeys
from .utils import open_local_file, load_data, t... | 2.21875 | 2 |
src/core.py | MKuranowski/AdventOfCode2021 | 0 | 12796899 | <gh_stars>0
from typing import Callable, Generator, Iterable, TypeVar
_T = TypeVar("_T")
_K = TypeVar("_K")
def empty_str(t: str) -> bool:
return t == ""
def split_on(seq: Iterable[_T], pred: Callable[[_T], bool]) -> list[list[_T]]:
after_split: list[list[_T]] = []
current: list[_T] = []
for elem ... | 2.859375 | 3 |
rl/algorithms/mfrl/mfrl.py | RamiSketcher/AMMI-RL | 0 | 12796900 | import gym
from gym.spaces import Box
import numpy as np
import torch as T
import rl.environments
from rl.data.buffer import TrajBuffer, ReplayBuffer
# from rl.data.buffer import TrajBuffer, ReplayBufferNP
# def make_env(env_id, seed, idx, capture_video, run_name):
# def thunk():
# print('in thunk')
# ... | 2.078125 | 2 |
twitter/getStatus.py | cuete/py-cat | 0 | 12796901 | #!/usr/bin/env python
#Update your .twconfig file on this same directory
#with your own api keys and secrets
#Get them signing up at https://apps.twitter.com
#Install required modules with
#'pip install -r requirements.txt'
import configparser
import os
import sys
import json
import twitter
def jdefault(o):
r... | 2.640625 | 3 |
schoolbooks/schoolbook_even_medium.py | Dia-B/polymul-z2mx-m4 | 6 | 12796902 | <reponame>Dia-B/polymul-z2mx-m4<filename>schoolbooks/schoolbook_even_medium.py
from math import ceil
from .common import schoolbook_inner, Registers, schoolbook_postprocess
import sys
def schoolbook_medium(SRC1, SRC2, DEST, n):
parts = ceil(n / 12)
npart = ceil(n / parts)
instructions = schoolbook_even_... | 2.59375 | 3 |
examples/rec/tf_ncf.py | initzhang/Hetu | 82 | 12796903 | import tensorflow as tf
def neural_mf(user_input, item_input, y_, num_users, num_items, embed_partitioner=None):
embed_dim = 8
layers = [64, 32, 16, 8]
learning_rate = 0.01
with tf.compat.v1.variable_scope('nmf', dtype=tf.float32):
with tf.device('/cpu:0'):
User_Embedding = tf.comp... | 2.40625 | 2 |
tests/graph/test_ppatterns.py | saezlab/squidpy | 0 | 12796904 | import pytest
from anndata import AnnData
from pandas.testing import assert_frame_equal
import numpy as np
from squidpy.gr import moran, ripley_k, co_occurrence
MORAN_K = "moranI"
def test_ripley_k(adata: AnnData):
"""Check ripley score and shape."""
ripley_k(adata, cluster_key="leiden")
# assert rip... | 2.3125 | 2 |
tests/test_characteristic.py | bdrydyk/homecontroller | 0 | 12796905 | """
Tests for pyhap.characteristic
"""
import uuid
from unittest import mock
import pytest
import pyhap.characteristic as characteristic
from pyhap.characteristic import Characteristic
PROPERTIES = {
"Format": characteristic.HAP_FORMAT.INT,
"Permissions": [characteristic.HAP_PERMISSIONS.READ]
}
def get_char... | 2.53125 | 3 |
example.py | julianspaeth/RandomSurvialForest | 40 | 12796906 | from random_survival_forest import RandomSurvivalForest, concordance_index
from lifelines import datasets
from sklearn.model_selection import train_test_split
import time
rossi = datasets.load_rossi()
# Attention: duration column must be index 0, event column index 1 in y
y = rossi.loc[:, ["arrest", "week"]]
X = rossi... | 2.46875 | 2 |
sysinv/sysinv/sysinv/sysinv/puppet/device.py | etaivan/stx-config | 0 | 12796907 | <reponame>etaivan/stx-config<filename>sysinv/sysinv/sysinv/sysinv/puppet/device.py
#
# Copyright (c) 2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import collections
from sysinv.common import constants
from sysinv.puppet import base
class DevicePuppet(base.BasePuppet):
"""Class to enca... | 1.976563 | 2 |
Code/search_algorithms/binary_search/binarySearch.py | Kevinjadia/Hacktoberfest_DSA_2021 | 4 | 12796908 | target = int(input("enter search target: "))
def binarySearch(list,target):
maximum = len(list) -1
minimum = 0
result = None
while (result != target):
m = (maximum + minimum) // 2
midPoint = list[m]
if(target > midPoint):
minimum = m +1
elif(target < midPoint)... | 4.0625 | 4 |
accounts/urls.py | rattletat/homework-server | 1 | 12796909 | <filename>accounts/urls.py<gh_stars>1-10
from django.contrib.auth.views import LogoutView
from django.urls import path
from accounts.views import login, send_login_email
app_name = 'accounts'
urlpatterns = [
path("send_login_email", send_login_email, name="send_login_email"),
path("login", login, name="login"... | 1.9375 | 2 |
lib/python3.6/token.py | trikyas/django-project | 1 | 12796910 | <gh_stars>1-10
/anaconda3/lib/python3.6/token.py | 1.0625 | 1 |
Machine-Learning-with-Python- From-LM-to-DL/Midterm/04_midterm_exercise.py | andresdelarosa1887/Public-Projects | 1 | 12796911 | <gh_stars>1-10
import numpy as np
classification_vector= np.array([-1,-1,-1,-1,-1,1,1,1,1,1])
data_vector= np.array([[0,0], [2,0],[3,0], [0,2],[2,2],[5,1],[5,2],[2,4],[4,4],[5,5]])
def quadratic_kernel(data_vector):
return np.array((1 + np.dot(data_vector, data_vector.T))**2)
def perceptron_quadratic_kernel(fea... | 2.765625 | 3 |
Simulation/main.py | MKamyab1991/quadcopter_ppo | 2 | 12796912 | import gym
import numpy as np
import torch
import torch.optim as optim
from utils_main import make_env, save_files
from neural_network import ActorCritic
from ppo_method import ppo
from common.multiprocessing_env import SubprocVecEnv
from itertools import count
use_cuda = torch.cuda.is_available()
device = torch.devic... | 2.28125 | 2 |
contentstore/migrations/0011_message_metadata.py | praekeltfoundation/seed-stage-based-messaging | 1 | 12796913 | # Generated by Django 2.1.2 on 2019-02-20 15:47
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("contentstore", "0010_auto_20181126_1104")]
operations = [
migrations.AddField(
model_name="message",
... | 1.703125 | 2 |
tests/test_all.py | pawelmhm/recenseo.es | 0 | 12796914 | <reponame>pawelmhm/recenseo.es
"""
Integration tests for the app.
"""
import os,sys
import unittest
from contextlib import closing
from datetime import datetime
import time
import StringIO
import logging
from flask import url_for
from src import flaskr
from src import modele
from src.config import TestConfig
from uti... | 2.515625 | 3 |
output/models/ms_data/additional/test102433_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 12796915 | <filename>output/models/ms_data/additional/test102433_xsd/__init__.py
from output.models.ms_data.additional.test102433_xsd.test102433 import Bar
__all__ = [
"Bar",
]
| 1.117188 | 1 |
mongo_db_from_config/__init__.py | cisagov/mongo-db-from-config | 0 | 12796916 | """This package contains the mongo_db_from_config code."""
from .mongo_db_from_config import db_from_config
__version__ = "0.0.1"
__all__ = ["db_from_config"]
| 1.148438 | 1 |
circuit_benchmarks/qft.py | eddieschoute/circuit-benchmarks | 7 | 12796917 | <reponame>eddieschoute/circuit-benchmarks<filename>circuit_benchmarks/qft.py<gh_stars>1-10
# -*- coding: utf-8 -*
# Copyright 2019, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
import math
from qiskit import Qu... | 2.4375 | 2 |
randomFourierComplete.py | aasensio/randomModulator | 1 | 12796918 | import numpy as np
import matplotlib.pyplot as pl
import scipy.sparse as sp
import scipy.sparse.linalg as splinalg
import scipy.fftpack as fft
def bin_ndarray(ndarray, new_shape, operation='sum'):
"""
Bins an ndarray in all axes based on the target shape, by summing or
averaging.
Number of output dime... | 3.078125 | 3 |
tank/forms.py | oteejay/lms | 0 | 12796919 | <reponame>oteejay/lms
from django import forms
from django.utils.translation import gettext_lazy as _
from plant.models import Plant
from .models import Tank, Configuration
class TankForm(forms.ModelForm):
plant = forms.ModelChoiceField(queryset=Plant.objects.all(), empty_label='...select plant...')
class... | 2.578125 | 3 |
The container /Robotic Arm/craves.ai-master/pose/utils/evaluation.py | ReEn-Neom/ReEn.Neom-source-code- | 0 | 12796920 | <reponame>ReEn-Neom/ReEn.Neom-source-code-
from __future__ import absolute_import
import math
import numpy as np
import matplotlib.pyplot as plt
from random import randint
import torch
from .misc import *
from .transforms import transform, transform_preds
__all__ = ['accuracy', 'AverageMeter']
def get_preds(scores)... | 2.328125 | 2 |
scripts/dcs.py | chebroluharika/SDK_Automation_Generator | 0 | 12796921 | <reponame>chebroluharika/SDK_Automation_Generator
import requests
import json
import logging
import time
from copy import deepcopy
import platform # For getting the operating system name
import subprocess # For executing a shell command
rest_call_timeout_sec = 60
max_retries_in_session = 50
polling_call_... | 2.375 | 2 |
drug/views.py | Ctrl-plus-C/Chiron | 20 | 12796922 | <gh_stars>10-100
from django.shortcuts import render, redirect
from django.views.decorators.csrf import csrf_exempt
from rest_framework.authtoken.models import Token
from rest_framework.decorators import api_view, permission_classes
from rest_framework.permissions import AllowAny
from rest_framework.status import (
... | 1.875 | 2 |
deeppavlov/tasks/paraphrases/__init__.py | deepmipt/kpi2017 | 3 | 12796923 | <filename>deeppavlov/tasks/paraphrases/__init__.py
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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.15625 | 2 |
porespy/dns/__init__.py | xu-kai-xu/porespy | 0 | 12796924 | r"""
DNS
###
**Direct Numerical Simulation**
This module contains routines for performing direct numerical
simulations.
.. currentmodule:: porespy
.. autosummary::
:template: mybase.rst
:toctree: generated/
dns.tortuosity
"""
from ._funcs import *
| 1.140625 | 1 |
example/settings.py | rheinwerk-verlag/planning-poker-jira | 1 | 12796925 | <reponame>rheinwerk-verlag/planning-poker-jira<gh_stars>1-10
# Django settings for example project.
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
SECRET_K... | 1.960938 | 2 |
yolo/model/dense_prediction.py | parot-99/COVID-19-Warning-System | 2 | 12796926 | import tensorflow as tf
from .config import cfg
class YoloHead(tf.keras.layers.Layer):
def __init__(self, grid_size, classes, strides, anchors, xyscale, i):
super().__init__()
self.grid_size = grid_size
self.classes = classes
self.strides = strides
self.anchors = anchors
... | 2.484375 | 2 |
experiments/bert/bert.py | 0xflotus/transfer-nlp | 0 | 12796927 | <reponame>0xflotus/transfer-nlp
import math
from typing import Tuple
import numpy as np
import pandas as pd
import torch
from pytorch_pretrained_bert import BertTokenizer, BertForSequenceClassification
from torch.nn.utils import clip_grad_norm_
from torch.optim import Optimizer
from torch.optim.optimizer import requir... | 2.453125 | 2 |
deployer/contrib/loggers/on_host.py | timgates42/python-deployer | 39 | 12796928 | <reponame>timgates42/python-deployer<filename>deployer/contrib/loggers/on_host.py
from deployer.loggers import Logger, RunCallback, ForkCallback
from deployer.utils import esc1
class OnHostLogger(Logger):
"""
Log all transactions on every host in:
~/.deployer/history
"""
def __init__(self, username... | 2.265625 | 2 |
polybius/graphics/ui/menu.py | TStalnaker44/python_jeopardy | 0 | 12796929 | """
Author: <NAME>
File: menu.py
A general class for creating menus
Parameters:
pos - (x,y) position for the top-left corner of the menu
dims - (width, height) pixels of the menu
commands - list of dictionaries specifying the button attributes
padding - (horizontal, vertical) padding between border an... | 3.953125 | 4 |
app/unitOfMeasurements/routes.py | DeschutesBrewery/brewerypi | 27 | 12796930 | from flask import flash, redirect, render_template, request, url_for
from flask_login import login_required
from sqlalchemy import and_
from . import unitOfMeasurements
from . forms import UnitOfMeasurementForm
from .. import db
from .. decorators import adminRequired
from .. models import UnitOfMeasurement
modelName ... | 2.703125 | 3 |
conf/tests/test_wsgi.py | uktrade/sso | 1 | 12796931 | from unittest import mock
import pytest
from bs4 import BeautifulSoup
from conf import wsgi
@pytest.mark.django_db
@pytest.mark.parametrize('script_name,prefix', (('/sso', '/sso/accounts/'), ('', '/accounts/')))
def test_set_script_name(rf, script_name, prefix):
environ = rf._base_environ(
PATH_INFO='/a... | 2.34375 | 2 |
looking_for_group/game_catalog/migrations/0011_publishedmodule_parent_game_edition.py | andrlik/looking-for-group | 0 | 12796932 | # Generated by Django 2.1.2 on 2018-11-04 16:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('game_catalog', '0010_auto_20181104_1036'),
]
operations = [
migrations.RemoveField(
model_name=... | 1.515625 | 2 |
bashbot/commands/rename_command.py | SudoPokeMaster/BashBot | 0 | 12796933 | import asyncio
from bashbot.commands import Command
from bashbot.commands.syntax import SyntaxBuilder
from bashbot.session_manager import SessionManager
class RenameCommand(Command):
def __init__(self):
super().__init__()
self.name = "Rename terminal"
self.aliases = [".rename"]
s... | 2.296875 | 2 |
policy.py | shaoshitong/torchdistill | 1 | 12796934 | import os, sys
if __name__ == "__main__":
negative_identity_weight = [0, 0, 0]
positive_identity_weight = [0, 0, 0]
negative_classes_weight = [0, 0, 0]
positive_classes_weight = [0, 0, 0]
negative_policy_weight = [0, 0, 0]
positive_policy_weight = [0, 0, 0]
for i in range(len(negative_iden... | 2.28125 | 2 |
parser.py | Snake-Whisper/zone-file-parser | 4 | 12796935 | #!/usr/bin/env python3
"""
Limits:
- can't read brackets in brackets
- avoid using more then one bracket per line. Normally it should work, but you should use it carefull
- problems by differncing ttl/domaine, if domain[:-1].isdigit()"""
VERSION = 1.1
DOMAIN_MAX_LENGHT = 255
CLASSES = ["IN", "HS", "CH",... | 2.484375 | 2 |
money_legos/uniswap/contracts.py | gokhanbaydar/py-money-legos | 3 | 12796936 | <gh_stars>1-10
from .. import util
exchangeAbi = util.read_json("./uniswap/abi/Exchange.json")
factoryAbi = util.read_json("./uniswap/abi/Factory.json")
contracts = {
"factory": {
"address": "0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95",
"abi": factoryAbi,
},
"exchange": {
"abi": ex... | 1.875 | 2 |
ebad/trainer/module.py | vahidzee/ebad | 0 | 12796937 | import pytorch_lightning as pl
import torch
import typing as th
import torchmetrics
from .. import utils as ebad_utils
class AnoTrainer(pl.LightningModule):
def __init__(
self,
model_cls: th.Union[str, torch.nn.Module],
input_shape: th.Union[th.Tuple[int], th.List[int]],
... | 2.40625 | 2 |
modules/url_content_fetcher.py | facebookresearch/URL-Sanitization | 24 | 12796938 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Given an URL in string, make a request, fetch its content,
and parse using BeautifulSoup.
"""
import time
import requests
import logging
import urllib.parse as urlparse
from bs4 import BeautifulSoup
class URLContentFetc... | 3.484375 | 3 |
setup.py | coopie/ttv | 0 | 12796939 | <filename>setup.py
from setuptools import setup
setup(name='ttv',
version='0.0.1',
description='A command line tool and a python library for test, train, validation set splitting',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/coopie/ttv',
download_url='https://g... | 1.171875 | 1 |
TDO/utils_tdo/utils_evaluation.py | lgi2p/TDSelection | 0 | 12796940 | <reponame>lgi2p/TDSelection<filename>TDO/utils_tdo/utils_evaluation.py
def compute_precision_with_general(sol_dict_, truth_, ancestors_):
#function that compute the number of expected/general/erroneous values returned by the approach
#note that the general values are all the returned values that are more gene... | 2.234375 | 2 |
servicex/datastream/pyarrowdemo.py | ssl-hep/ServiceX_datastream | 0 | 12796941 | <reponame>ssl-hep/ServiceX_datastream
# Copyright (c) 2019, IRIS-HEP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, th... | 1.4375 | 1 |
test/test_buildx_driver.py | altairengineering/pkr | 16 | 12796942 | import sys
from .utils import pkrTestCase
class TestBuildxDriver(pkrTestCase):
PKR = "pkr"
pkr_folder = "docker_driver"
kard_env = "dev"
kard_driver = "buildx_compose"
kard_extra = {
"tag": "123",
"flag": "flag_value",
"buildx.cache_registry": "dummy",
"buildx.build... | 2.203125 | 2 |
ch09/complexity.py | ricjuanflores/practice-of-the-python | 319 | 12796943 | def has_long_words(sentence):
if isinstance(sentence, str): # <1>
sentence = sentence.split(' ')
for word in sentence: # <2>
if len(word) > 10: # <3>
return True
return False # <4>
| 3.546875 | 4 |
src/wready/__init__.py | WisconsinRobotics/wready | 0 | 12796944 | <filename>src/wready/__init__.py
from .sig_handler import SignalInterruptHandler
from .wready_client import TaskContext, WReadyClient
from .wready_server import InitTask, WReadyServer, WReadyServerObserver
| 1.140625 | 1 |
utils/models/manufacture_building.py | roomdie/KingsEmpiresBot | 0 | 12796945 | from utils.models import base, product
#
# Bronze Age
#
BronzePottery = base.ManufactureBuilding(
name="🏺🏠 Гончарня",
products=[product.dish, product.jug, product.amphora],
create_price=[340, 490],
create_time_sec=1800,
manpower=108
)
BronzePlantation = base.ManufactureBuilding(
name="🍇🏠 ... | 2.09375 | 2 |
problem0546.py | kmarcini/Project-Euler-Python | 0 | 12796946 | ###########################
#
# #546 The Floor's Revenge - Project Euler
# https://projecteuler.net/problem=546
#
# Code by <NAME>
#
###########################
| 1.1875 | 1 |
workertasks/migrations/0003_auto_20181109_0049.py | danula/crowdcog | 1 | 12796947 | # Generated by Django 2.1.3 on 2018-11-09 00:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workertasks', '0002_auto_20181109_0046'),
]
operations = [
migrations.AlterField(
model_name='assignment',
name='beg... | 1.476563 | 1 |
frameworks/pycellchem-2.0/src/artchem/ReactionParser.py | danielrcardenas/ac-course-2017 | 0 | 12796948 | #---------------------------------------------------------------------------
#
# ReactionParser.py: parser for chemical reactions in text format, such as:
#
# A + 2 B --> 3 C , k=2.49
#
# by <NAME>, Univ. Basel, Switzerland, January 2010
# June 2013: adapted to the PyCellChemistry package
#
# - - - - - - - - - - - -... | 2.859375 | 3 |
raml_translation_with_score.py | nonstopfor/seq2seq-exposure-bias-tf | 1 | 12796949 | import cotk
from cotk._utils.file_utils import get_resource_file_path
from cotk.dataloader.dataloader import *
from collections import Counter
import numpy as np
from itertools import chain
class Score(DataField):
def get_next(self, dataset):
r"""read text and returns the next label(integer). Note that it... | 2.4375 | 2 |
tests/test_data_functions.py | arthurazs/dotapatch | 12 | 12796950 | <reponame>arthurazs/dotapatch
'''Tests for HeropediaData functions'''
from unittest import TestCase, main as unit_main
from dotapatch.data import HeropediaData
import os.path as path
class TestDataFiles(TestCase):
'''Test if files/folders exists'''
@classmethod
def setUpClass(cls):
'''Sets up dir... | 2.796875 | 3 |