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 |
|---|---|---|---|---|---|---|
src/CassandraLibrary/cassandra_connection_manager.py | SensationS/Robotframework-CassandraLibrary | 0 | 12784651 | <filename>src/CassandraLibrary/cassandra_connection_manager.py<gh_stars>0
from cassandra.cluster import Cluster
class CassandraConnection(object):
"""
Connection Manager handles the connection & disconnection to the database.
"""
def __init__(self):
"""
Initializes cluster a... | 3.296875 | 3 |
tower_cli/cli/action.py | kedark3/tower-cli | 363 | 12784652 | <filename>tower_cli/cli/action.py<gh_stars>100-1000
# Copyright 2017, Ansible by Red Hat
# <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/licen... | 2.296875 | 2 |
hooks/pre_find_module_path/hook-distutils.py | sbneto/s3conf | 2 | 12784653 | import distutils
import os
from PyInstaller.utils.hooks import logger
# https://github.com/pyinstaller/pyinstaller/issues/4064
# https://pythonhosted.org/PyInstaller/hooks.html#the-pre-find-module-path-pfmp-api-method
def pre_find_module_path(api):
# Absolute path of the system-wide "distutils" package when run... | 1.898438 | 2 |
triggered_ec2_ssm_iam_role_attachment/triggered_ec2_ssm_iam_role_attachment.py | affinitywaterltd/terraform-aws-lambda | 0 | 12784654 | <gh_stars>0
import boto3
import os
ROLE_NAME = os.environ['role_name']
ec2client = boto3.client('ec2')
stsclient = boto3.client('sts')
account_id = stsclient.get_caller_identity()['Account']
iam_role_arn = "arn:aws:iam::{}:instance-profile/{}".format(account_id, ROLE_NAME)
def lambda_handler(event, context):
e... | 2.375 | 2 |
Serial/sender_serial.py | nikisalli/esp32-screen-mirroring | 0 | 12784655 | <filename>Serial/sender_serial.py
from mss import mss
import time
from PIL import Image
import serial
import io
import sys
width = 3240 # monitor width
heigth = 2160 # monitor height
offx = 0 # window horizontal offset
offy = 0 # window vertical offset
s = serial.Serial('/dev/ttyUSB0', 921600) #insert your... | 2.578125 | 3 |
tests/test_plbvfu1.py | cuihantao/Andes | 16 | 12784656 | <filename>tests/test_plbvfu1.py
"""
Test PLBVFU1 model.
"""
import unittest
import andes
class TestPLBVFU1(unittest.TestCase):
"""
Class for testing PLBVFU1.
"""
def test_PLBVFU1(self):
"""
Test PLVBFU1 model.
"""
ss = andes.run(andes.get_case("ieee14/ieee14_plbvfu1.x... | 2.625 | 3 |
rm_imgs_without_labels.py | sgavela/annotations-and-mAP-sripts | 0 | 12784657 | import argparse
import os
from pathlib import Path
import logging
def missing_image(image_path: Path, label_path: Path):
"""
This function removes the images from the train folder if the correspining labels
are not found in the .txt file.
NOTE - Make sure you perform the conversion from th... | 3.796875 | 4 |
km3pipe/utils/triggermap.py | KM3NeT/km3pipe | 1 | 12784658 | <gh_stars>1-10
#!/usr/bin/env python
# Filename: triggermap.py
# vim: ts=4 sw=4 et
"""
This script creates histogram which shows the trigger contribution for events.
Usage:
triggermap [options] -d DET_ID_OR_DETX FILENAMES...
triggermap --version
Option:
FILENAMES Name of the input file(s).
--... | 2.296875 | 2 |
specs/steps/calculator_with_regexes.py | hltbra/pycukes | 1 | 12784659 | from pycukes import *
@When('I sum $left and $right')
def sum_two_numbers(context, left, right):
context._sum = int(left) + int(right)
#Then I have 2 as result
| 2.859375 | 3 |
axes/signals.py | tabdon/django-axes | 1 | 12784660 | from django.dispatch import Signal, receiver
from django.contrib.auth.signals import user_logged_out
from django.core.exceptions import ObjectDoesNotExist
from axes.models import AccessLog
# django 1.4 has a new timezone aware now() use if available.
try:
from django.utils.timezone import now
except ImportError:
... | 2.171875 | 2 |
cafe/plugins/http/tests/engine/http/test_behaviors.py | melissa-kam/opencafe | 0 | 12784661 | # Copyright 2015 Rackspace
# 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, sof... | 2.171875 | 2 |
tusc/graph/distance.py | lucasmccabe/combinatorial-zoo | 0 | 12784662 | <reponame>lucasmccabe/combinatorial-zoo<gh_stars>0
import networkx as nx
import numpy as np
def shortest_path(G, u, v, method = "Dijkstra"):
"""
Calculates the shortest path between nodes u and v in G.
Parameters
----------
G : networkx graph
source graph
u : int or str - whatever type... | 3.890625 | 4 |
Step09_Metric_Learn.py | LMSE/PathwayLenPred | 0 | 12784663 | #!/usr/bin/env python
# coding: utf-8
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$... | 2.34375 | 2 |
codegen_sources/test_generation/test_runners/python_test_runner.py | AlexShypula/CodeGen | 241 | 12784664 | # Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import subprocess
import sys
import uuid
from pathlib import Path, PosixPath
from subprocess import Popen
from .evosu... | 1.898438 | 2 |
toutiao-backend/toutiao/main.py | MarioKarting/Flask_toutiao | 5 | 12784665 | <gh_stars>1-10
import sys
import os
#BASE_DIR -->toutiao-backend
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
#python解释器查找一个包的路径
sys.path.insert(0, os.path.join(BASE_DIR, 'common'))
sys.path.insert(0, os.path.join(BASE_DIR))
from flask import jsonify
from . import create_app
fro... | 2.328125 | 2 |
movies/urls.py | Kaushiksekar/movie_base | 0 | 12784666 | from django.urls import path
from .views import call_json_to_db, get_all_movies, add_movie, edit_movie, remove_movie
urlpatterns = [
path('load-db/', call_json_to_db, name='load_db'),
path('list/', get_all_movies, name='all_movies'),
path('add/', add_movie, name='add_movie'),
path('edit/', edit_movie, ... | 1.75 | 2 |
octicons16px/check_circle_fill.py | andrewp-as-is/octicons16px.py | 1 | 12784667 |
OCTICON_CHECK_CIRCLE_FILL = """
<svg class="octicon octicon-circle-fill" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 16A8 8 0 108 0a8 8 0 000 16zm3.78-9.72a.75.75 0 00-1.06-1.06L6.75 9.19 5.28 7.72a.75.75 0 00-1.06 1.06l2 2a.75.75 0 001.06 0l4.5-4.5z"><... | 1.382813 | 1 |
torch_tools/data/datasets/util/dataset_to_h5.py | gregunz/TorchTools | 0 | 12784668 | from itertools import tee
from pathlib import Path
from typing import Union, List, Tuple
import h5py
import torch
from torch.utils.data import Dataset, DataLoader
from tqdm.auto import tqdm
T = List[Tuple[torch.Tensor, torch.Tensor]]
def dataset_to_h5_file(dataset: Union[Dataset, T], filepath: Union[str, Path], inp... | 2.140625 | 2 |
tests/test_similarity_matrix_filters.py | jo-mueller/biapol-utilities | 4 | 12784669 | # -*- coding: utf-8 -*-
import biapol_utilities as biau
import numpy as np
def test_suppression():
a = np.random.rand(100).reshape(10, -1)
threshold = 0.5
a_sup = biau.label.suppressed_similarity(a, threshold=threshold)
assert(all(a_sup[a < threshold].ravel() == 0))
if __name__ == "__main__":
... | 2.640625 | 3 |
nPYc/reports/_generateBasicPCAReport.py | ghaggart/nPYc-Toolbox | 14 | 12784670 | <reponame>ghaggart/nPYc-Toolbox
import os
import re
from collections import OrderedDict
from ..plotting import plotScores, plotLoadings
from pyChemometrics.ChemometricsPCA import ChemometricsPCA
def generateBasicPCAReport(pcaModel, dataset, figureCounter=1, destinationPath=None, fileNamePrefix=''):
"""
Visualise a ... | 2.1875 | 2 |
bin/generate_sitemap.py | gaybro8777/CiteSeerX | 108 | 12784671 | #!/usr/bin/python
# Script to generate sitemaps
# <NAME>
# Requires mysql-python
import MySQLdb
import argparse
import logging
import os
import sys
import subprocess
from config import db
logging.basicConfig(level=logging.INFO)
parser = argparse.ArgumentParser()
parser.add_argument("sitemapdir")
args = parser.parse_a... | 2.71875 | 3 |
tests/test_upload_download_local.py | anand870/aiocloudstorage | 2 | 12784672 | <reponame>anand870/aiocloudstorage<filename>tests/test_upload_download_local.py
import os
import pytest
import io
from aiocloudstorage.drivers.local import LocalDriver
from tests.settings import *
from tests.helpers import random_container_name, uri_validator,binary_iostreams
from aiocloudstorage.exceptions import Clou... | 2.09375 | 2 |
test/controllers/test_delete_debt_by_id_route.py | JVGC/MyFinancesPython | 0 | 12784673 | <reponame>JVGC/MyFinancesPython<gh_stars>0
import unittest
from uuid import uuid4
from domain.entities import Date, Debt
from infra.controllers.contracts.http import HttpRequest
from infra.controllers.errors import NotFoundError
from infra.controllers.operators.debt import DeleteDebtByIdOperator
from infra.repositorie... | 2.390625 | 2 |
fHDHR/versions/__init__.py | deathbybandaid/fHDHR | 0 | 12784674 | import os
import sys
import platform
from fHDHR import fHDHR_VERSION
from fHDHR.tools import is_docker
class Versions():
"""
fHDHR versioning management system.
"""
def __init__(self, settings, fHDHR_web, logger, web, db, scheduler):
self.fHDHR_web = fHDHR_web
self.logger = logger
... | 2.359375 | 2 |
saved_scores/mwob/pop_dir.py | nathanShepherd/Intelligent-Interface | 3 | 12784675 | click_games = ['BisectAngle',
'ChaseCircle',
'ChooseDate',
'ChooseList',
'CircleCenter',
'ClickButton',
'ClickButtonSequence',
'ClickCheckboxes',
'ClickCollapsible',
'ClickCollapsible2',
'ClickColor',
'ClickDialog',
'ClickDialog2',
'ClickLink',
'ClickMenu2',
'ClickOption',
'ClickPie',
'ClickShades',
'ClickShape',
'Clic... | 2.1875 | 2 |
OpenDataCatalog/contest/views.py | runonthespot/Open-Data-Catalog | 105 | 12784676 | from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.template.loader import render_to_string
from django.core.mail import send_mail, mail_managers, EmailMessage
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from ... | 1.945313 | 2 |
result/migrations/mig/0027_auto_20190626_0838.py | 0Jihad/uqhs | 0 | 12784677 | <reponame>0Jihad/uqhs<filename>result/migrations/mig/0027_auto_20190626_0838.py
# Generated by Django 2.1.3 on 2019-06-25 19:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('result', '0026_auto_20190626_0835'),
]
operations = [
migrations.Ren... | 1.507813 | 2 |
LogisticRegression_Firth.py | LukeLB/LogisticRegression_Firth | 1 | 12784678 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 6 09:59:14 2021
@author: ll17354
"""
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.linear_model._logistic import LogisticRegression
from sklearn.utils.validation import check_X_y, check_array, check_is_fitted
import sys
import warnings
import math
... | 2.96875 | 3 |
tests/query/test_base_query.py | m-housh/flask_open_directory | 0 | 12784679 | import pytest
from flask_open_directory import BaseQuery, User
from flask_open_directory.query.base_query import _quote_if_str
import ldap3
@pytest.fixture
def base_query(open_directory):
return BaseQuery(open_directory=open_directory)
@pytest.fixture
def connection():
return ldap3.Connection(ldap3.Server(... | 2.109375 | 2 |
avgn/custom_parsing/mobysound_humpback.py | xingjeffrey/avgn_paper | 0 | 12784680 | from avgn.utils.audio import get_samplerate
from avgn.utils.json import NoIndent, NoIndentEncoder
import numpy as np
from avgn.utils.paths import DATA_DIR
import librosa
from datetime import datetime
import pandas as pd
import avgn
import json
DATASET_ID = 'mobysound_humpback_whale'
def load_labs(labels):
all_lab... | 2.53125 | 3 |
federatedml/ftl/test/functional_test/hetero_ftl_plain_guest_test.py | chenlongzhen/FATE-0.1 | 1 | 12784681 | #
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 1.851563 | 2 |
evap/evaluation/migrations/0125_use_lists_for_ordering.py | felixrindt/EvaP | 29 | 12784682 | <gh_stars>10-100
# Generated by Django 3.1.8 on 2021-07-24 17:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('evaluation', '0124_add_html_content'),
]
operations = [
migrations.AlterModelOptions(
name='logentry',
opti... | 1.710938 | 2 |
server/mlabns/db/nagios_config_wrapper.py | mtlynch/m-lab.ns | 10 | 12784683 | import logging
from google.appengine.api import memcache
from mlabns.db import model
from mlabns.util import constants
def get_nagios_config():
"""Retrieves nagios config info. First checks memcache, then datastore.
Returns:
Nagios model instance
"""
nagios = memcache.get(constants.DEFAULT_... | 2.359375 | 2 |
l5kit/l5kit/tests/planning/common_test.py | cdicle-motional/l5kit | 1 | 12784684 | <reponame>cdicle-motional/l5kit
import torch
def mock_vectorizer_data(batch_size: int, num_steps: int, num_history: int, num_agents: int, num_lanes: int,
num_crosswalks: int, num_points_per_element: int, TYPE_MAX: int) -> dict:
return {
"extent": torch.rand(batch_size, 3),
... | 2.125 | 2 |
gs15_py/signature_RSA.py | Jajajzhh/Blockchain_EncryptionKasumi | 0 | 12784685 | <gh_stars>0
from Crypto.PublicKey import RSA
import errno
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
from hashlib import sha512
from os import mkdir
from os import _exists
#RSA signature
class Sign_hash:
def __init__(self, usernum):
#Using Crypto Library to generate, export an... | 2.828125 | 3 |
game/entities/voxel.py | eivaremir/TheLearningDoors | 2 | 12784686 | from ursina import *
from ..textures import textures
class Voxel(Button):
def __init__(self, position = (0,0,0), texture = textures["grass"]):
super().__init__(
parent = scene,
position = position,
model = 'assets/block',
origin_y = .5,
texture =t... | 2.46875 | 2 |
d17.py | theShmoo/adventofcode2019 | 0 | 12784687 | import intcode
import utils
class Droid(object):
def __init__(self):
super(Droid, self).__init__()
self.grid = []
self.current_line = []
self.width = 0
self.height = 0
self.neighborhoods = ((1, 0), (0, 1), (-1, 0), (0, -1))
def printGrid(self):
s = ""
... | 3.09375 | 3 |
terrascript/kubernetes/__init__.py | amlodzianowski/python-terrascript | 0 | 12784688 | <reponame>amlodzianowski/python-terrascript<filename>terrascript/kubernetes/__init__.py
# terrascript/kubernetes/__init__.py
import terrascript
class kubernetes(terrascript.Provider):
pass
| 1.296875 | 1 |
vote.py | evan82/dash-voter | 1 | 12784689 | <gh_stars>1-10
#!/usr/bin/env python
"""
Dash-Voter
----
Mass vote on a proposal semi-anonymously
"""
import subprocess
import argparse
import json
from config import dashd_path, datadir, masternodes
from random import randint, shuffle
from time import sleep
from sys import exit, argv
print dashd_path, datadir
if... | 2.5625 | 3 |
mllogger.py | ok1zjf/LBAE | 15 | 12784690 | __author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__= '1.8'
__status__ = "Research"
__date__ = "2/1/2020"
__license__= "MIT License"
import os
import sys
import numpy as np
import time
import glob
from torchvision.utils import make_grid
from tensorboardX import SummaryWriter
import imageio
import skimage
from para... | 2.171875 | 2 |
core/app/utils/tests/test_date.py | EmixMaxime/mx-home-security | 2 | 12784691 | from datetime import timedelta
from unittest import TestCase
from django.utils import timezone
from freezegun import freeze_time
from utils.date import is_time_newer_than
class UtilsDateTestCase(TestCase):
def setUp(self) -> None:
pass
@freeze_time("2020-12-21 03:21:00")
def test_is_less_old_th... | 2.828125 | 3 |
Frozen/script.py | killua4564/2021-Crypto-CTF | 0 | 12784692 | from pwn import remote
from gmpy2 import next_prime
from Crypto.Util.number import *
conn = remote("03.cr.yp.toc.tf", "25010")
def get_params():
conn.recvuntil("[Q]uit")
conn.sendline("s")
conn.recvuntil(" = ")
p = int(conn.recvuntil("\n").decode())
conn.recvuntil(" = ")
r = int(conn.recvunti... | 2.25 | 2 |
tools/ops.py | imatge-upc/unsupervised-2017-cvprw | 25 | 12784693 | <gh_stars>10-100
import math
import numpy as np
import tensorflow as tf
from tensorflow.python.framework import ops
def _variable_with_weight_decay(name, shape, wd=1e-3):
with tf.device("/cpu:0"): # store all weights in CPU to optimize weights sharing among GPUs
var = tf.get_variable(name, shape, initia... | 2.53125 | 3 |
fsutil/test/write_with_config.py | wenbobuaa/pykit | 13 | 12784694 | import os
import sys
from pykit import fsutil
fn = sys.argv[1]
fsutil.write_file(fn, 'boo')
stat = os.stat(fn)
os.write(1, '{uid},{gid}'.format(uid=stat.st_uid, gid=stat.st_gid))
| 2.34375 | 2 |
config/__init__.py | haoyu-x/robot-learning | 1 | 12784695 | """ Define parameters for algorithms. """
import argparse
def str2bool(v):
return v.lower() == "true"
def str2intlist(value):
if not value:
return value
else:
return [int(num) for num in value.split(",")]
def str2list(value):
if not value:
return value
else:
re... | 3.484375 | 3 |
tools/python/boutiques/__version__.py | glatard/boutiques | 2 | 12784696 | VERSION = "0.5.23"
| 1.117188 | 1 |
python/test/test_feature_extraction.py | spongezhang/vlb | 11 | 12784697 | <reponame>spongezhang/vlb
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ===========================================================
# File Name: test_feature_extraction.py
# Author: <NAME>, Columbia University
# Creation Date: 01-25-2019
# Last Modified: Sat Feb 9 11:13:09 2019
#
# Usage: python test_feature_extrac... | 1.984375 | 2 |
tests/conftest.py | paulperegud/small-1toN-transactions | 0 | 12784698 | import os
import pytest
from ethereum import utils
from ethereum.tools import tester
from ethereum.abi import ContractTranslator
from ethereum.config import config_metropolis
from solc_simple import Builder
GAS_LIMIT = 8000000
START_GAS = GAS_LIMIT - 1000000
config_metropolis['BLOCK_GAS_LIMIT'] = GAS_LIMIT
# Compil... | 1.921875 | 2 |
src/NER.py | HaritzPuerto/Entity_Extractor | 2 | 12784699 | <reponame>HaritzPuerto/Entity_Extractor
import spacy
from tqdm import tqdm
class Entity_model():
def __init__(self, spacy_model='en_core_web_sm'):
self.nlp = spacy.load(spacy_model)
def __clean_input(self, s):
'''
Remove duplicated whitespaces.
There are several instances in SQ... | 2.8125 | 3 |
src/userservice/tests/test_db.py | Budget-Web-App/budget-web-app | 0 | 12784700 | <reponame>Budget-Web-App/budget-web-app
"""
Tests for db module
"""
import unittest
from unittest.mock import patch
from sqlalchemy.exc import IntegrityError
from db import UserDb
from tests.constants import EXAMPLE_USER
class TestDb(unittest.TestCase):
"""
Test cases for db module
"""
def setUp(s... | 3.078125 | 3 |
src/manager/om/script/gspylib/inspection/items/network/CheckMTU.py | wotchin/openGauss-server | 1 | 12784701 | <reponame>wotchin/openGauss-server<filename>src/manager/om/script/gspylib/inspection/items/network/CheckMTU.py
# -*- coding:utf-8 -*-
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms
# and conditions of the Mulan PSL v2.
#... | 2.03125 | 2 |
Q7.py | devasheeshG/Project-file-XII_21-22 | 0 | 12784702 | <filename>Q7.py
# Q7. Write a programs to find the sum of the following series :
a)1/x + 1/x2+ 1/x3+................. 1/xn
b)1 + 1/2! + 1/3! +.......................1/n!
c)1 –2 + 3 –4 + 5 -...................... n | 2.703125 | 3 |
lab-taxi/main.py | aopina1/DRLND-Course | 0 | 12784703 | from agent import Agent
from monitor import interact
import gym
import numpy as np
env = gym.make('Taxi-v3')
agent = Agent()
avg_rewards, best_avg_reward = interact(env, agent) | 1.773438 | 2 |
scripts/twint2json.py | code2k13/nlppipe | 9 | 12784704 | #!/usr/bin/env python3
import sys
import json
for line in sys.stdin:
s = line.split(" ")
obj = {}
obj['id'] = s[0]
obj['date'] = s[1] + " " + s[2] + " " + s[3]
obj['user'] = s[4]
obj['text'] = " ".join(s[5:])
print(json.dumps(obj,ensure_ascii=False)) | 2.65625 | 3 |
tests/test_console_script.py | MapleCCC/importall | 0 | 12784705 | from runpy import run_module
import pytest
from .subtest import _test_stdlib_symbols_in_namespace
# TODO do some research about how to test an interactive CLI application
@pytest.mark.xfail
def test_console_script() -> None:
_test_stdlib_symbols_in_namespace(run_module("importall"))
| 1.476563 | 1 |
test/config_test.py | jamesbeyond/mbed-fastmodel-agent-1 | 0 | 12784706 | from unittest import TestCase
from fm_agent.fm_config import FastmodelConfig
from fm_agent.utils import SimulatorError
class TestFastmodelConfig(TestCase):
def test_Setting_File(self):
self.assertTrue(FastmodelConfig.SETTINGS_FILE,"settings.json")
def test_parse_params_file_failed(self):
c=Fas... | 2.59375 | 3 |
vuakhter/base/requests_log.py | best-doctor/vuakhter | 0 | 12784707 | <reponame>best-doctor/vuakhter<filename>vuakhter/base/requests_log.py
from __future__ import annotations
import typing
from vuakhter.base.base_log import BaseLog
if typing.TYPE_CHECKING:
from vuakhter.utils.types import RequestEntry, TimestampRange
class RequestsLog(BaseLog):
def get_records(self, ts_range:... | 2.046875 | 2 |
test/test_filters.py | ecometrica/grandfatherson | 15 | 12784708 | from datetime import datetime, date
import unittest
from grandfatherson import (FRIDAY, SATURDAY, SUNDAY)
from grandfatherson.filters import (Seconds, Minutes, Hours, Days, Weeks,
Months, Years, UTC)
def utcdatetime(*args):
return datetime(*args, tzinfo=UTC())
class TestSeco... | 3.125 | 3 |
mugicli/pytail.py | mugiseyebrows/mugi-cli | 0 | 12784709 | from . import head_tail_main, T_TAIL
def main():
head_tail_main(T_TAIL)
if __name__ == "__main__":
main() | 1.4375 | 1 |
plugins/helpers/table_dictionaries.py | rmmoreira/udacity-dend-capstone | 1 | 12784710 | """ Dictionary file for tables """
staging_tables = {
'immigration': 'immigration_table',
'temperature': 'temperature_table',
'airport': 'airport_table',
'demographics': 'demographics_table'
}
fact_dimension_tables = {
'city_data': 'fact_city_data_table',
'demographic': 'dim_demographic_table'... | 2.140625 | 2 |
players.py | aroxby-kinnek/machine-learning | 0 | 12784711 | """
Players!
"""
import random
from readchar import readchar
class Player(object):
"""
Base player object
"""
def next_move(self, game):
"""
Retrieve the next move for this player in this game
"""
raise NotImplementedError
class HumanPlayer(Player):
"""
Human ... | 3.59375 | 4 |
temperature/temperature.py | Harry-Lees/TemperaturePy | 1 | 12784712 | from __future__ import annotations
from numbers import Real
ABSOLUTE_ZERO: float = 0.0 # in Kelvin
ABSOLUTE_HOT: float = 1.416785e32 # in Kelvin
class Temperature:
'''
Simple Temperature class for converting between different units of temperature.
Default temperature unit is Kelvin.
'''
def __in... | 3.609375 | 4 |
ticket.py | qhgongzi/xilinTicketV2 | 5 | 12784713 | __author__ = 'Administrator'
import requests
import xlstr
import time
class Ticket:
#车票信息
train_no = ''
station_train_code = '' #车次编号,例如K540
from_station_telecode = ''
from_station_name = ''
to_station_telecode = ''
to_station_name = ''
yp_info = '' #未知信息
location_code = ''
s... | 2.5 | 2 |
tests/unit/config/api/test_settings.py | antonku/ncssl_api_client | 8 | 12784714 | import mock
from unittest import TestCase
from ncssl_api_client.config.api import settings
try:
reload # Python 2.7
except NameError:
try:
from importlib import reload # Python 3.4+
except ImportError:
from imp import reload # Python 3.0 - 3.3
try:
__import__('__builtin__')
open... | 2.375 | 2 |
core/preprocessing/voice.py | ArnolFokam/dna-gate-backend | 0 | 12784715 | import noisereduce as nr
def remove_noise(data, rate):
return nr.reduce_noise(y=data,
sr=rate,
thresh_n_mult_nonstationary=2,
stationary=False)
| 2.46875 | 2 |
validator/sawtooth_validator/journal/chain_commit_state.py | askmish/sawtooth-core | 0 | 12784716 | # Copyright 2017 Intel Corporation
#
# 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 wri... | 2.078125 | 2 |
sip/tango_control/tango_interactive_client/check_tango_host.py | SKA-ScienceDataProcessor/integration-prototype | 3 | 12784717 | # coding: utf-8
"""."""
from tango import Database
# Get reference to tango database
DB = Database()
print('=' * 80)
print('Database info:')
print('=' * 80)
print(DB.get_info())
print('=' * 80)
print('Server list:')
print('=' * 80)
print(DB.get_server_list().value_string)
print('')
| 2.0625 | 2 |
tests/test_validator.py | ens-lgil/gwas-sumstats-validator | 0 | 12784718 | import unittest
import shutil
import os
import sys
import tests.prep_tests as prep
import validate.validator as v
from validate.common_constants import *
import tests.test_values as test_arrays
class BasicTestCase(unittest.TestCase):
def setUp(self):
self.test_storepath = "./tests/data"
os.makedir... | 2.546875 | 3 |
utils/resource_path.py | MAPL-UFU/palms-ftp | 0 | 12784719 |
# You need to use this script every time you want to rebuild pyinstaller under the pyQ5 MainWindow.py
#-------------------------------------------------------------
import os
import sys
def resource_path(relative_path):
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)
... | 2.109375 | 2 |
presets/keywords.py | monotony113/feedly-link-aggregator | 5 | 12784720 | PRIORITIZED_KEYWORDS = {
10: ['cats', 'kitties'],
5: ['dogs', 'puppies'],
-5: ['goldfish'],
-float('inf'): ['rat'],
}
| 1.46875 | 1 |
app/lab/handle/handleMaterial.py | jerry0chu/Experiment | 0 | 12784721 | from app.models import Material
from app import db
import json
def handleGetMaterials(page,per_page):
materials = Material.query.paginate(page=page, per_page=per_page, error_out=False)
res = db.engine.execute("select count(*) from material")
count = [r[0] for r in res][0]
materialInfo = {
'mate... | 2.40625 | 2 |
catalyst/utils/scripts.py | 162/catalyst | 0 | 12784722 | <reponame>162/catalyst
import os
import sys
import shutil
import pathlib
from importlib.util import spec_from_file_location, module_from_spec
def import_module(expdir: pathlib.Path):
# @TODO: better PYTHONPATH handling
if not isinstance(expdir, pathlib.Path):
expdir = pathlib.Path(expdir)
sys.path... | 2.0625 | 2 |
protocol_scripts/Test_custom_labware.py | Microbiaki-Lab/Opentrons | 0 | 12784723 | <gh_stars>0
#!/usr/bin/env python
#test custom pcr plates, move water from first row to second
from opentrons import protocol_api
metadata = {'apiLevel': '2.11'}
def run(protocol: protocol_api.ProtocolContext):
protocol.home()
plate = protocol.load_labware('tethystestrun2', 1) #our_well_plate
tiprack_mul... | 2.390625 | 2 |
client_script.py | Cr0wTom/Block-SSL-Smart-Contract | 1 | 12784724 | <filename>client_script.py
#!/usr/bin/python
import sys
import string
import hashlib
import os
import random
import struct
import getpass
import datetime
import json
import requests #pip install requests
import traceback
import subprocess
from datetime import timedelta
from Crypto.Cipher import AES
from pybitcoin impo... | 2.546875 | 3 |
9-dars-uyishi.py | thejorabek/python | 1 | 12784725 | <filename>9-dars-uyishi.py
#%% 1
class Hayvon():
def __init__(self,nomi):
self.name=nomi
class Yirtqich(Hayvon):
def ovlash(self):
print(self.name,"yashash uchun ovlaydi")
def yugurish(self):
print(self.name,"o'ljaga yetib olish uchun yuguradi")
def uxlash(self):
print(se... | 3.5625 | 4 |
model/create_landscape.py | FelixNoessler/Buffers-or-corridors-for-great-crested-newts | 0 | 12784726 | import scipy.spatial as sci_spatial
import skimage.draw as ski_draw
import shapely.geometry as shapely_geom
import numpy as np
import os, sys
def create_landscape(no_of_circles, radius):
# create the middle points of the ponds (the ponds should not overlap)
x,y = np.random.randint(0,400), np.random.randi... | 2.859375 | 3 |
pdip/integrator/integration/types/base/integration_adapter.py | ahmetcagriakca/pdip | 2 | 12784727 | from abc import ABC, abstractmethod
from ...domain.base import IntegrationBase
from ....operation.domain.operation import OperationIntegrationBase
from ....pubsub.base import ChannelQueue
class IntegrationAdapter(ABC):
@abstractmethod
def execute(
self,
operation_integration: Operatio... | 2.390625 | 2 |
student/urls.py | ashkantaravati/TDRRS | 2 | 12784728 | <filename>student/urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.get_dashboard, name='dashboard'),
url(r'^dashboard',views.get_dashboard,name='dashboard'),
url(r'^login',views.do_login, name='login'),
url(r'^defense-times',views.defense_times, name='defens... | 1.929688 | 2 |
barrel_reaktor/search/models.py | txtr/barrel-reaktor | 0 | 12784729 | from barrel import Store, Field, FloatField, EmbeddedStoreField
from barrel.rpc import RpcMixin
from barrel_reaktor.document.models import Document
from . import get_search_sources
class Stat(Store):
"""The reaktor always passes in `name` as the value to use for the search
facet. Since it's a value, let's ren... | 2.421875 | 2 |
NumberTheoryAssigment3.py | esraagamal23/RSA-CryptoSystem- | 0 | 12784730 | import math
from random import randint
from numpy import sqrt
def GCD(a, b):
if b == 0:
return a
return GCD(b, a % b)
#######################################
def ExtendedEuclid(a, b):
if b == 0:
return (1, 0)
(x, y) = ExtendedEuclid(b, a % b)
k = a // b
return (y, x - k * y)
... | 3.40625 | 3 |
Finance/jpy2ntd.1m.py | wwwins/MyBitbarPlugins | 0 | 12784731 | #!/Users/isobar/.virtualenvs/py3/bin/python
# -*- coding: utf-8 -*-
# <bitbar.title>JPY to NTD</bitbar.title>
# <bitbar.version>1.0</bitbar.version>
# <bitbar.author>wwwins</bitbar.author>
# <bitbar.author.github>wwwins</bitbar.author.github>
# <bitbar.desc>Japanese Yen to Taiwan New Dollar Rate</bitbar.desc>
# <bitbar... | 2.640625 | 3 |
dingtalk/python/alibabacloud_dingtalk/trade_1_0/models.py | aliyun/dingtalk-sdk | 15 | 12784732 | <filename>dingtalk/python/alibabacloud_dingtalk/trade_1_0/models.py
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel
from typing import Dict
class QueryTradeOrderHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None... | 2.265625 | 2 |
gitdir/testsave.py | guyKN/voiceswap | 1 | 12784733 | import tensorflow as tf
import os
X = tf.placeholder(tf.float32,[None,1])
W = tf.Variable(tf.zeros([1,1]))
B = tf.Variable(tf.zeros([1]))
y = tf.matmul(X,W) + B
y_ = tf.placeholder(tf.float32,[None,1])
cost = tf.reduce_mean(tf.square(y-y_))
opt = tf.train.AdagradOptimizer(1).minimize(cost)
feed = {X:[[1],[4]], ... | 2.4375 | 2 |
laboratorios/1-recursion/E/problem.py | MatiwsxD/ayed-2019-1 | 0 | 12784734 | import json
def supe(digit):
digit = str(digit)
if len(digit)==1:
return digit
else:
cont = 0
for i in range(len(digit)):
cont+= int(digit[i])
return supe(cont)
# TODO Complete!
def super_digit(n, k):
digit = str(str(n)*k)
return int(sup... | 3.578125 | 4 |
mtbf_driver/MtbfTestCase.py | Mozilla-GitHub-Standards/0c166c201f85d9bdef4d4ad1ce985515176672819d41406b9977f54b7ac091dc | 0 | 12784735 | <filename>mtbf_driver/MtbfTestCase.py
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import time
from gaiatest import GaiaTestCase
from gaiatest.apps.homescreen.app i... | 2.21875 | 2 |
spec2scl/transformers/perl.py | pombredanne/bitbucket.org-bkabrda-spec2scl | 0 | 12784736 | from spec2scl import settings
from spec2scl import transformer
from spec2scl.decorators import matches
@transformer.Transformer.register_transformer
class PerlTransformer(transformer.Transformer):
def __init__(self, options={}):
super(PerlTransformer, self).__init__(options)
@matches(r'^[^\n]*%{__per... | 2.359375 | 2 |
autogalaxy/analysis/aggregator/aggregator.py | jonathanfrawley/PyAutoGalaxy | 0 | 12784737 | <reponame>jonathanfrawley/PyAutoGalaxy
from autofit.database.model.fit import Fit
import autogalaxy as ag
from typing import Optional
from functools import partial
def plane_gen_from(aggregator):
"""
Returns a generator of `Plane` objects from an input aggregator, which generates a list of the `Pl... | 3.015625 | 3 |
send_email.py | PoojaJain30/Daily-HackerNews-Email | 0 | 12784738 | import smtplib
from email.message import EmailMessage
# function to send email to listed email address
def send_email(info,news):
email = EmailMessage()
email['From'] = '< Sender Name >'
email['To'] = info[1]
email['Subject'] = 'Hello '+info[0]
email.set_content(news,'html')
with smtplib.SMTP(... | 3.40625 | 3 |
drlnd/core/common/path.py | yycho0108/DRLND_Core | 0 | 12784739 | #!/usr/bin/env python3
from pathlib import Path
def get_project_root() -> Path:
"""
Get project root directory with assumed structure as:
${PACKAGE_ROOT}/core/common/path.py
"""
return Path(__file__).resolve().parent.parent.parent
def get_config_file() -> Path:
"""
Get default config fi... | 2.84375 | 3 |
riscof/utils.py | haseebazaz-10xe/riscof | 0 | 12784740 | # See LICENSE.incore for details
import pathlib
import logging
import argparse
import os
import sys
import subprocess
import operator
import shlex
import ruamel
from ruamel.yaml import YAML
#from riscof.log import logger
yaml = YAML(typ="rt")
yaml.default_flow_style = False
yaml.allow_unicode = True
logger = loggin... | 2.375 | 2 |
release/stubs.min/Tekla/Structures/ModelInternal_parts/dotBooleanPart_t.py | htlcnn/ironpython-stubs | 182 | 12784741 | <filename>release/stubs.min/Tekla/Structures/ModelInternal_parts/dotBooleanPart_t.py
class dotBooleanPart_t(object):
# no doc
Boolean=None
OperativePart=None
Type=None
| 1.359375 | 1 |
tests/unit/test_index_class.py | griggheo/cheesecake | 12 | 12784742 | """
Prepare enviornment.
>>> import _path_cheesecake
>>> from cheesecake.cheesecake_index import Index
>>> from _helper_cheesecake import Glutton
*****
Default maximum value for an index should be 0.
>>> index = Index()
>>> index.max_value
0
To learn a class name, ask for its representation.
... | 3.34375 | 3 |
nlplingo/nn/extraction_model.py | BBN-E/nlplingo | 3 | 12784743 | from __future__ import absolute_import
from __future__ import division
from __future__ import with_statement
import abc
import json
import logging
import numpy as np
import os
import keras
from keras.optimizers import Adadelta, SGD, RMSprop, Adam
from nlplingo.nn.constants import supported_pytorch_models
from nlplin... | 2.140625 | 2 |
netdev/vendors/cisco/cisco_asa.py | maliciousgroup/netdev | 199 | 12784744 | <reponame>maliciousgroup/netdev
"""Subclass specific to Cisco ASA"""
import re
from netdev.logger import logger
from netdev.vendors.ios_like import IOSLikeDevice
class CiscoASA(IOSLikeDevice):
"""Class for working with Cisco ASA"""
def __init__(self, *args, **kwargs):
"""
Initi... | 2.4375 | 2 |
jumpscale/packages/threebot_deployer/models/user_solutions.py | zaibon/js-sdk | 0 | 12784745 | from jumpscale.core.base import Base, fields
from enum import Enum
import hashlib
class ThreebotState(Enum):
RUNNING = "RUNNING" # the workloads are deployed and running
DELETED = "DELETED" # workloads and backups deleted
STOPPED = "STOPPED" # expired or manually stoped (delete workloads only)
class ... | 2.296875 | 2 |
clean_architecture_helper_gql_extension/connections.py | HerlanAssis/django-clean-architecture-helper-gql-extension | 0 | 12784746 | import graphene
from graphene import Int
class TotalItemsConnection(graphene.relay.Connection):
class Meta:
abstract = True
total = Int()
def resolve_total(self, info, **kwargs):
return len(self.iterable)
class BaseConnectionField(graphene.relay.ConnectionField):
def __init__(self,... | 2.296875 | 2 |
three/lights.py | jzitelli/three.py | 12 | 12784747 | <reponame>jzitelli/three.py
from . import *
class Light(Object3D):
def __init__(self, color=0xffffff, intensity=None, distance=None, shadowCameraNear=None, shadowCameraFar=None, shadowCameraFov=None, **kwargs):
Object3D.__init__(self, **kwargs)
self.color = color
self.intensity = intensity
... | 2.75 | 3 |
options/base_options.py | csqiangwen/Deep-Unsupervised-Pixelization | 42 | 12784748 | <gh_stars>10-100
import argparse
import os
import torch
class BaseOptions():
def __init__(self):
self.parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
self.initialized = False
def initialize(self):
self.parser.add_argument('--dataroot', required... | 2.21875 | 2 |
FileSize/Non_newline_file_size.py | JennyChi/Script-helper | 0 | 12784749 | import sys
f = file('100MB.log', 'r')
content = f.read()
totalbytes = 0
for line in content.split("\n"):
totalbytes = len(line.rstrip("\n")) + totalbytes
'''
method 2: using count the character != \n
for counter in content:
if counter != "\n":
totalbytes = totalbytes + 1
'''
print "Non-newline b... | 2.8125 | 3 |
server/swagger_server/models/preferences.py | fabric-testbed/UserInformationService | 0 | 12784750 | # coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from swagger_server.models.base_model_ import Model
from swagger_server import util
class Preferences(Model):
"""NOTE: This class is auto generated by the swagger... | 2.203125 | 2 |