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 |
|---|---|---|---|---|---|---|
appimagebuilder/app_dir/runtime/app_run.py | srevinsaju/appimage-builder | 0 | 19700 | # Copyright 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute... | 1.726563 | 2 |
setup.py | cardosan/tempo_test | 0 | 19701 | <reponame>cardosan/tempo_test
from setuptools import setup
import io
setup(
name='bw2temporalis',
version="0.9.2",
packages=[
"bw2temporalis",
"bw2temporalis.tests",
"bw2temporalis.examples",
"bw2temporalis.cofire"
],
author="<NAME>",
author_email="<EMAIL>",
... | 1.523438 | 2 |
applications/FemToDemApplication/python_scripts/MainFEM_for_coupling.py | lkusch/Kratos | 778 | 19702 | <reponame>lkusch/Kratos<gh_stars>100-1000
import KratosMultiphysics
import KratosMultiphysics.FemToDemApplication.MainFemDem as MainFemDem
import KratosMultiphysics.FemToDemApplication as KratosFemDem
import KratosMultiphysics.DEMApplication as DEM
import KratosMultiphysics.DemStructuresCouplingApplication as DEM... | 2.265625 | 2 |
utils/arg_parser.py | dataflowr/Project-Neural-Bootstrapper | 17 | 19703 | import os
import yaml
import copy
import logging
from pathlib import Path
import torch
from torch.nn import *
from torch.optim import *
import torch.distributed as dist
from torch.optim.lr_scheduler import *
from torch.nn.parallel import DistributedDataParallel
from utils.metrics import *
from models import _get_mode... | 2.0625 | 2 |
MDP/MDP.py | ADP-Benchmarks/ADP-Benchmark | 1 | 19704 | <reponame>ADP-Benchmarks/ADP-Benchmark
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
GitHub Homepage
----------------
https://github.com/ADP-Benchmarks
Contact information
-------------------
<EMAIL>.
License
-------
The MIT License
"""
from MDP.spaces.space import Space
from MDP.trans... | 2.875 | 3 |
tests/test_multiplegraphscallpeaks.py | uio-bmi/graph_peak_caller | 10 | 19705 | from graph_peak_caller.multiplegraphscallpeaks import MultipleGraphsCallpeaks
from graph_peak_caller.intervals import Intervals
from graph_peak_caller import Configuration
from graph_peak_caller.reporter import Reporter
from offsetbasedgraph import GraphWithReversals as Graph, \
DirectedInterval, IntervalCollection... | 1.96875 | 2 |
brainite/models/mcvae.py | neurospin-deepinsight/brainite | 0 | 19706 | <filename>brainite/models/mcvae.py<gh_stars>0
# -*- coding: utf-8 -*-
##########################################################################
# NSAp - Copyright (C) CEA, 2021
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.ceci... | 1.921875 | 2 |
3.algorithmic_expert/Tries/1.Suffix Trie Construction.py | jimmymalhan/Coding_Interview_Questions_Python_algoexpert | 1 | 19707 | # Problem Name: Suffix Trie Construction
# Problem Description:
# Write a SuffixTrie class for Suffix-Trie-like data structures. The class should have a root property set to be the root node of the trie and should support:
# - Creating the trie from a string; this will be done by calling populateSuffixTrieFrom me... | 3.9375 | 4 |
test/test_host.py | waylonwang/pure-python-adb | 0 | 19708 | <gh_stars>0
def test_list_devices(client):
devices = client.devices()
assert len(devices) > 0
assert any(map(lambda device: device.serial == "emulator-5554", devices))
def test_list_devices_by_state(client):
devices = client.devices(client.BOOTLOADER)
assert len(devices) == 0
devices = client.... | 2.390625 | 2 |
Tms-GCN-PyTorch/utils/callbacks/base/best_epoch.py | Joker-L0912/Tms-GCN-Py | 0 | 19709 | import copy
import numpy as np
import torch
from pytorch_lightning.utilities import rank_zero_warn
from pytorch_lightning.callbacks import Callback
class BestEpochCallback(Callback):
TORCH_INF = torch_inf = torch.tensor(np.Inf)
MODE_DICT = {
"min": (torch_inf, "min"),
"max": (-torch_inf, "max"... | 2.109375 | 2 |
playhouse/tests.py | mikiec84/peewee | 1 | 19710 | <reponame>mikiec84/peewee
from hashlib import sha1 as _sha1
import sqlite3
import unittest
from peewee import *
import signals
import sqlite_ext as sqe
import sweepea
db = SqliteDatabase(':memory:')
class BaseSignalModel(signals.Model):
class Meta:
database = db
class ModelA(BaseSignalModel):
a = C... | 2.4375 | 2 |
appengine/experimental/crbadge/testdata/upload.py | allaparthi/monorail | 2 | 19711 | #!/usr/bin/python
import os, sys
import optparse
import json, urllib
import httplib2
import urlparse
def upload(filenames, url, password):
parsed = urlparse.urlparse(url)
http = httplib2.Http()
for filename in filenames:
with open(filename) as f:
# Load and validate JSON
o = json.load(f)
s ... | 3.28125 | 3 |
libs/test_utils.py | bongnv/sublime-go | 6 | 19712 | import unittest
class TestIsGoView(unittest.TestCase):
def test_nil(self):
self.assertFalse(None)
| 1.820313 | 2 |
python-algorithm/leetcode/problem_457.py | isudox/nerd-algorithm | 5 | 19713 | """457. Circular Array Loop
https://leetcode.com/problems/circular-array-loop/
"""
from typing import List
class Solution:
def circular_array_loop(self, nums: List[int]) -> bool:
def helper(start: int, cur: int, count: int, visited) -> int:
if nums[cur] * nums[start] < 0:
retur... | 3.53125 | 4 |
task/task2.py | joseph9991/Milestone1 | 0 | 19714 | import pandas as pd
from pandas import read_csv
import os
import sys
import glob
import re
import soundfile as sf
import pyloudnorm as pyln
from .thdncalculator import execute_thdn
class Task2:
def __init__(self,data,file_name):
self.df = pd.DataFrame.from_dict(data, orient='columns')
self.file_name = file_nam... | 2.90625 | 3 |
agents/hub_policy.py | floriandonhauser/TeBaG-RL | 0 | 19715 | import tensorflow as tf
import tensorflow_hub as hub
from tf_agents.networks import network
# Bert needs this (I think) TODO: Check?
import tensorflow_text as text
embedding = "https://tfhub.dev/google/nnlm-en-dim128-with-normalization/2"
tfhub_handle_encoder = (
"https://tfhub.dev/tensorflow/small_bert/bert_en_u... | 2.40625 | 2 |
meiduo_mall/apps/orders/urls.py | MarioKarting/Django_meiduo_project | 0 | 19716 | # !/usr/bin/env python
# _*_ coding:utf-8 _*_
from django.conf.urls import url
from . import views
urlpatterns = [
# 1. 结算订单 orders/settlement/
url(r'^orders/settlement/$', views.OrdersSettlementView.as_view(), name='settlement'),
# 2. orders/commit/ 提交订单
url(r'^orders/commit/$', views.OrdersCo... | 1.554688 | 2 |
goldmeister/__init__.py | USDA-ARS-NWRC/goldmeister | 0 | 19717 | <gh_stars>0
"""Top-level package for Goldmeister."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.2.0'
| 1.109375 | 1 |
db/update.py | msgangwar/Leaderboard | 2 | 19718 | <reponame>msgangwar/Leaderboard
from user import User
from Env import Env_Vars
from fetch_from_sheet import SheetData
from pymongo import MongoClient
from pprint import pprint
env_vars = Env_Vars()
MongoURI = env_vars.MongoURI
client = MongoClient(MongoURI, 27017)
db = client['users']
users = db['users']
def do_upd... | 2.828125 | 3 |
uvicore/http/OBSOLETE/routes-OLD.py | coboyoshi/uvicore | 11 | 19719 | <gh_stars>10-100
# @uvicore.service()
# class Routes(RoutesInterface, Generic[R]):
# endpoints: str = None
# @property
# def app(self) -> ApplicationInterface:
# return self._app
# @property
# def package(self) -> PackageInterface:
# return self._package
# @property
# ... | 2.453125 | 2 |
tudo/ex052.py | Ramon-Erik/Exercicios-Python | 1 | 19720 | n = int(input('Digite um número: '))
if n % 2 == 0 and n % 3 == 0 and n % 5 == 0:
print('{} é um número primo!'.format(n))
else:
print('{} não é um número primo!'.format(n))
| 4.21875 | 4 |
Firmware/RaspberryPi/backend-pi/PWMController.py | librerespire/ventilator | 5 | 19721 | import threading
import time
import RPi.GPIO as GPIO
import logging
import logging.config
# declare logger parameters
logger = logging.getLogger(__name__)
class PWMController(threading.Thread):
""" Thread class with a stop() method.
Handy class to implement PWM on digital output pins """
def __init_... | 2.9375 | 3 |
netforce_account/netforce_account/models/account_balance.py | nfco/netforce | 27 | 19722 | <reponame>nfco/netforce<gh_stars>10-100
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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 ri... | 2 | 2 |
ex016.py | Rhodytesla/PythonMundo01 | 0 | 19723 | import math
a = float(input('insira um valor'))
print('a porção inteira do valor {} é {}'.format(a,math.trunc(a))) | 3.859375 | 4 |
models/force_expand.py | DeerKK/Deformable-Modeling | 4 | 19724 | #from data_loader import *
from scipy import signal
import matplotlib.pyplot as plt
import copy
import os
import shutil
import numpy as np
def data_filter(exp_path, probe_type='point', Xtype='loc',ytype='f',num_point=0):
shutil.rmtree(exp_path+probe_type+'_expand', ignore_errors=True)
os.mkdir(exp_path+probe_t... | 2.296875 | 2 |
DataStructures Python/parenthesis_matching.py | Kaushik-Pal-2020/DataStructure | 0 | 19725 | <filename>DataStructures Python/parenthesis_matching.py
from collections import deque
def parenthesis_matching(user_input):
my_stack = deque()
my_dict = {'(': ')', '{': '}', '[': ']'}
try:
count = 0
for letter in user_input:
if letter in my_dict.keys():
my_stack... | 3.96875 | 4 |
a.20.7.py | AmanMishra148/python-repo | 0 | 19726 | def si(p,r,t):
n= (p+r+t)//3
return n
| 2.515625 | 3 |
hard-gists/7880c101557297beeccda05978aeb278/snippet.py | jjhenkel/dockerizeme | 21 | 19727 | <filename>hard-gists/7880c101557297beeccda05978aeb278/snippet.py
# Example of use of Afanasy's API to generate a summary of the state of the
# render farm.
# Copyright (c) 2016 rise|fx (<NAME>) - Released under MIT License
import af
cmd = af.Cmd()
def isSysJob(job):
return job['st'] == 0
## Jobs ##
joblist = c... | 2.359375 | 2 |
cblib/scripts/admin/pack.py | HFriberg/cblib-base | 3 | 19728 | # Copyright (c) 2012 by Zuse-Institute Berlin and the Technical University of Denmark.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this so... | 1.648438 | 2 |
FAEGUI/VisualizationConnection.py | Eggiverse/FAE | 0 | 19729 | from copy import deepcopy
import os
import re
from PyQt5.QtWidgets import *
from PyQt5 import QtCore, QtGui
from GUI.Visualization import Ui_Visualization
from FAE.FeatureAnalysis.Classifier import *
from FAE.FeatureAnalysis.FeaturePipeline import FeatureAnalysisPipelines, OnePipeline
from FAE.Description.Description... | 1.765625 | 2 |
bookstore/management/commands/makeratings.py | mirko-lelansky/booksite | 0 | 19730 | # Copyright 2017 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 2.328125 | 2 |
secondstate/converters.py | fruiti-ltd/secondstate | 1 | 19731 | # Copyright (c) 2021, Fruiti Limited
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from datetime import datetime
def convert_custom_timestamp_range(timestamp_range: str) -> list:
result = timestamp_range.s... | 2.953125 | 3 |
Write.py | yukiii-zhong/HandMovementTracking | 1 | 19732 | import numpy as np
import cv2
import argparse
from collections import deque
import keyboard as kb
import time
from pynput.keyboard import Key, Controller, Listener
class points(object):
def __init__(self, x, y):
self.x = x
self.y = y
sm_threshold = 100
lg_threshold = 200
guiding = True
keyboar... | 2.328125 | 2 |
server/newsWebsite/models.py | thiagobrez/newsWebsite | 0 | 19733 | <reponame>thiagobrez/newsWebsite
from django.db import models
def picture_upload_path(instance, filename):
# file will be saved at <MEDIA_ROOT>/authorPictures/<filename>
return 'authorPictures/{0}'.format(filename)
def hero_upload_path(instance, filename):
# file will be saved at <MEDIA_ROOT>/heroImages... | 2.46875 | 2 |
Python for Everybody/Using Python to Access Web Data/Assignments/Regular Expression/Finding_Numbers_in_a_Haystack.py | lynnxlmiao/Coursera | 0 | 19734 | import re
data = open('regex_sum_46353.txt')
numlist = list()
for line in data:
line = line.rstrip()
integers = re.findall('[0-9]+', line)
if len(integers) < 1: continue
for i in range(len(integers)):
num = float(integers[i])
numlist.append(num)
num_sum = sum(numlist)
print (num_sum)
| 3.578125 | 4 |
tuinwolk/server/daemons/tuinwolk_daemon.py | TuinfeesT/TuinWolk | 1 | 19735 | <gh_stars>1-10
#!/usr/bin/env python
import daemon
class TuinWolkDaemon(daemon.Daemon):
def run(self):
#TODO: implement me!
pass
| 1.507813 | 2 |
plugins/mobile_app.py | alustig/OSPi | 0 | 19736 | import json
import time
import datetime
import string
import calendar
from helpers import get_cpu_temp, check_login, password_hash
import web
import gv # Gain access to ospi's settings
from urls import urls # Gain access to ospi's URL list
from webpages import ProtectedPage, WebPage
##############
## N... | 2.046875 | 2 |
utils/iroha.py | LiTrans/BSMD | 1 | 19737 | <filename>utils/iroha.py<gh_stars>1-10
"""
.. _Iroha:
Iroha
=====
Functions to post transactions in the iroha implementation of the BSMD
"""
from iroha import IrohaCrypto, Iroha, IrohaGrpc
import binascii
import sys
if sys.version_info[0] < 3:
raise Exception('Python 3 or a more recent version is required.')
# ... | 2.71875 | 3 |
tibanna_cgap/lambdas/start_run.py | 4dn-dcic/tibanna_ff | 2 | 19738 | # -*- coding: utf-8 -*-
# import json
from tibanna_ffcommon.exceptions import exception_coordinator
from tibanna_cgap.start_run import start_run
from tibanna_cgap.vars import AWS_REGION, LAMBDA_TYPE
config = {
'function_name': 'start_run_' + LAMBDA_TYPE,
'function_module': 'service',
'function_handler': '... | 1.71875 | 2 |
Amplo/Observation/_model_observer.py | Amplo-GmbH/AutoML | 5 | 19739 | <filename>Amplo/Observation/_model_observer.py<gh_stars>1-10
# Copyright by Amplo
"""
Observer for checking production readiness of model.
This part of code is strongly inspired by [1].
References
----------
[1] <NAME>, <NAME>, <NAME>, <NAME>, <NAME> (2017).
The ML test score: A rubric for ML production readiness and... | 2.28125 | 2 |
mini projects/school_manager.py | Tryst480/python-tutorial | 0 | 19740 | #!/usr/bin/env python3
# This is gonna be up to you. But basically I envisioned a system where you have a students in a classroom. Where the
# classroom only has information, like who is the teacher, how many students are there. And it's like an online class,
# so students don't know who their peers are, or who their ... | 4.09375 | 4 |
hparams.py | ishine/EmotionControllableTextToSpeech | 12 | 19741 | <filename>hparams.py
import os
cleaners = 'korean_cleaners'
audio_data_path = os.path.join("/cb_im/datasets/", dataset)
data_path = '/home/prml/hs_oh/dataset/emotion_korea/'
duration_path = "/home/prml/jihyun/dataset/duration_all/duration"
strength_path = "/home/prml/hs_oh/dataset/emotion_strength"
# Text
text_cleane... | 2.15625 | 2 |
run_tests.py | dannybrowne86/django-ajax-uploader | 75 | 19742 | # from https://github.com/django-extensions/django-extensions/blob/master/run_tests.py
from django.conf import settings
from django.core.management import call_command
def main():
# Dynamically configure the Django settings with the minimum necessary to
# get Django running tests
settings.configure(
... | 1.914063 | 2 |
shor.py | rodamber/cps | 0 | 19743 | #!/usr/bin/env python3
"""Simulation of Shor's algorithm for integer factorization."""
import cmath
import math
import numpy as np
import random
class QuMem:
"""Representation of the memory of the quantum computer."""
def __init__(self, t, n):
"""Initialize the memory. For Shor's algorithm we have t... | 3.859375 | 4 |
Mundo2/lerSexo.py | DanieleMagalhaes/Exercicios-Python | 0 | 19744 | print('-'*60)
print('\33[35m[ F ] Feminino\33[m \n\33[32m[ M ] Masculino\33[m \n ')
sexo = str(input('Qual o seu sexo? ')).strip().upper()[0] # só pega a primeira letra
while sexo not in 'MF':
sexo = str(input('\33[31mDados inválidos.\33[m Por favor, informe seu sexo: ')).strip().upper()[0]
print('\nSexo {} registr... | 3.796875 | 4 |
src/wordmain.py | keyurmodh00/SimpleHTR | 0 | 19745 | import os
import cv2
from WordSegmentation import wordSegmentation, prepareImg
import json
import editdistance
from path import Path
from DataLoaderIAM import DataLoaderIAM, Batch
from Model import Model, DecoderType
from SamplePreprocessor import preprocess
import argparse
import tensorflow as tf
class FilePaths:
... | 2.796875 | 3 |
asrtoolkit/data_structures/audio_file.py | greenkeytech/greenkey-asrtoolkit | 31 | 19746 | #!/usr/bin/env python
"""
Module for holding information about an audio file and doing basic conversions
"""
import hashlib
import logging
import os
import subprocess
from asrtoolkit.file_utils.name_cleaners import (
generate_segmented_file_name,
sanitize_hyphens,
strip_extension,
)
from asrtoolkit.file_u... | 3.15625 | 3 |
forms.py | qqalexqq/monkeys | 0 | 19747 | from flask.ext.wtf import Form
from wtforms import (
TextField, IntegerField, HiddenField, SubmitField, validators
)
class MonkeyForm(Form):
id = HiddenField()
name = TextField('Name', validators=[validators.InputRequired()])
age = IntegerField(
'Age', validators=[
validators.Input... | 2.96875 | 3 |
src/modules/model/getPretrained.py | sakimilo/transferLearning | 0 | 19748 | import os
import shutil
import tensorflow as tf
from tensorflow import keras
from logs import logDecorator as lD
import jsonref
import numpy as np
import pickle
import warnings
from tqdm import tqdm
from modules.data import getData
config = jsonref.load(open('../config/config.json'))
logBase = config['logg... | 2.015625 | 2 |
Python/CountingBits.py | Jspsun/LEETCodePractice | 3 | 19749 | <reponame>Jspsun/LEETCodePractice
import math
class Solution(object):
def countBits(self, num):
"""
:type num: int
:rtype: List[int]
"""
bits = [0,1]
for n in range (2, num+1):
count = 0
closestPower = int(math.floor(math.log(n,2)))
... | 3.109375 | 3 |
ACM-Solution/4queen.py | wasi0013/Python-CodeBase | 2 | 19750 | <filename>ACM-Solution/4queen.py
#four queen problem bruteforce solution using permutation
from itertools import permutations
def board(vec):
print ("\n".join('.' * i + 'Q' + '.' * (n-i-1) for i in vec) + "\n===\n")
n = 8
cols = range(n)
for vec in permutations(cols):
if n == len(set(vec[i]+i for i in... | 3.203125 | 3 |
View/pesquisa_produtos.py | felipezago/ControleEstoque | 0 | 19751 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pesquisa_produtos.ui'
#
# Created by: PyQt5 View code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Frame(object):
def setupUi(self, Frame):
Fram... | 1.882813 | 2 |
zyc/zyc.py | Sizurka/zyc | 0 | 19752 | # -*- coding: utf-8 -*-
# MIT license
#
# Copyright (C) 2019 by XESS Corp.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# t... | 1.773438 | 2 |
train/ip.py | VCG/gp | 0 | 19753 | <reponame>VCG/gp<gh_stars>0
import cPickle as pickle
import os; import sys; sys.path.append('..')
import gp
import gp.nets as nets
PATCH_PATH = ('iplb')
X_train, y_train, X_test, y_test = gp.Patch.load_rgb(PATCH_PATH)
X_train = X_train[:,:-1,:,:]
X_test = X_test[:,:-1,:,:]
cnn = nets.RGNetPlus()
cnn = cnn.fit(X_tra... | 2.09375 | 2 |
test/TestSourceMissing.py | falcon-org/Falcon | 0 | 19754 | <reponame>falcon-org/Falcon
#!/usr/bin/env python
# Check that falcon rebuilds an output if it is deleted.
import time
import os
makefile = '''
{
"rules":
[
{
"inputs": [ "source1", "source2" ],
"outputs": [ "output" ],
"cmd": "cat source1 > output && cat source2 >> output"
}
]
}
... | 2.46875 | 2 |
awesimsoss/__init__.py | spacetelescope/AWESim_SOSS | 4 | 19755 | # -*- coding: utf-8 -*-
"""Top-level package for awesimsoss."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.3.5'
from .awesim import TSO, TestTSO, BlackbodyTSO, ModelTSO
| 1.085938 | 1 |
keyboards/inline/in_processing/keyboards_sum_ready.py | itcosplay/cryptobot | 0 | 19756 |
from data import all_emoji
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from aiogram.utils.callback_data import CallbackData
from data import all_emoji
from utils.googlesheets import send_to_google
from utils.set_minus_and_plus_currences import set_minus_and_plus
from utils.get_minuses_sum_F... | 2.515625 | 3 |
hw4/4.3.py | ArtemNikolaev/gb-hw | 0 | 19757 | <reponame>ArtemNikolaev/gb-hw<filename>hw4/4.3.py<gh_stars>0
# https://github.com/ArtemNikolaev/gb-hw/issues/24
def multiple_of_20_21():
return (i for i in range(20, 241) if i % 20 == 0 or i % 21 == 0)
print(list(multiple_of_20_21()))
| 2.703125 | 3 |
simulations/gamma_plot.py | austindavidbrown/Centered-Metropolis-Hastings | 0 | 19758 | <filename>simulations/gamma_plot.py
"""
ssh <EMAIL>
#qsub -I -q gpu
qsub -I -l nodes=1:ppn=10
module load python/conda/3.7
source activate env
ipython
"""
from math import sqrt, pi, exp
import time
import torch
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import seaborn as sns
linew... | 2.6875 | 3 |
hopper_controller/src/hexapod/folding_manager.py | CreedyNZ/Hopper_ROS | 36 | 19759 | import rospy
MOVE_CYCLE_PERIOD = 0.01
def move_towards(target, current, step=1):
if abs(target-current) < step:
return target, True
else:
if target > current:
return current + step, False
else:
return current - step, False
def move_leg(leg, coxa=None, femur=N... | 2.71875 | 3 |
Teil_57_12_Kugeln.py | chrMenzel/A-beautiful-code-in-Python | 50 | 19760 | <gh_stars>10-100
import random as rnd
from itertools import combinations
from time import perf_counter as pfc
def seite_ermitteln(versuch):
seite = [0]*anz_kugeln
links = set(versuch[:len(versuch)//2])
for nr in versuch:
seite[nr] = -1 if nr in links else 1
return seite
def wiegen(nr, gewicht, seite):
... | 2.234375 | 2 |
util/format_ldtk_battlers.py | Sipondo/ulix-dexflow | 5 | 19761 | from pathlib import Path
import os
from PIL import Image, ImageFont, ImageDraw
import numpy as np
import pandas as pd
from math import *
p = Path("resources/graphics/Pokemon/Icons")
df = pd.read_csv(Path("resources/PBS/compressed/pokemon.csv"), index_col=0)
width = 64
height = ceil(len(df) / 64)
canvas = Image.new(... | 2.625 | 3 |
main/admin.py | japmeet01/fplmanager-website | 5 | 19762 | from django.contrib import admin
from django.http import HttpResponse
from django.urls import path
from django.shortcuts import render, HttpResponse, redirect
from django import forms
import os
import csv
from io import TextIOWrapper, StringIO
from .models import Player, Team, Usage, XgLookup
class CsvImportForm(for... | 1.960938 | 2 |
Muta3DMaps/core/__init__.py | NatureGeorge/SIFTS_Plus_Muta_Maps | 0 | 19763 | # @Created Date: 2019-11-24 09:07:07 pm
# @Filename: __init__.py
# @Email: <EMAIL>
# @Author: <NAME>
# @Last Modified: 2019-12-23 04:23:51 pm
# @Copyright (c) 2019 MinghuiGroup, Soochow University
| 0.941406 | 1 |
tests/test_utils/test_file.py | dcambie/spectrochempy | 3 | 19764 | # -*- coding: utf-8 -*-
# =====================================================================================================================
# Copyright (©) 2015-2021 LCS - Laboratoire Catalyse et Spectrochimie, Caen, France. =
# CeCILL-B FREE SOFTWARE LICENSE AGREEMENT - See ful... | 1 | 1 |
toontown/safezone/ETreasurePlannerAI.py | SuperM0use24/TT-CL-Edition | 0 | 19765 | from toontown.safezone.DistributedETreasureAI import DistributedETreasureAI
from toontown.safezone.RegenTreasurePlannerAI import RegenTreasurePlannerAI
class ETreasurePlannerAI(RegenTreasurePlannerAI):
def __init__(self, zoneId):
self.healAmount = 2
self.spawnPoints = []
RegenTreasurePlan... | 2.046875 | 2 |
user_roles/role_add.py | PaloAltoNetworks/pcs-migration-management | 1 | 19766 | from sdk.color_print import c_print
from user_roles import role_translate_id
from tqdm import tqdm
def add_roles(session, old_session, roles, logger):
added = 0
tenant_name = session.tenant
if roles:
logger.info(f'Adding User Roles to tenant: \'{tenant_name}\'')
#Translate Acc Grp IDs
... | 2.109375 | 2 |
Apps/phdigitalshadows/dsapi/service/ds_base_service.py | ryanbsaunders/phantom-apps | 74 | 19767 | # File: ds_base_service.py
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
#
import json
import time
import base64
from functools import wraps
from ..config import ds_api_host, ds_api_base
from .ds_abstract_service import DSAbstractService
class DSBaseService(DSAbstractService):
... | 2.234375 | 2 |
examples/motion_planning.py | luisgaboardi/Motion-Planning-Carla-Simulator | 0 | 19768 | # Imports para o Carla
import glob
import os
import sys
try:
sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % (
sys.version_info.major,
sys.version_info.minor,
'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0])
except IndexError:
pass
import carla
try:
sys.path... | 2.21875 | 2 |
hr_api.py | AznStevy/heart_rate_sentinel_server | 0 | 19769 | import json
import requests
post_url = "http://127.0.0.1:5000/api/"
# ---------- general web interfacing ----------------------
def post(endpoint, payload, uri="http://127.0.0.1:5000/api/"):
"""
Posts to the flask web server.
Args:
endpoint: The endpoint of the API
payload: Payload accor... | 3.375 | 3 |
upload/tasks/import_gene_list_task.py | SACGF/variantgrid | 5 | 19770 | <reponame>SACGF/variantgrid<gh_stars>1-10
from genes.gene_matching import tokenize_gene_symbols, GeneSymbolMatcher
from genes.models import GeneList
from snpdb.models import ImportStatus
from upload.models import UploadedGeneList
from upload.tasks.import_task import ImportTask
from variantgrid.celery import app
def c... | 2.359375 | 2 |
Covid Dashboard/loadconfig.py | jamespilcher/daily-covid-dashboard | 0 | 19771 | """Loads the config.json file and store key value pairs into variables"""
import json
with open('config.json', 'r', encoding='utf-8') as f:
config = json.load(f)
config_location_type = config['location_type']
config_location = config['location']
country = config['country']
config_covid_terms = config['... | 3.15625 | 3 |
autoprotocol/version.py | kevin-ss-kim/autoprotocol-python | 0 | 19772 | """Maintains current version of package"""
__version__ = "6.1.2"
| 1.0625 | 1 |
models/flownet2.py | D-Nilsson/GRFP | 58 | 19773 | import glob, os
import numpy as np
import tensorflow as tf
import tensorflow.contrib.graph_editor as ge
class Flownet2:
def __init__(self, bilinear_warping_module):
self.weights = dict()
for key, shape in self.all_variables():
self.weights[key] = tf.get_variable(key, shape=shape)
... | 2.390625 | 2 |
mdm/utils.py | agnihotri7/dj_mdm | 0 | 19774 | """
"""
import sys
import uuid
import base64
import fileinput
import datetime
from django.utils import timezone
from django.conf import settings
from django.shortcuts import get_object_or_404
from urlparse import urlparse, parse_qs
from APNSWrapper import *
from mdm.models import MDMDevice, DeviceCommand
def replac... | 2.265625 | 2 |
gollyx_maps/rainbow.py | golly-splorts/gollyx-maps | 0 | 19775 | import math
import itertools
from operator import itemgetter
import json
import os
import random
from .geom import hflip_pattern, vflip_pattern, rot_pattern
from .patterns import (
get_pattern_size,
get_pattern_livecount,
get_grid_empty,
get_grid_pattern,
segment_pattern,
methuselah_quadrants_pa... | 2.375 | 2 |
filemanipulator.py | paulkramme/mit-license-adder | 0 | 19776 | <reponame>paulkramme/mit-license-adder
#!/usr/bin/python2
import tempfile
import sys
import datetime
mit_license = ("""\
/*
MIT License
Copyright (c) 2016 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
... | 2.390625 | 2 |
ve/unit/test_list_scalar.py | aneels3/pyvsc | 0 | 19777 | '''
Created on Jun 21, 2020
@author: ballance
'''
import vsc
from vsc_test_case import VscTestCase
from vsc.visitors.model_pretty_printer import ModelPrettyPrinter
class TestListScalar(VscTestCase):
@vsc.randobj
class my_item_c(object):
def __init__(self):
self.fixed = vsc.ra... | 2.25 | 2 |
config-server/test.py | wtsi-hgi/webhook-router | 2 | 19778 | import json
from configserver import ConfigServer, get_postgres_db
from configserver.errors import InvalidRouteUUIDError
from flask.testing import FlaskClient
import pytest
from peewee import SqliteDatabase
import logging
from uuid import uuid4
import functools
from typing import Iterable
@pytest.fixture(autouse=True... | 2.234375 | 2 |
Scripts/spliter.py | sawa25/PDFs-TextExtract | 87 | 19779 | <gh_stars>10-100
import os
from PyPDF2 import PdfFileReader, PdfFileWriter
#Solution based in two functions:
#1.pdf remove : Remove existed pdf documents(result for your last split operation)
#2.pdf splitter : Split your main pdf document into group of documents.
def pdf_remove (length):
for i in range(length):
... | 3.3125 | 3 |
swagger_client/apis/__init__.py | sendx/sendx-api-python | 0 | 19780 | from __future__ import absolute_import
# import apis into api package
from .contact_api import ContactApi
| 1.0625 | 1 |
strategy/overreact_strategy.py | tseng1026/SideProject-Investment | 0 | 19781 | from typing import Callable
import numpy as np
from constants.constants import IndicatorType
from strategy.base import BaseStrategy
class OverReactStrategy(BaseStrategy):
def trade_by_indicator(
self, indicator_type: IndicatorType) -> Callable[[], np.ndarray]:
""" Get trading strategy functi... | 2.859375 | 3 |
src/erpbrasil/edoc/provedores/issnet.py | Engenere/erpbrasil.edoc | 8 | 19782 | <filename>src/erpbrasil/edoc/provedores/issnet.py
# coding=utf-8
# Copyright (C) 2020 - TODAY, <NAME> - Escodoo
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import xml.etree.ElementTree as ET
from datetime import datetime
from erpbrasil.base import mis... | 1.703125 | 2 |
python/filter_MA.py | vsellemi/macroeconomic-forecasting | 3 | 19783 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 7 14:40:40 2021
@author: victorsellemi
"""
import numpy as np
def filter_MA(Y,q = 2):
"""
DESCRIPTION:
Decompose a time series into a trend and stationary component
using the moving average (MA) filter (i.e., low pass fi... | 3.46875 | 3 |
LightFields/xmlFiles/generateXMLFiles.py | sudarshannagesh90/OptimizationDeepLearningImageProcessing | 0 | 19784 | <filename>LightFields/xmlFiles/generateXMLFiles.py
import xml.etree.ElementTree as etree
import xml.dom.minidom
import subprocess
import os
import imageio
import h5py
import numpy as np
def createXMLstring(filename,scaleVal,cameraPosX,cameraPosY):
scene = etree.Element("scene",version="0.5.0")
sensor = etree.SubEl... | 2.390625 | 2 |
_old/test.py | DanielRabl/libtw2 | 30 | 19785 | <filename>_old/test.py
import datafile
from collections import defaultdict
def check_versions(df):
result = []
if len(df.types[0]) < 1:
result.append('no version')
return result
if len(df.types[0]) > 1:
result.append('multiple versions')
try:
version = df.types[0][0]
except IndexError:
result.append('v... | 2.984375 | 3 |
tests/test_rotate_3dmarkers.py | CRBS/etspecutil | 0 | 19786 | <filename>tests/test_rotate_3dmarkers.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_rotate_3dmarkers
----------------------------------
Tests for `rotate_3dmarkers` module.
"""
import sys
import unittest
import os.path
import tempfile
import shutil
import logging
from etspecutil.marker import MarkersLis... | 2.71875 | 3 |
tests/conftest.py | asvetlov/aiohttp_mako | 24 | 19787 | import sys
import pytest
import aiohttp_mako
from aiohttp import web
@pytest.fixture
def app():
app = web.Application()
lookup = aiohttp_mako.setup(app, input_encoding='utf-8',
output_encoding='utf-8',
default_filters=['decode.utf8'])
tplt... | 2.0625 | 2 |
CraftMasterGame/src/enemy.py | Athelios/CraftMaster | 0 | 19788 | <filename>CraftMasterGame/src/enemy.py
from npc import *
import math
from pyglet import image
from pyglet.graphics import TextureGroup
import os
import json
class Enemy(Npc):
def __init__(self, world, position, health, dy=0, walkSpeed=5, flying=False, flySpeed=10, height=1, jumpHeight=1.0):
super(Enemy, s... | 2.671875 | 3 |
goldsrc/mdl/structs/bodypart.py | half5life/SourceIO | 1 | 19789 | from typing import List
from .model import StudioModel
from ....source_shared.base import Base
from ....utilities.byte_io_mdl import ByteIO
class StudioBodypart(Base):
def __init__(self):
self.name = ''
self.model_count = 0
self.base = 0
self.model_offset = 0
self.models: ... | 2.34375 | 2 |
app/core/auth.py | oxfn/owtest | 0 | 19790 | from fastapi import Depends
from fastapi.exceptions import HTTPException
from fastapi.security import OAuth2PasswordBearer
from app.models.users import User, UserRepository
get_token = OAuth2PasswordBearer(tokenUrl="/login")
async def get_user(
token: str = Depends(get_token), users: UserRepository = Depends()
... | 2.46875 | 2 |
hard-gists/4471462/snippet.py | jjhenkel/dockerizeme | 21 | 19791 | #!/usr/bin/env python
#
# Author: <NAME>.
# Email:
#
from __future__ import print_function
from collections import defaultdict
import sys
import DNS
import re
RE_PARSE = re.compile(r'(ip4|ip6|include|redirect)[:=](.*)', re.IGNORECASE)
MAX_RECURSION = 5
def dns_txt(domain):
try:
resp = DNS.dnslookup(domain, 'TX... | 3.015625 | 3 |
tools/build_rules/cc_resources.bzl | justbuchanan/kythe | 0 | 19792 | <reponame>justbuchanan/kythe<gh_stars>0
def cc_resources(name, data):
out_inc = name + ".inc"
cmd = ('echo "static const struct FileToc kPackedFiles[] = {" > $(@); \n' +
"for j in $(SRCS); do\n" +
' echo "{\\"$$(basename "$${j}")\\"," >> $(@);\n' +
' echo "R\\"filecontent($$(<... | 2.125 | 2 |
modelling/model_seiihurd_matrices.py | lhunlindeion/Mathematical-and-Statistical-Modeling-of-COVID19-in-Brazil | 37 | 19793 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 19 18:08:01 2020
@author: <NAME>
Implementação do ajuste do modelo SEIIHURD com separação de grupos. Necessita
de mais verificações e funções para simplificar o input. Baseado nas classes
disponíveis no modelos.py
"""
import numpy as np
from funct... | 2.40625 | 2 |
src/fogml/generators/knn_code_generator.py | bkulawska/FogML | 0 | 19794 | <gh_stars>0
import numpy as np
import os
from sklearn.neighbors import KNeighborsClassifier
from .base_generator import BaseGenerator
class KNNCodeGenerator(BaseGenerator):
skeleton_path = "skeletons/knn_skeleton.txt"
def __init__(self, clf: KNeighborsClassifier):
self.clf = clf
@staticmethod
... | 2.75 | 3 |
modules/plugins/__init__.py | sungkomp/sambro | 5 | 19795 | # -*- coding: utf-8 -*-
import os
import sys
from gluon import current
from gluon.storage import Storage
__all__ = ("PluginLoader",
)
# Name of the plugin directory in modules
PLUGINS = "plugins"
# Module names to ignore when scanning for plugins
IGNORE = ("skeleton", "__init__")
# Name of the setup fu... | 2.484375 | 2 |
CCMtask/ccm.py | yyFFans/DemoPractises | 0 | 19796 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ccm.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_CCMTask(object):
def setupUi(self, CCMTask):
CCMTask.setObjec... | 1.460938 | 1 |
openstack_dashboard/management/commands/make_web_conf.py | wilk/horizon | 1 | 19797 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | 1.898438 | 2 |
codes/convergence_elasticity_advection/meshManager.py | adRenaud/research | 1 | 19798 | <reponame>adRenaud/research
# !/usr/bin/python
import numpy as np
import math as m
def buildMesh(Mp,l,ppc):
# Mesh built by giving :
# 1-Number of elements in x-direction
# 2-Length of meshed domain
# 3-Number of particle per cell
nex = Mp/ppc
nnx=nex+1
lmp=l/(Mp-1)
dx = ppc*l/nex
xn = np.linspace... | 2.859375 | 3 |
exarl/agents/agent_vault/_prioritized_replay.py | schr476/EXARL | 2 | 19799 | import random
import numpy as np
import tensorflow as tf
from collections import deque
class PrioritizedReplayBuffer():
""" Class implements Prioritized Experience Replay (PER)
"""
def __init__(self, maxlen):
""" PER constructor
Args:
maxlen (int): buffer length
"""
... | 2.8125 | 3 |