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 |
|---|---|---|---|---|---|---|
wsgi.py | nadeengamage/flaskee | 0 | 41200 | """
The Flaskee is an Open Source project for Microservices.
Develop By <NAME> | https://nadeengamage.com | <EMAIL>
"""
from werkzeug.serving import run_simple
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from flaskee import api
app = api.create_app()
application = DispatcherMiddleware(app)
if _... | 1.59375 | 2 |
tests/use_cases/test_config_init.py | staticdev/github-portfolio | 0 | 41201 | <filename>tests/use_cases/test_config_init.py
"""Test cases for the config initialization use case."""
import pytest
from pytest_mock import MockerFixture
import git_portfolio.domain.gh_connection_settings as cs
import git_portfolio.responses as res
import git_portfolio.use_cases.config_init as ci
@pytest.fixture
de... | 2.25 | 2 |
pyproc/views/__init__.py | cmin764/pyproc | 0 | 41202 | <filename>pyproc/views/__init__.py
"""All views and routes exposed by the pyproc web app."""
from . import (
message,
)
| 1.289063 | 1 |
examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/configs.py | felipeek/bullet3 | 9,136 | 41203 | <reponame>felipeek/bullet3
# Copyright 2017 The TensorFlow Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 1.773438 | 2 |
RNAPuzzles/rnapuzzles/urls.py | whinyadventure/RNA-Puzzles | 0 | 41204 | from django.urls import path, include, re_path
from django.views.generic import FormView
from . import views
from .views import news, faq, resources, group, user, puzzles, submission, score_challenge, metrics
import publications.views as plist
news_patterns = [
path('', news.List.as_view(), name="news_list"),
... | 2 | 2 |
Software_Project/tools/image_processing.py | Microdent/Handwritten_Mathematical_Calculator_on_FPGA | 24 | 41205 | import numpy as np
import queue
import cv2
import os
import datetime
SIZE = 32
SCALE = 0.007874015748031496
def quantized_np(array,scale,data_width=8):
quantized_array= np.round(array/scale)
quantized_array = np.maximum(quantized_array, -2**(data_width-1))
quantized_array = np.minimum(quantized_array, 2**... | 2.796875 | 3 |
src/preprocess/setup.py | CyberAgentAILab/canvas-vae | 12 | 41206 | """Packager for cloud environment."""
from setuptools import setup, find_packages
setup(
name='preprocess',
version='1.0.0',
packages=find_packages(),
install_requires=[
'tensorflow',
'numpy',
],
)
| 1.3125 | 1 |
tests/test_parsers.py | MiamiOH-iGEM/igem-wikisync | 10 | 41207 | <gh_stars>1-10
import hashlib
from datetime import date
import pytest
from igem_wikisync.parsers import CSSparser, HTMLparser, JSparser
@pytest.fixture
def config():
return {
'team': 'BITSPilani-Goa_India',
'src_dir': 'tests/data',
'build_dir': 'tests/build',
'year': str(date.tod... | 2.25 | 2 |
SnakeGame/main.py | kmhmubin/Automate-the-boring-stuff-with-python3 | 5 | 41208 | <filename>SnakeGame/main.py
"""TODO: Snake Game
1. create a screen with 600x600 size
2. create a snake body
3. move the snake
4. create snake food
5. detect collision with food
6. create a scoreboard
7. detect collision with wall
8. detect collision with tail
"""
from turtle import Screen
from snake import Snake
from ... | 4.09375 | 4 |
catkin_ws/src/apriltags/src/apriltags_postprocessing_node.py | stevenyslins/Software | 7 | 41209 | <reponame>stevenyslins/Software
#!/usr/bin/env python
import rospkg
import rospy
import yaml
from duckietown_msgs.msg import AprilTags, TagDetection, TagInfo, Vector2D
import numpy as np
import kinematic as k
class AprilPostPros(object):
""" """
def __init__(self):
""" """
self.node_name = ... | 2.5625 | 3 |
14_funcoes/a124_todos_parametros.py | smartao/estudos_python | 0 | 41210 | <reponame>smartao/estudos_python
#!/usr/bin/python3
'''
Pegando todos os parametros
Um argumento pocisional sempre deve estar antes de parametros nomeados
def todos_params(*args, **kwargs):
Significa que quer pegar os argumentos de uma forma genérica
tanto pocisionais quanto os nomeados
'''
def todos_params... | 4.25 | 4 |
helm/dagster/schema/schema/charts/dagster/subschema/scheduler.py | asamoal/dagster | 0 | 41211 | from enum import Enum
from typing import Optional
from pydantic import BaseModel, Extra
from ...utils.utils import BaseModel, ConfigurableClass, create_json_schema_conditionals
class SchedulerType(str, Enum):
DAEMON = "DagsterDaemonScheduler"
CUSTOM = "CustomScheduler"
class SchedulerConfig(BaseModel):
... | 2.46875 | 2 |
lab/lab2/Algorithm_1.py | c235gsy/Sustech_Data-Structure-and-Algorithm-Analysis | 1 | 41212 | import numpy as np
import time
def max_subsequence_sum(sequence):
max_sum = 0
for i in range(0, len(sequence)):
for j in range(i, len(sequence)):
this_sum = 0
for k in range(i, j+1):
this_sum += sequence[k]
if this_sum > max_sum:
... | 3.375 | 3 |
utils.py | thefxperson/ISEF-JOCR | 0 | 41213 | <reponame>thefxperson/ISEF-JOCR
#code from snowkylin's github, see readme for citation
#modified to support an output of 30 instead of 25 with five-hot
#excess code that I'm not using (such as ntm) has been removed
import numpy as np
import os
from PIL import Image
from PIL import ImageOps
# from skimage import io
# f... | 1.796875 | 2 |
experiments/compile_scripts.py | uiuc-arc/DeepJ | 2 | 41214 | <gh_stars>1-10
import os
is_fpsound = False
if is_fpsound:
sound = '-D SOUND'
else:
sound = ''
print('Compiling ConvBig_Classify')
os.system(f'g++ -std=c++17 -O2 -fopenmp convbig_classify.cpp -o convbig_classify')
print('Compiling ConvBig')
os.system(f'g++ {sound} -std=c++17 -O2 -fopenmp convbig.cpp -o convb... | 2.359375 | 2 |
ravel/utils/strings.py | eykd/ravel | 1 | 41215 | from syml.utils import get_text_source # noqa
from .. import exceptions
from ..types import Pos
def get_coords_of_str_index(s, index):
"""Get (line_number, col) of `index` in `string`.
Based on http://stackoverflow.com/a/24495900
"""
lines = s.splitlines(True)
curr_pos = 0
for linenum, line... | 3.34375 | 3 |
edge.py | BrinzaBezrukoff/graphvisual | 1 | 41216 | import pygame
from tools import render_text
from graph_object import GraphObject
class Edge (GraphObject):
def __init__(self, v1, v2, weight=0, width=1, color=(0, 0, 0)):
super().__init__()
self.v1, self.v2 = v1, v2
self.__weight, self.__weight_surface = 0, None
self.set_weight(we... | 3.109375 | 3 |
genkey/migrations/0007_auto_20190328_1149.py | MoreNiceJay/CAmanager_web | 0 | 41217 | <filename>genkey/migrations/0007_auto_20190328_1149.py
# Generated by Django 2.0.4 on 2019-03-28 02:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('genkey', '0006_auto_20190327_1004'),
]
operations = [
migrations.RenameModel(
old... | 1.46875 | 1 |
samples/sample.py | andy1xx8/py-profiler | 3 | 41218 | from py_profiler import profiler, profiling_service
@profiler('hello')
def hello():
print('hello')
class Foo:
@profiler('Food.some_thing')
def some_thing(self):
print('some_thing')
@profiler()
def method_2(self):
print('method_2')
raise Exception('aaaa')
if __name__ =... | 2.84375 | 3 |
bot/handlers/users/__init__.py | famaxth/Russian-Qiwi-Bot | 0 | 41219 | <reponame>famaxth/Russian-Qiwi-Bot<gh_stars>0
from . import start
from . import main
| 1.085938 | 1 |
data processing/create_word2vec_input.py | RayL0707/Finance_KG | 0 | 41220 | <gh_stars>0
import json
import thulac
import time
# n
# all+n (all 不包含 vm)
# a+n
# np 人名
# ns 地名
# ni 机构名
# nz 其它专名
# t和r 时间和代词该步不用加,但是在命名实体识别时需要考虑(这里做个备注)
# i 习语
# j 简称
# x 其它
# 不能含有标点w
def nowok(s): #当前词的词性筛选
if s=='n' or s=='np' or s=='ns' or s=='ni' or s=='nz':
return True
if s=='i' or s=='j' or s=='x' or ... | 2.734375 | 3 |
Simulator/GUI2.py | Sulles/YOLOL_Simulator | 5 | 41221 | <reponame>Sulles/YOLOL_Simulator
"""
Created: October 12, 2019
Author: Sulles
=== DESCRIPTION ===
This class houses the revamped GUI object and all associated objects
"""
# noinspection PyUnresolvedReferences
from Classes.map import obj_map
# noinspection PyUnresolvedReferences
from gui_lib import ListObj, TabList, D... | 2.484375 | 2 |
lib/surface/storage/rm.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2 | 41222 | # -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. 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 requir... | 2.03125 | 2 |
model/data_utils.py | aashiqmuhamed/transformer-gan | 32 | 41223 | <reponame>aashiqmuhamed/transformer-gan
# Copyright Amazon.com, Inc. or its affiliates. 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/licens... | 2.03125 | 2 |
hass_db_merge.py | pipacsba/hass_db | 0 | 41224 | import sqlite3
import sys
import datetime
import os
# day of month to switch to new database
change_day = 1
c_added_text_entities = [["sensor.hitachi_relay", "sensor.netatmo_relay"],
["sensor.cooling_target_temp", "sensor.heating_target_temp"]]
user = "pipacsba"
server_ip = "192.16... | 2.734375 | 3 |
DEF_MAIN/sys_cmd.py | dBanasiak/VoiceAssistant | 0 | 41225 | <filename>DEF_MAIN/sys_cmd.py
import os
import re
from colorama import Fore, Style
from selenium import webdriver
def SYS_CMD(command):
command = command.split(' ')
obj_name = False
proc_name = False
q_name = False
for word in command:
if re.match(r"start|run|activate|get|enter|do|trigger|e... | 2.765625 | 3 |
check_netapp.py | champain/check_netapp | 1 | 41226 | <filename>check_netapp.py
import os
from NetApp.NaServer import *
from optparse import OptionParser
# Main function to handle our other functions
def main():
if check == "vserver":
vserver_check(vserver_name)
elif check == "api":
api_check()
elif check == "cluster":
cluster_check()... | 2.546875 | 3 |
MQTT Connector.indigoPlugin/Contents/Server Plugin/mqtt_broker.py | FlyingDiver/Indigo-MQTT | 1 | 41227 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
####################
import time
import logging
import indigo
from os.path import exists
import paho.mqtt.client as mqtt
################################################################################
class MQTTBroker(object):
def __init__(self, device):
s... | 2.25 | 2 |
tests/cli/test_cli.py | Rdvp1514/test_junkie | 72 | 41228 | <reponame>Rdvp1514/test_junkie
import os
import pprint
from test_junkie.constants import CliConstants
from test_junkie.runner import Runner
from test_junkie.cli.cli_config import Config
from tests.QualityManager import QualityManager
from tests.cli.CliTestSuite import AuthApiSuite, ShoppingCartSuite, NewProductsSuite
... | 2.0625 | 2 |
regression/preprocess.py | maple7sha/dota2ml | 0 | 41229 | from pymongo import MongoClient
from progressbar import ProgressBar, Bar, Percentage, FormatLabel, ETA
import numpy as np
import os
def preprocess(percent_training_set):
client = MongoClient()
db = client.dotabot
matches = db.matches
NUM_HEROES = 114
NUM_FEATURES = NUM_HEROES * 2
NUM_MATCHES = matches.co... | 2.5625 | 3 |
src/deep_noise_to_image_models.py | furgerf/GAN-for-dermatologic-imaging | 0 | 41230 | #!/usr/bin/env python
# pylint: disable=too-many-locals,arguments-differ,unused-import
import tensorflow as tf
from tensorflow.keras.layers import (BatchNormalization, Dense, Dropout,
Flatten, MaxPooling2D, SpatialDropout2D,
add)
from tensorflo... | 2.125 | 2 |
webapp/dataaccess/plotlydash/__init__.py | Dataplate/dataplate | 13 | 41231 | <reponame>Dataplate/dataplate
from flask import Blueprint
from flask_login import login_required
bp_dash = Blueprint('dashboard', __name__, template_folder='../templates', url_prefix='/admin/dashboard/')
def _protect_dashviews(dashapp):
for view_func in dashapp.server.view_functions:
if view_func.startswi... | 2.140625 | 2 |
src/wrf_runner/wrf.py | tommz9/wrf_runner | 6 | 41232 | <gh_stars>1-10
import f90nml
import glob
import logging
import subprocess
import os
from .exceptions import WrfRunnerException
log = logging.getLogger('WRF')
def create_namelist_patch(initialization_time, length_hours=48):
# Get number of domains
nml = f90nml.read('template/namelist.wps')
domains = nml[... | 1.898438 | 2 |
test/test_util.py | jeffw-github/autoprotocol-python | 113 | 41233 | <reponame>jeffw-github/autoprotocol-python
import json
class TestUtils:
@staticmethod
def read_json_file(file_path: str):
file = open("./test/data/{0}".format(file_path))
data = json.load(file)
return json.dumps(data, indent=2, sort_keys=True)
| 2.78125 | 3 |
setup.py | cxwx/naima | 0 | 41234 | #!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from setuptools import setup, find_packages
setup(
use_scm_version={
"version_scheme": "post-release",
"local_scheme": "dirty-tag",
},
setup_requires=["setuptools_scm"],
packages=find_packages("src"),... | 1.0625 | 1 |
jacked/matchers/_type.py | ramonhagenaars/jacked | 4 | 41235 | <gh_stars>1-10
"""
PRIVATE MODULE: do not import (from) it directly.
This module contains the ``TypeMatcher``class.
"""
import inspect
from jacked._injectable import Injectable
from jacked._container import Container
from jacked.matchers._base_matcher import BaseMatcher
class TypeMatcher(BaseMatcher):
def match... | 1.929688 | 2 |
library/cohesity_view.py | cohesity/ansible-role-cohesity | 0 | 41236 | <gh_stars>0
# !/usr/bin/python
# Copyright (c) 2019 Cohesity Inc
# Apache License Version 2.0
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.module_utils.basic import AnsibleModule
from cohesity_management_sdk.cohesity_client import CohesityClient
fro... | 1.757813 | 2 |
smi_analysis/integrate1D.py | NSLS-II-SMI/smi-analysis | 1 | 41237 | import numpy as np
from pyFAI.multi_geometry import MultiGeometry
from pyFAI.ext import splitBBox
def inpaint_saxs(imgs, ais, masks):
"""
Inpaint the 2D image collected by the pixel detector to remove artifacts in later data reduction
Parameters:
-----------
:param imgs: List of 2D image in pixel... | 2.640625 | 3 |
app/classes/api.py | MikeMart77/crafty | 37 | 41238 | import os
import secrets
import threading
import tornado.web
import tornado.escape
import logging.config
from app.classes.models import Roles, Users, check_role_permission, Remote, model_to_dict
from app.classes.multiserv import multi
from app.classes.helpers import helper
from app.classes.backupmgr import backupmgr
... | 2.015625 | 2 |
exercises/adaboost_scenario.py | OmriBenbenisty/IML.HUJI | 0 | 41239 | import numpy as np
from typing import Tuple
import plotly.io
from IMLearn.metalearners.adaboost import AdaBoost
from IMLearn.learners.classifiers import DecisionStump
from IMLearn.metrics import accuracy
from utils import *
import plotly.graph_objects as go
from plotly.subplots import make_subplots
plotly.io.rendere... | 3.640625 | 4 |
testing_suite/test_splitMD.py | rhpvorderman/TALON | 0 | 41240 | <reponame>rhpvorderman/TALON
import pytest
from talon import transcript_utils as tu
@pytest.mark.unit
class TestSplitMD(object):
def test_splitMD(self):
""" Easy case- full match"""
MD = "MD:Z:100"
ops, cts = tu.splitMD(MD)
assert ops == ["M"]
assert cts == [100]
d... | 2.5 | 2 |
tests.py | arjnklc/Optimal-Coverage-in-WSN | 3 | 41241 | <gh_stars>1-10
from matplotlib import pyplot as plt
import random
from solver import Solver
import json
import time
def visualize(point_locations, sensor_locations, sensor_radius):
plt.grid()
for i in sensor_locations:
circle1 = plt.Circle((i[0], i[1]), sensor_radius, color='y')
plt.gcf().gca(... | 2.640625 | 3 |
plugins/core/merge_detections_nms_fusion.py | Kitware/VAIME | 45 | 41242 | <filename>plugins/core/merge_detections_nms_fusion.py
# ckwg +29
# Copyright 2022 by Kitware, Inc.
# 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... | 1.03125 | 1 |
pyroc/compare.py | noudald/pyroc | 1 | 41243 | <filename>pyroc/compare.py
"""Tools for comparing ROC curves with AUC."""
from math import erf
from typing import Optional, Tuple
import numpy as np
from pyroc import bootstrap_roc, ROC
def gaussian_cdf(x: float) -> float:
"""Gaussian cummulative distribution function for N(0, 1).
Parameters
---------... | 2.84375 | 3 |
code/get_ordinals.py | lebronlambert/Information_Extraction_DeepRL | 251 | 41244 | <gh_stars>100-1000
import pickle
import inflect
p = inflect.engine()
words = set(['first','second','third','fourth','fifth','sixth','seventh','eighth','ninth','tenth','eleventh','twelfth','thirteenth','fourteenth','fifteenth',
'sixteenth','seventeenth','eighteenth','nineteenth','twentieth','twenty-first','twenty-secon... | 2.296875 | 2 |
sample-models/criticalperiod.py | vishalbelsare/helipad | 16 | 41245 | <gh_stars>10-100
#A reconstruction of Hurford (1991), "The Evolution of the Critical Period for Language Acquisition"
#https://www.sciencedirect.com/science/article/abs/pii/001002779190024X
from helipad import Helipad, Agent
import random
from numpy.random import choice
from numpy import mean
heli = Helipad()
heli.na... | 2.828125 | 3 |
dags/dag_test_v1.py | DataDavD/ddflow_practice | 1 | 41246 | # import packages
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.python_operator import PythonOperator
from datetime import datetime, timedelta
from external_func import random_date
def start_print():
print('\nDAG starting...\n')
def end_print():
prin... | 2.484375 | 2 |
PDFSegmenter/util/StorageUtil.py | MBAigner/PDFSegmenter | 11 | 41247 | <gh_stars>10-100
import pickle
def save_object(obj, path, name):
"""
:param obj:
:param path:
:param name:
:return:
"""
with open(path + name + '.pkl', 'wb') as f:
pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)
def load_object(path, name):
"""
:param path:
:param name... | 2.875 | 3 |
softmax.py | maomran/softmax | 14 | 41248 |
import math
z = [1.0,1 ,1, 1.0]
z_exp = [math.exp(i) for i in z]
print([round(i, 2) for i in z_exp])
sum_z_exp = sum(z_exp)
print(round(sum_z_exp, 2))
softmax = [round(i / sum_z_exp, 3) for i in z_exp]
print(softmax)
| 2.953125 | 3 |
kaze_project/preprocessing.py | Albert-Aiqi-Zhang/Typhoon-Web-Application | 0 | 41249 | <filename>kaze_project/preprocessing.py
import numpy as np
import pandas as pd
from datetime import datetime
from pandas.io import sql
import pymysql
import csv
import os
import sys
import pymysql
df1 = pd.read_csv("../database_engineering/data_of_typhoon/table2001.csv", encoding="SHIFT-JIS")
f = lambda x: datetime(x[... | 2.734375 | 3 |
src/eazyserver/rpc/__init__.py | MacherLabs/eazyserver | 4 | 41250 | import logging
logger = logging.getLogger(__name__)
logger.debug("Loaded " + __name__)
from jsonrpcserver import methods
from .exceptions import *
from .influxdb_api import *
from .meta import *
| 1.5 | 2 |
tests/examples/code_description/demo.py | misode/beet | 0 | 41251 | <filename>tests/examples/code_description/demo.py<gh_stars>0
from beet import Context
def beet_default(ctx: Context):
ctx.project_name = "something_else"
ctx.project_description = {"text": "bold description", "bold": True}
ctx.project_author = "Fizzy"
ctx.project_version = "1.2.3"
ctx.data.descri... | 2.015625 | 2 |
src/features/junjie_features.py | davidjurgens/prosocial-conversation-forecasting | 3 | 41252 | import os
import pandas as pd
import datetime
from genderperformr import GenderPerformr
from agreementr import Agreementr
from politenessr import Politenessr
from supportr import Supportr
import enchant
import requests
import json
from googleapiclient import discovery
from enchant.checker import SpellChecker
from encha... | 2.5 | 2 |
typings/bpy_extras/wm_utils/progress_report.py | Argmaster/PyR3 | 2 | 41253 | import sys
import typing
class ProgressReport:
curr_step = None
''' '''
running = None
''' '''
start_time = None
''' '''
steps = None
''' '''
wm = None
''' '''
def enter_substeps(self, nbr, msg):
'''
'''
pass
def finalize(self):
'... | 2.4375 | 2 |
HyPAT/source_code/permeation_estimates.py | IdahoLabResearch/HyPAT | 1 | 41254 | <gh_stars>1-10
""" Main page to accept input from the user. This is the Permeation Estimates tab in the
Hydrogen Permeation Analysis Tool """
import tkinter as tk
from tkinter import ttk, font
from .data_storage import Widgets
# Imports for the ORingsAndDefaultVals class
import numpy as np
import os
import platform... | 3.109375 | 3 |
End/end.py | naveeng2402/Quiz_App | 1 | 41255 | from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.uic import loadUi
import sys
class End(QtWidgets.QDialog):
def __init__(self, winners):
super(QtWidgets.QDialog, self).__init__()
loadUi("End/end.ui", self)
msg = f"""
<p style="text-align: center; font-size: 30px;"><em>... | 2.796875 | 3 |
Packages/com.popo.bdframework/3rdPlugins/AssetGraph-1.8-release-BD/DocTools~/fixdoc.py | AzureZheng/BDFramework.Core | 1 | 41256 | import os
srcfile = 'DocTools~/assetgraph_from_gdoc.md'
pnglist = 'DocTools~/order.txt'
dstfile = 'Documentation~/assetgraph.md'
num = 1
if os.path.exists(dstfile):
os.remove(dstfile)
with open(srcfile) as f:
doc = f.read()
f.close()
with open(pnglist) as fpng:
while True:
pnglist = fpng.readline()
if n... | 2.5 | 2 |
plenum/test/pool_transactions/test_change_ha_persists_post_nodes_restart.py | andkononykhin/plenum | 148 | 41257 | <reponame>andkononykhin/plenum
from plenum.common.util import hexToFriendly, randomString
from stp_core.common.log import getlogger
from plenum.test.node_catchup.helper import waitNodeDataEquality
from plenum.test.node_request.helper import sdk_ensure_pool_functional
from plenum.test.pool_transactions.helper import sdk... | 1.742188 | 2 |
tests/functional/conftest.py | hypothesis/viahtml | 0 | 41258 | import os
# isort: off
# This import has to come before the CheckmateClient import or the functional
# tests break.
# See https://github.com/gevent/gevent/issues/1016
import pywb.apps.frontendapp # pylint:disable=unused-import
# isort: on
import httpretty as httpretty_
import pytest
import webtest
from tests.conft... | 1.890625 | 2 |
tests/test_findmacula.py | davtoh/RRTools | 1 | 41259 | <filename>tests/test_findmacula.py
from __future__ import absolute_import
import cv2
import numpy as np
from . import tesisfunctions as tf
def blobDetector():
# Setup SimpleBlobDetector parameters.
params = cv2.SimpleBlobDetector_Params()
# Change thresholds
params.minThreshold = 0
params.thresho... | 2.4375 | 2 |
src/Dialog/HelpDialog.py | jtrfid/tkzgeom | 0 | 41260 | <filename>src/Dialog/HelpDialog.py
from PyQt5 import QtCore, QtWidgets, QtGui, uic
class HelpDialog(QtWidgets.QDialog):
def __init__(self):
super(HelpDialog, self).__init__()
self.ui = uic.loadUi('layouts/help.ui', self)
self.setWindowTitle("Help")
| 2.375 | 2 |
setup.py | tgsmith61591/smite | 113 | 41261 | # -*- coding: utf-8 -*-
#
# Author: <NAME> <<EMAIL>>
#
# Setup the SMRT module
from __future__ import print_function, absolute_import, division
from distutils.command.clean import clean
# from setuptools import setup # DO NOT use setuptools!!!!!!
import shutil
import os
import sys
if sys.version_info[0] < 3:
imp... | 1.914063 | 2 |
source/Modules/ImageMeta.py | Jacktavitt/navigate_building | 0 | 41262 | import numpy
import re
with open('/home/johnny/Documents/navigate_building/source/assets/images_with_plaques.txt') as f:
LIST_OF_POSITIVES = f.read().split('\n')
class ImageDetectionMetadata():
headers = ['label', 'parsed_text', 'found_contour_area', 'ref_contour_area', 'source_image_location', 'image', 'ima... | 2.78125 | 3 |
processes/tests/test_integration.py | kinoreel/kino-gather | 0 | 41263 | <reponame>kinoreel/kino-gather
import unittest
from processes.get_omdb import Main as get_omdb
from processes.get_tmdb import Main as get_tmdb
from processes.get_itunes import Main as get_itunes
from processes.get_amazon import Main as get_amazon
from processes.get_trailer import Main as get_trailer
from processes.get... | 2.296875 | 2 |
sefara/commands/dump.py | timodonnell/pathase | 0 | 41264 | <reponame>timodonnell/pathase
# Copyright (c) 2015. Mount Sinai School of Medicine
#
# 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
#
# Unles... | 2.453125 | 2 |
package/niflow/ants/brainextraction/__init__.py | rciric/poldracklab-antsbrainextraction | 0 | 41265 | <filename>package/niflow/ants/brainextraction/__init__.py<gh_stars>0
from .__about__ import __version__
from .workflows.brainextraction import init_brain_extraction_wf
| 1.109375 | 1 |
tests/notifications/test_lure_alerts.py | plastr/extrasolar-game | 0 | 41266 | <gh_stars>0
# Copyright (c) 2010-2011 Lazy 8 Studios, LLC.
# All rights reserved.
import re
from front import Constants
from front.lib import gametime, db
from front.backend import notifications
from front.tests import base
from front.tests.base import points, rects, SIX_HOURS
class TestLureAlerts(base.TestCase):
... | 2.125 | 2 |
2018/1A/robot_cashier.py | AmauryLiet/CodeJam | 0 | 41267 | N = int(input())
MAX, VAR, FIX = range(3)
# latest=9 r=3 b=4
# max_variable_fixed_values = [
# 3 4 5
# 2 3 3
# 2 1 5
# 2 4 2
# 2 2 4
# 2 5 1
# ]
def try_to_beat(latest_score, r, b, max_var_fixed):
our_score = 0
while b > 0:
if not r:
return -1
best_c_max_b, best_max_b = ... | 3.0625 | 3 |
applications/CableNetApplication/python_scripts/edge_cable_element_process.py | lkusch/Kratos | 778 | 41268 | <reponame>lkusch/Kratos<gh_stars>100-1000
import KratosMultiphysics as KratosMultiphysics
import KratosMultiphysics.CableNetApplication as CableNetApplication
from KratosMultiphysics import Logger
def Factory(settings, Model):
if(type(settings) != KratosMultiphysics.Parameters):
raise Exception("expected ... | 2.3125 | 2 |
conductor_helpers/simple_task.py | metamorph-inc/conductor-mdao | 0 | 41269 | <filename>conductor_helpers/simple_task.py
from task import Task
class SimpleTask(Task):
def __init__(self, name=None, description=None):
super(SimpleTask, self).__init__()
if name:
self.name = name
else:
self.name = self.__class__.__name_
if description:
... | 2.390625 | 2 |
order_book/utils.py | kostya93/order-book | 0 | 41270 | <gh_stars>0
from operator import attrgetter
from typing import List, Iterable, Optional
from .models import MaxCostRecord, MaxCostInterval
def get_max_cost_intervals(
max_cost_records: List[MaxCostRecord]) -> Iterable[MaxCostInterval]:
if len(max_cost_records) <= 1:
return
start_record = ma... | 2.515625 | 3 |
tf_verify/spatial/t_2_norm_transformer.py | Neelanjana314/eran | 254 | 41271 | <reponame>Neelanjana314/eran<filename>tf_verify/spatial/t_2_norm_transformer.py
"""
Copyright 2020 ETH Zurich, Secure, Reliable, and Intelligent Systems Lab
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 ... | 1.78125 | 2 |
userbot/modules/sql_helper/keep_read_sql.py | FS-Project/FeRuBoT | 3 | 41272 | # INFO : ini merupakan copy source code dari repo one4ubot, dan sudah mendapatkan izin dari pemilik.
# INFO : This is a copy of the source code from the One4ubot repo, and has the permission of the owner.
try:
from userbot.modules.sql_helper import SESSION, BASE
except ImportError:
raise AttributeError
from sq... | 2.125 | 2 |
devito/data/meta.py | jrt54/devito | 1 | 41273 | <reponame>jrt54/devito
from devito.tools import Tag
__all__ = ['DOMAIN', 'CORE', 'OWNED', 'HALO', 'NOPAD', 'FULL',
'LEFT', 'RIGHT', 'CENTER']
class DataRegion(Tag):
pass
CORE = DataRegion('core') # within DOMAIN
OWNED = DataRegion('owned') # within DOMAIN
DOMAIN = DataRegion('domain') # == CORE +... | 2.703125 | 3 |
landlab/components/species_evolution/zone_controller.py | amanaster2/landlab | 257 | 41274 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""ZoneController of SpeciesEvolver."""
import numpy as np
from scipy.ndimage.measurements import label
from .record import Record
from .zone import Zone, _update_zones
from .zone_taxon import ZoneTaxon
class ZoneController(object):
"""Controls zones and populates th... | 3.40625 | 3 |
torchbenchmark/models/fastNLP/fastNLP/core/batch.py | Chillee/benchmark | 2,693 | 41275 | <gh_stars>1000+
r"""
batch 模块实现了 fastNLP 所需的 :class:`~fastNLP.core.batch.DataSetIter` 类。
"""
__all__ = [
"BatchIter",
"DataSetIter",
"TorchLoaderIter",
]
import atexit
import abc
from numbers import Number
import numpy as np
import torch
import torch.utils.data
from collections import defaultdict
from .... | 2.40625 | 2 |
cb_scripts/case.py | christopher-burke/python-scripts | 1 | 41276 | #!/usr/bin/env python3
"""Switch variable case.
A function that takes camel cased strings (i.e. ThisIsCamelCased),
and converts them to snake case (i.e. this_is_camel_cased).
"""
import re
def snake_case(input_str: str, camel_case=False) -> str:
"""
Turn camel case into snake case.
:param input_str: ... | 4.5625 | 5 |
hungarian_tf_tests.py | shaolinkhoa/rec-attend-public | 118 | 41277 | import numpy as np
import tensorflow as tf
import unittest
hungarian_module = tf.load_op_library("hungarian.so")
class HungarianTests(unittest.TestCase):
def test_min_weighted_bp_cover_1(self):
W = np.array([[3, 2, 2], [1, 2, 0], [2, 2, 1]])
M, c_0, c_1 = hungarian_module.hungarian(W)
with tf.Session()... | 2.515625 | 3 |
bcs-ui/backend/templatesets/legacy_apps/configuration/k8s/constants.py | laodiu/bk-bcs | 599 | 41278 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file ... | 1.414063 | 1 |
src/plot_functions.py | limash/ws_notebook | 0 | 41279 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import xarray as xr
sns.set()
def plot_range(xlabel, ylabel, title, x, values):
"""x and values should have the same size"""
plt.plot(x, values, 'r-', linewidth=2)
plt.gcf().set_size_inches(8, 2)
plt.title(title)
plt.xlabel(... | 3.078125 | 3 |
zenml/preprocessing/text.py | bobbywlindsey/data-science | 1 | 41280 | import pandas as pd
import numpy as np
import math
from nltk.stem.snowball import SnowballStemmer
def add_prefix(prefix, series):
"""
Returns a pandas series that adds a prefix to a string
:param prefix: str
:return: pd.Series
"""
if type(prefix) != str:
raise TypeError(prefix + ' is n... | 3.734375 | 4 |
impor.py | raotnameh/FAKE_NEWS_LIAR-PLUS-dataset | 2 | 41281 | <gh_stars>1-10
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import folium
import json
import re
import glob
import os
import string
import random
import requests
import scipy
from matplotlib.colors import *
import seaborn as sn
from dateutil.parser import parse
import da... | 1.804688 | 2 |
src/features/videos/speech/extract_speech.py | ClaasM/VideoArticleRetrieval | 0 | 41282 | import os
from pocketsphinx import AudioFile
from pocketsphinx import Pocketsphinx
from src import util
test_video = os.environ['DATA_PATH'] + "/other/sphinx_test_video/beachball.mp4"
test_audio = os.environ['DATA_PATH'] + "/other/sphinx_test_audio/interview.wav"
fps = 100 # default
audio_file = AudioFile(audio_fil... | 2.734375 | 3 |
var/spack/repos/builtin/packages/mosquitto/package.py | jeanbez/spack | 0 | 41283 | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Mosquitto(CMakePackage):
"""Mosquitto is an open source implementation of a server... | 1.289063 | 1 |
tomato_test_detection.py | huuquan1994/mmdetection_plant | 0 | 41284 | from mmdet.apis import init_detector, inference_detector, show_result
import mmcv
import os
import argparse
import numpy as np
from tqdm import tqdm
parser = argparse.ArgumentParser(description='Test different models')
parser.add_argument('--epoch', type=str, default="latest", help='dataset version')
parser... | 2.234375 | 2 |
server/lib/python/cartodb_services/cartodb_services/refactor/backend/user_config.py | digideskio/dataservices-api | 22 | 41285 | from cartodb_services.refactor.storage.redis_connection_config import RedisMetadataConnectionConfigBuilder
from cartodb_services.refactor.storage.redis_connection import RedisConnectionBuilder
from cartodb_services.refactor.storage.redis_config import RedisUserConfigStorageBuilder
class UserConfigBackendFactory(object... | 2.359375 | 2 |
wotd/admin/utils.py | BrichfoE/daily_word | 0 | 41286 | import os
import random
from flask import current_app
def save_file(form_file, folder_name):
random_hex = random.token_hex(8)
_, f_ext = os.path.splitext(form_file.filename)
file_fn = random_hex + f_ext
file_path = os.path.join(current_app.root_path, 'static', folder_name, file_fn)
form_file.save(... | 2.578125 | 3 |
env.py | kajackdfw/python_rpi_sense_hat_demos | 0 | 41287 | <reponame>kajackdfw/python_rpi_sense_hat_demos<gh_stars>0
from sense_hat import SenseHat
sense = SenseHat()
while True:
t = sense.get_temperature()
p = sense.get_pressure()
h = sense.get_humidity()
t = round(t, 1)
p = round(p, 1)
h = round(h, 1)
msg = "Temperature = %s, Pressure=%s, Humid... | 2.703125 | 3 |
emgapi/urls.py | EBI-Metagenomics/ebi-metagenomics-api | 0 | 41288 | # -*- coding: utf-8 -*-
# Copyright 2020 EMBL - European Bioinformatics Institute
#
# 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 requ... | 1.625 | 2 |
pkpdapp/pkpdapp/migrations/0001_initial.py | pkpdapp-team/pkpdapp | 4 | 41289 | <reponame>pkpdapp-team/pkpdapp<gh_stars>1-10
#
# This file is part of PKPDApp (https://github.com/pkpdapp-team/pkpdapp) which
# is released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
# Generated by Django 3.0.7 on 2021-01-12 17:55
# flake8: noqa
from... | 1.84375 | 2 |
rpsp/policy/policies.py | ahefnycmu/rpsp | 4 | 41290 | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 28 10:47:38 2016
@author: ahefny
Policies are BLIND to the representation of states, which could be (1) observation,
(2) original latent state or (3) predictive state.
Policies takes the "state" dimension x_dim, the number of actions/dim of action as input.
"""
impo... | 3.265625 | 3 |
devtools/write.py | ddrone/language | 2 | 41291 | import os
import sys
from datetime import datetime
from subprocess import run
name = datetime.utcnow().strftime("%Y%m%d-%H%M%S.md")
try:
# -t stands for "topic"
topic_index = sys.argv.index('-t')
path = os.path.join(sys.argv[topic_index + 1], name)
except:
path = name
run(['code', path])
| 2.15625 | 2 |
riglib/bmi/lindecoder.py | aolabNeuro/brain-python-interface | 2 | 41292 | <gh_stars>1-10
'''
Classes for BMI decoding using linear scaling.
'''
import numpy as np
from riglib.bmi.bmi import Filter
class State(object):
'''For compatibility with other BMI decoding implementations'''
def __init__(self, mean, *args, **kwargs):
self.mean = mean
class LinearScaleFilter(Filter):... | 3.140625 | 3 |
tests/hopfieldnettests/net/network_creation.py | pmatigakis/hopfieldnet | 28 | 41293 | <reponame>pmatigakis/hopfieldnet
import unittest
import numpy as np
from hopfieldnet.net import HopfieldNetwork, InvalidWeightsException
class HopfieldNetworkCreationTests(unittest.TestCase):
def setUp(self):
self.net = HopfieldNetwork(10)
def test_change_network_weights(self):
new_weights... | 3.21875 | 3 |
opac/queries/book/search.py | rimphyd/Django-OPAC | 1 | 41294 | <reponame>rimphyd/Django-OPAC
from functools import reduce
from operator import or_
from django.db.models import Q
from opac.models.masters import Book
class BookSearchQuery:
def __init__(self, words):
self._words = words
def exec(self):
querysets = (
Book.objects
... | 2.359375 | 2 |
modules/superfetch_connector.py | dfrc-korea/carpe | 56 | 41295 | # -*- coding: utf-8 -*-
"""module for Superfetch."""
import os, sys
import time
from datetime import datetime, timedelta
from modules import logger
from modules import manager
from modules import interface
from modules.windows_superfetch import sfexport2
from dfvfs.lib import definitions as dfvfs_definitions
class S... | 2.28125 | 2 |
river_admin/views/function_view.py | pantyukhov/river-admin | 75 | 41296 | from rest_framework.generics import get_object_or_404
from rest_framework.response import Response
from rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_200_OK
from river.models import Function
from river_admin.views import get, post, put, delete
from river_admin.views.serializers import UpdateFunctionDto, Crea... | 2.203125 | 2 |
datasets/ETH_local_feature.py | The-Learning-And-Vision-Atelier-LAVA/PoSFeat | 1 | 41297 | import torch
import numpy as np
from torch.utils.data import Dataset
import torchvision.transforms as transforms
import skimage.io as io
from path import Path
import cv2
import torch.nn.functional as F
class ETH_LFB(Dataset):
def __init__(self, configs):
"""
dataset for eth local feature benchmark
... | 2.5 | 2 |
thirteen_tangram/image_utils.py | Wuziyi616/Artificial_Intelligence_Project1 | 7 | 41298 | """This file contains functions for processing image"""
import cv2
import math
import copy
import numpy as np
import matplotlib.pyplot as plt
def binarize_image(image):
"""Binarize image pixel values to 0 and 255."""
unique_values = np.unique(image)
if len(unique_values) == 2:
if (un... | 4.09375 | 4 |
modules/dbnd-airflow/test_dbnd_airflow/test_logging.py | ipattarapong/dbnd | 224 | 41299 | import logging
from logging.config import dictConfig
import dbnd
from dbnd.testing.helpers import run_dbnd_subprocess__with_home
from dbnd_airflow_contrib.dbnd_airflow_default_logger import DEFAULT_LOGGING_CONFIG
class TestDbndAirflowLogging(object):
def test_dbnd_airflow_logging_conifg(self):
# we imp... | 2.140625 | 2 |