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 |
|---|---|---|---|---|---|---|
Module_03/mlb.py | JoseGtz/2021_python_selenium | 0 | 32400 | <reponame>JoseGtz/2021_python_selenium<filename>Module_03/mlb.py
from common.webdriver_factory import get_driver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver = get_driver('chrome')
wait = We... | 2.5 | 2 |
azext_csvmware/_help.py | ctaggart/az-csvmware-cli | 2 | 32401 | # coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------... | 2.453125 | 2 |
pajbot/managers/songrequest.py | sgaweda/troybot | 0 | 32402 | import logging
import threading
import time
from pajbot.managers.db import DBManager
from pajbot.managers.schedule import ScheduleManager
from pajbot.models.songrequest import SongrequestQueue, SongrequestHistory, SongRequestSongInfo
from pajbot.models.user import User
log = logging.getLogger("pajbot")
WIDGET_ID = ... | 2.46875 | 2 |
irl/common/utils/mean_or_nan.py | uidilr/deepirl_chainer | 16 | 32403 | import numpy as np
def mean_or_nan(xs):
"""Return its mean a non-empty sequence, numpy.nan for a empty one."""
return np.mean(xs) if xs else np.nan | 3.59375 | 4 |
test/test_tae/test_serial_runner.py | dengdifan/SMAC3 | 1 | 32404 | import time
import unittest
import unittest.mock
from smac.configspace import ConfigurationSpace
from smac.runhistory.runhistory import RunInfo, RunValue
from smac.scenario.scenario import Scenario
from smac.stats.stats import Stats
from smac.tae import StatusType
from smac.tae.execute_func import ExecuteTAFuncDict
fr... | 2.296875 | 2 |
backend/admingym/gyms/migrations/0003_auto_20200909_0508.py | ManuelRivera98/AdminGym | 1 | 32405 | <reponame>ManuelRivera98/AdminGym<gh_stars>1-10
# Generated by Django 3.0 on 2020-09-09 05:08
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gyms', '0002_auto_20200903_1750'),
]
operations = [
migrations.A... | 2.0625 | 2 |
tests/test_cli.py | mbbroberg/SEODeploy | 48 | 32406 | <reponame>mbbroberg/SEODeploy<filename>tests/test_cli.py
#! /usr/bin/env python
# coding: utf-8
#
# Copyright (c) 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 restric... | 2 | 2 |
org_opencv.bzl | chris-blay/bazel | 1 | 32407 | def sample(name, custom_package):
native.android_binary(
name = name,
deps = [":sdk"],
srcs = native.glob(["samples/" + name + "/src/**/*.java"]),
custom_package = custom_package,
manifest = "samples/" + name + "/AndroidManifest.xml",
resource_files = native.glob(["sa... | 1.726563 | 2 |
deeplodocus/callbacks/overwatch.py | samuelwestlake/deeplodocus-dev | 0 | 32408 | <reponame>samuelwestlake/deeplodocus-dev
from deeplodocus.utils.generic_utils import get_corresponding_flag
from deeplodocus.utils.notification import Notification
from deeplodocus.flags import *
from typing import Union
class OverWatch(object):
"""
AUTHORS:
--------
:author: <NAME>
DESCRIPTION... | 2.3125 | 2 |
_utils/merge.py | louiscklaw/kicad-automation-scripts | 0 | 32409 | <gh_stars>0
#!/usr/bin/env python
# reference build https://travis-ci.org/louiscklaw/test_git_repo/builds/625335510
# https://docs.travis-ci.com/user/environment-variables/
import os, re, subprocess
import slack
from fabric.api import local, shell_env, lcd, run, settings
SLACK_TOKEN = os.environ['SLACK_TOKEN']
BRA... | 2 | 2 |
config.py | StuartSul/SampyoNet | 0 | 32410 | ## Built-in packages
import getopt
import json
import os
import sys
## Third-party packages
from PIL import Image
import joblib
import numpy as np
import tqdm
## Tensorflow
from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import Dropout
from... | 1.570313 | 2 |
src/unpackaged/abm/AnimationBehaviour/model8.py | agdturner/geog5990m | 0 | 32411 | <reponame>agdturner/geog5990m<filename>src/unpackaged/abm/AnimationBehaviour/model8.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__version__ 1.0.0
"""
import csv
import agentframework7 as af
import random
import matplotlib.pyplot as pyplot
from sys import argv
import matplotlib.animation as anim
import os
from... | 2.734375 | 3 |
password_policies/tests/__init__.py | manuerux/django-password-policies-iplweb | 5 | 32412 | <filename>password_policies/tests/__init__.py
from ..receivers import *
| 1.039063 | 1 |
manubot/cite/tests/test_citekey.py | olgabot/manubot | 1 | 32413 | """Tests rest of functions in manubot.cite, not covered by test_citekey_api.py."""
import pytest
from manubot.cite.citekey import (
citekey_pattern,
shorten_citekey,
infer_citekey_prefix,
inspect_citekey,
)
@pytest.mark.parametrize("citation_string", [
('@doi:10.5061/dryad.q447c/1'),
('@arxi... | 2.53125 | 3 |
test/main_page_tests.py | savvagen/playwright-pytest-example | 19 | 32414 | import pytest
from playwright.sync_api import Page
from pages.main_page.main_page import MainPage
from test.test_base import *
import logging
import re
logger = logging.getLogger("test")
@pytest.mark.only_browser("chromium")
def test_find_element_list(page: Page):
main_page = MainPage(base_url, page)
main_pa... | 2.4375 | 2 |
tfumap/parametric_tsne.py | EhsanKA/ParametricUMAP_paper | 124 | 32415 | ### based on https://github.com/kylemcdonald/Parametric-t-SNE/blob/master/Parametric%20t-SNE%20(Keras).ipynb
import numpy as np
from tensorflow.keras import backend as K
from tensorflow.keras.losses import categorical_crossentropy
from tqdm.autonotebook import tqdm
import tensorflow as tf
def Hbeta(D, beta):
""... | 2.421875 | 2 |
test/unit/git_class/gitmerge_commits_diff.py | deepcoder42/git-lib | 0 | 32416 | <reponame>deepcoder42/git-lib
#!/usr/bin/python
# Classification (U)
"""Program: gitmerge_commits_diff.py
Description: Unit testing of gitmerge.commits_diff in git_class.py.
Usage:
test/unit/git_class/gitmerge_commits_diff.py
Arguments:
"""
# Libraries and Global Variables
# Standard
import... | 2.8125 | 3 |
Chapter04/code/func_perf3.py | PacktPublishing/IPython-7-Cookbook | 2 | 32417 | import random
import string
def test_append(lst):
ret_val = []
for w in lst:
ret_val.append(w.lower( ))
return ret_val
def test_map(lst):
ret_val = map(str.lower, lst)
return ret_val
def run_tests(n):
for i in range(n):
tst = ''.join(random.choices(string.ascii_uppercase + str... | 3.203125 | 3 |
mhmd-driver/parse_mtrees.py | cnasikas/smpc-analytics | 12 | 32418 | <filename>mhmd-driver/parse_mtrees.py
import os
import sys
import json
import argparse
from huepy import *
parser = argparse.ArgumentParser()
parser.add_argument('file', help= 'File with mtrees data (CSV or JSON)')
parser.add_argument('--mtrees', help = 'File with the mesh dictionary to be created (names to ids).', de... | 2.859375 | 3 |
gen_art/graphics/Context.py | shnupta/SeeMyFeels | 3 | 32419 | <reponame>shnupta/SeeMyFeels
import cairo
from uuid import uuid4
from gen_art.graphics.Helpers import does_path_exist, open_file
from os import path
from datetime import datetime
class DrawContext:
def __init__(self, width, height, output_path, open_bool):
self.open_bool = open_bool
self.width = w... | 2.53125 | 3 |
WISH/WISH.py | quantumopticslkb/phase_retrieval | 0 | 32420 | <filename>WISH/WISH.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
@author : <NAME>
After the Matlab code from Yicheng WU
"""
import numpy as np
import matplotlib.pyplot as plt
from LightPipes import *
from PIL import Image
from time import time
from mpl_toolkits.axes_grid1 import make_axes_locatable
import time
import sy... | 2.234375 | 2 |
sunpy/net/jsoc/tests/test_jsoc.py | s0nskar/sunpy | 0 | 32421 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 26 20:17:06 2014
@author: stuart
"""
import os
import tempfile
import datetime
import astropy.table
import astropy.time
import astropy.units as u
import pytest
from sunpy.time import parse_time
from sunpy.net.jsoc import JSOCClient, JSOCResponse
from sunpy.net.vso.vso im... | 1.953125 | 2 |
turtle_lib/colorful_spiral.py | PitPietro/pascal-triangle | 1 | 32422 | <filename>turtle_lib/colorful_spiral.py
import turtle
if __name__ == '__main__':
colors = ['red', 'green', 'yellow', 'purple', 'blue', 'orange']
turtle.bgcolor('black')
for i in range(360):
turtle.pencolor(colors[i % 6])
turtle.width(int(i / 100 + 1))
turtle.forward(i)
tur... | 3.9375 | 4 |
tests/test_ref_numpy.py | kuraisle/multipletau | 10 | 32423 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Compare to numpy data"""
import sys
import numpy as np
import multipletau
from test_correlate import get_sample_arrays_cplx
def test_corresponds_ac():
myframe = sys._getframe()
myname = myframe.f_code.co_name
print("running ", myname)
a = np.concatenate... | 2.609375 | 3 |
fedlearner/platform/trainer_master/leader_tm.py | melong007/fedlearner | 0 | 32424 | # Copyright 2020 The FedLearner 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 applica... | 1.90625 | 2 |
comics_webscrapper.py | WittyShiba/Comics-Webscrapping | 0 | 32425 | <gh_stars>0
# Homework 7
# Write a python program that will download the latest 10 comic images from https://www.gocomics.com/pearlsbeforeswine/
# Navigate to the latest page by clicking 'Read More'.
import requests
import bs4
import os
url = 'https://www.gocomics.com/pearlsbeforeswine/2019/08/21'
for i in range(10):... | 3.65625 | 4 |
cohesity_management_sdk/models/tenant_proxy.py | nick6655/management-sdk-python | 18 | 32426 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class TenantProxy(object):
"""Implementation of the 'TenantProxy' model.
Specifies the data for tenant proxy which has been deployed in tenant's
enviroment.
Attributes:
constituent_id (long|int): Specifies the constitue... | 2.796875 | 3 |
test/test_cores/test_video/test_lt24lcdsys.py | meetps/rhea | 1 | 32427 |
from __future__ import print_function
from argparse import Namespace
# a video display model to check timing
import pytest
from myhdl import Signal, intbv, instance, delay, StopSimulation, now
from rhea.system import Clock, Reset, Global
from rhea.cores.video.lcd import LT24Interface
from rhea.models.video import ... | 2.078125 | 2 |
src/fl_simulation/server/aggregation/__init__.py | microsoft/fl-simulation | 5 | 32428 | <filename>src/fl_simulation/server/aggregation/__init__.py<gh_stars>1-10
"""Utilities and implementation for model aggregation on the central server."""
from .aggregator import *
from .fedavg import *
from .fedprox import *
from .scaffold import *
from .aggregator_with_dropouts import *
from .multi_model_aggregator im... | 1.171875 | 1 |
neurolang/frontend/neurosynth_utils.py | gzanitti/NeuroLang | 1 | 32429 | from pathlib import Path
from typing import Optional
import numpy as np
import pandas as pd
from nilearn.datasets.utils import _fetch_files
from scipy import sparse
class StudyID(str):
pass
class TfIDf(float):
pass
NS_DATA_URL = "https://github.com/neurosynth/neurosynth-data/raw/master/"
def fetch_stud... | 3.03125 | 3 |
lib/sqlalchemy/util/typing.py | immerrr/sqlalchemy | 1 | 32430 | from typing import Any
from typing import Generic
from typing import overload
from typing import Type
from typing import TypeVar
from . import compat
if compat.py38:
from typing import Literal
from typing import Protocol
from typing import TypedDict
else:
from typing_extensions import Literal # noqa
... | 2.5 | 2 |
ep_ws/build/catkin_generated/order_packages.py | fsrlab/FSR_ROS_SIM | 0 | 32431 | <filename>ep_ws/build/catkin_generated/order_packages.py<gh_stars>0
# generated from catkin/cmake/template/order_packages.context.py.in
source_root_dir = '/home/sim2real/ep_ws/src'
whitelisted_packages = ''.split(';') if '' != '' else []
blacklisted_packages = ''.split(';') if '' != '' else []
underlay_workspaces = '/h... | 1.117188 | 1 |
request_signer/tests/test_response.py | imtapps/django-request-signer | 1 | 32432 | <reponame>imtapps/django-request-signer
import six
if six.PY3:
from unittest import mock
from io import StringIO
else:
import mock
from cStringIO import StringIO
from http.client import responses
import json
from django import test
from request_signer.client.generic import Response
class ResponseTest... | 2.28125 | 2 |
rl_groundup/temporal_difference_methods/n_step_tree_backup.py | TristanBester/rl_groundup | 1 | 32433 | # Created by <NAME>.
import sys
import numpy as np
sys.path.append('../')
from envs import GridWorld
from itertools import product
from utils import print_episode, eps_greedy_policy, test_policy
'''
n-step Tree Backup used to estimate the optimal policy for
the gridworld environment defined on page 48 of
"Reinforcemen... | 2.625 | 3 |
setup.py | deephyper/metalgpy | 0 | 32434 | <filename>setup.py
from setuptools import setup, find_packages
# What packages are required for this module to be executed?
REQUIRED = [
"dm-tree",
"numpy",
"scipy"
]
setup(name="metalgpy", packages=find_packages(), install_requires=REQUIRED)
| 1.4375 | 1 |
src/numbasub/nonumba.py | ptooley/numbasub | 3 | 32435 | #!/usr/bin/env python3
import functools
#https://stackoverflow.com/questions/3888158
def optional_arg_decorator(fn):
@functools.wraps(fn)
def wrapped_decorator(*args, **kwargs):
# is_bound_method = hasattr(args[0], fn.__name__) if args else False
# if is_bound_method:
# klass = args[... | 2.78125 | 3 |
setup.py | FoxNerdSaysMoo/HomeAssistantAPI | 0 | 32436 | from setuptools import setup
from homeassistant_api import __version__
with open("README.md", "r") as f:
read = f.read()
setup(
name="HomeAssistant API",
url="https://github.com/GrandMoff100/HomeassistantAPI",
description="Python Wrapper for Homeassistant's REST API",
version=__version__,
keyw... | 1.523438 | 2 |
analogy/collision_detection/triangle_col_detect.py | gandalf15/analogy | 1 | 32437 | <filename>analogy/collision_detection/triangle_col_detect.py
#!/usr/bin/env python3
import ctypes
import os
CURRENT_PATH = os.path.dirname(os.path.abspath(__file__))
C_MOLLERS = ctypes.CDLL(os.path.join(CURRENT_PATH, 'build/mollers_tri_tri.so'))
C_DEVILLERS = ctypes.CDLL(
os.path.join(CURRENT_PATH, 'build/deviller... | 3.453125 | 3 |
atomic_reactor/plugins/check_and_set_platforms.py | qixiang/atomic-reactor | 113 | 32438 | <filename>atomic_reactor/plugins/check_and_set_platforms.py
"""
Copyright (c) 2018 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
Query the koji build target, if any, to find the enabled architectures. Remove any e... | 2.125 | 2 |
py_work/spider/request/GetMolculeUnderTarget.py | kotori-y/kotori_work | 6 | 32439 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 14 13:33:17 2020
@Author: <NAME>, <NAME>
@Institution: CBDD Group, Xiangya School of Pharmaceutical Science, CSU, China
@Homepage: http://www.scbdd.com
@Mail: <EMAIL>; <EMAIL>
@Blog: https://blog.iamkotori.com
♥I love Princess Zelda forever♥
"""
from multiprocessing imp... | 2.03125 | 2 |
lr_schedulers/flatten_cosanneal.py | yumatsuoka/SofNDLTeches | 0 | 32440 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
# It's written by https://github.com/yumatsuoka
from __future__ import print_function
import math
from torch.optim.lr_scheduler import _LRScheduler
class FlatplusAnneal(_LRScheduler):
def __init__(self, optimizer, max_iter, step_size=0.7, eta_min=0, last_epoch=-1):... | 2.390625 | 2 |
script/lib/git.py | ymmuse/electron-libcc | 0 | 32441 | """Git helper functions.
Everything in here should be project agnostic, shouldn't rely on project's structure,
and make any assumptions about the passed arguments or calls outcomes.
"""
import subprocess
def apply(repo, patch_path, reverse=False):
args = ['git', 'apply',
'--directory', repo,
'... | 2.484375 | 2 |
model/A2J/a2j_utilities/post_processing.py | NVIDIA-AI-IOT/realtime_handpose_3d | 7 | 32442 | <reponame>NVIDIA-AI-IOT/realtime_handpose_3d<filename>model/A2J/a2j_utilities/post_processing.py
'''
Copyright (c) 2019 <NAME>
Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (t... | 1.882813 | 2 |
edge.py | s1nisteR/opencv-practice | 0 | 32443 | <reponame>s1nisteR/opencv-practice<filename>edge.py
import cv2 as cv
import numpy as np
img = cv.imread('Photos/park.jpg')
cv.imshow('Original', img)
grayscale = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
cv.imshow("Jesmin", grayscale)
#Condition for Laplacian: Cannot take negative values
#Laplacian Edge Detection
lap = cv... | 3.421875 | 3 |
examples/regression.py | laudv/bitboost | 11 | 32444 | import sys
import os
import timeit
# use local python package rather than the system install
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../python"))
from bitboost import BitBoostRegressor
import numpy as np
import sklearn.metrics
nfeatures = 5
nexamples = 10000
data = np.random.choice(np.array([0.0,... | 2.078125 | 2 |
src/pyth2/io/BinaryStream.py | gnomeberry/pyth2 | 0 | 32445 | <reponame>gnomeberry/pyth2
'''
Created on 2015/11/07
@author: _
'''
from types import NoneType
from pyth2.contracts import TypeValidator as tv
from pyth2.io.Stream import Stream, StreamDirection
class BinaryStream(Stream):
@tv.forms(object, StreamDirection)
def __init__(self, direction):
super(... | 2.265625 | 2 |
app/bin/dltk/test/dltk_deployment.py | splunk/deep-learning-toolkit | 11 | 32446 | import unittest
import os
import logging
import time
import re
import splunklib.client as client
import splunklib.results as results
from splunklib.binding import HTTPError
from . import dltk_api
from . import splunk_api
from . import dltk_environment
level_prog = re.compile(r'level=\"([^\"]*)\"')
msg_prog = re.comp... | 2.296875 | 2 |
examples/example_dc/example_dc.py | OlivierKamers/PyDC | 3 | 32447 | from pydc import DC
def main():
dc = DC("example_dc.pl", 200) #default is 0 sample (will produce nan if later on no n_samples provided)
prob1 = dc.query("drawn(1)~=1")
print(prob1)
prob2 = dc.query("drawn(1)~=1", n_samples=2000)
print(prob2)
if __name__ == "__main__":
main()
| 2.390625 | 2 |
adet/modeling/DTInst/DTE/__init__.py | shuaiqi361/AdelaiDet | 0 | 32448 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from .MaskLoader import MaskLoader
from .utils import IOUMetric, fast_ista, prepare_distance_transform_from_mask, \
prepare_overlay_DTMs_from_mask, prepare_extended_DTMs_from_mask, prepare_augmented_distance_transform_from_mask, \
prepare_di... | 1.0625 | 1 |
Lms_Arpita/DatabaseConnectivity/MongoConnection.py | hcmuleva/personal-profile | 0 | 32449 | from pymongo import MongoClient
def path():
client = MongoClient('mongodb://localhost:27017/')
db = client['UserBook']
return db
| 2.234375 | 2 |
example/exc/client.py | so1n/rap | 3 | 32450 | <reponame>so1n/rap
import asyncio
import time
from rap.client import Client
from rap.common.exceptions import FuncNotFoundError
client: Client = Client("example", [{"ip": "localhost", "port": "9000"}])
# in register, must use async def...
@client.register()
async def raise_msg_exc(a: int, b: int) -> int:
pass
... | 2.4375 | 2 |
openapi/spec/ext/spec/base.py | t2y/openapi-ext-tools | 1 | 32451 | import os
from ..utils.log import log
from ..utils.yaml import read_yaml, write_yaml
class BaseSpec:
COMPONENTS = 'components'
REF_FIELD = '$ref'
def __init__(self, path,
read_func=read_yaml, write_func=write_yaml):
self.path = path
self.path_dir = os.path.dirname(path... | 2.359375 | 2 |
code/task6_step1_train_model.py | p-koo/exponential_activations | 1 | 32452 | import os
import numpy as np
from six.moves import cPickle
from tensorflow import keras
from tensorflow import keras
import helper
from tfomics import utils, metrics, explain
#------------------------------------------------------------------------
model_names = ['residualbind']
activations = ['exponential', 'relu']... | 2.15625 | 2 |
ensemble_detectors/src/Algorithm_1_matchfilter/ortho_correction.py | satish1901/Methane-detection-from-hyperspectral-imagery | 27 | 32453 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 21 14:15:38 2019
@author: Satish
"""
# doing the ortho-correction on the processed data from matchedFilter
import os
import numpy as np
import spectral as spy
import spectral.io.envi as envi
import spectral.algorithms as algo
from spectral.algorith... | 2.46875 | 2 |
rmv_test.py | BenDoan/rmv | 1 | 32454 | <filename>rmv_test.py
import unittest
import os
import shutil
import subprocess
from math import ceil
TEST_DIR = "testdir"
MOVE_DIR = "movedir"
NUM_FILES = 100
class TestDefault(unittest.TestCase):
def setUp(self):
if os.path.exists(TEST_DIR):
shutil.rmtree(TEST_DIR)
os.makedirs(TEST_... | 2.796875 | 3 |
src/nuspacesim/data/RenoNu2TauTables/read_reno_nu2tautables.py | NuSpaceSim/nuSpaceSim | 7 | 32455 | <reponame>NuSpaceSim/nuSpaceSim<gh_stars>1-10
import math
import h5py
import numpy as np
def extract_pexit_data(filename):
infile = open(filename, "r")
data = [line.split() for line in infile]
b = [(math.pi * float(lne[0]) / 180.0) for lne in data]
le = [math.log10(float(lne[1])) for lne in data]
... | 2.203125 | 2 |
makePredictions.py | psyxusheng/csedm-Data-Challenge | 0 | 32456 | # -*- coding: utf-8 -*-
import numpy as np
import csv
import tensorflow as tf
from config import Config
from DataFeeder import DataFeeder,TestData
from model import DKT
from sklearn.metrics import f1_score,precision_score,recall_score
indices = [precision_score,recall_score,f1_score]
def make_prediction(... | 2.4375 | 2 |
bianalyzer/relevance/similarity_matrix.py | luntos/bianalyzer | 4 | 32457 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from ..helpers import construct_similarity_matrix_via_profiles
class SimilarityMatrix:
def __init__(self, keywords, matrix):
self.keywords = keywords
self.matrix = matrix
def construct_similarity_matrix(relevance_matrix, relevance_threshold=0.2):
"""
... | 3.203125 | 3 |
src/block/mcmc.py | zeou1/maggot_models | 0 | 32458 | <filename>src/block/mcmc.py
# TODO write utilities for running MCMC stuff
import networkx as nx
from graph_tool.inference import minimize_blockmodel_dl
from graph_tool import load_graph
import numpy as np
import pandas as pd
import os
from src.graph import MetaGraph
def run_minimize_blockmodel(mg, temp_loc=None, wei... | 2.109375 | 2 |
reo/migrations/0064_auto_20200616_1708.py | GUI/REopt_Lite_API | 41 | 32459 | # Generated by Django 2.2.10 on 2020-06-16 17:08
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reo', '0063_auto_20200521_1528'),
]
operations = [
migrations.AddField(
model_name='profi... | 1.71875 | 2 |
solo/losses/simclr.py | xwyzsn/solo-learn | 693 | 32460 | <filename>solo/losses/simclr.py
# Copyright 2021 solo-learn development team.
# 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 ... | 1.875 | 2 |
shop/migrations/0001_initial.py | chidibede/Django-Ecommerce-Site | 0 | 32461 | # Generated by Django 2.2 on 2019-06-08 10:32
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Adult_Products',
fields=[
('id', models.AutoF... | 1.890625 | 2 |
pin_kit/extras/pinplay/PinPoints/scripts/regions.py | sawansib/Sniper | 1 | 32462 | #!/usr/bin/env python
# BEGIN_LEGAL
# BSD License
#
# Copyright (c)2014 Intel Corporation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# Redistributions of source code must retain the above... | 1.101563 | 1 |
pydy/codegen/code.py | jcrist/pydy | 1 | 32463 | #!/usr/bin/env python
"""This module remains for backwards compatibility reasons and will be
removed in PyDy 0.4.0."""
import warnings
from .ode_function_generators import generate_ode_function as new_gen_ode_func
with warnings.catch_warnings():
warnings.simplefilter('once')
warnings.warn("This module, 'pyd... | 2.640625 | 3 |
mle_hyperopt/utils/comms.py | RobertTLange/mle-hyperopt | 3 | 32464 | <filename>mle_hyperopt/utils/comms.py<gh_stars>1-10
from datetime import datetime
import numpy as np
from rich.console import Console
from rich.table import Table
from rich import box
from rich.align import Align
from typing import List, Optional, Union
console_width = 80
def welcome_message(
space_data: List[di... | 2.390625 | 2 |
nn_ood/data/lastnames.py | dtch1997/SCOD | 10 | 32465 | <filename>nn_ood/data/lastnames.py
from __future__ import unicode_literals, print_function, division
from io import open
import glob
import os
import torch
import unicodedata
import string
import random
import numpy as np
def findFiles(path): return glob.glob(path)
all_letters = string.ascii_letters + " .,;'"
n_let... | 2.828125 | 3 |
sdk/identity/azure-identity/tests/test_imds_credential_async.py | anuchandy/azure-sdk-for-python | 0 | 32466 | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from azure.identity.aio._credentials.managed_identity import ImdsCredential
import pytest
from helpers_async import AsyncMockTransport
@pytest.mark.asyncio
async def ... | 1.945313 | 2 |
imutils/Stitcher.py | sunjxan/pyimagesearch | 0 | 32467 | <reponame>sunjxan/pyimagesearch
import cv2
import numpy as np
class Stitcher:
def stitch(self, images, ratio=.75, reprojThresh=4.0, showMatches=False):
imagesCount = len(images)
if imagesCount == 0:
return
if imagesCount == 1:
return images[0]
result = image... | 2.59375 | 3 |
tests/bugs/core_3365_test.py | reevespaul/firebird-qa | 0 | 32468 | <filename>tests/bugs/core_3365_test.py
#coding:utf-8
#
# id: bugs.core_3365
# title: Extend syntax for ALTER USER CURRENT_USER
# decription:
# Replaced old code: removed EDS from here as it is not needed at all:
# we can use here trivial "connect '$(DSN)' ..." in... | 1.625 | 2 |
sololearn/hovercraft.py | ehlodex/Python3 | 0 | 32469 | <filename>sololearn/hovercraft.py
#!/usr/bin/env/ python3
"""SoloLearn > Code Coach > Hovercraft"""
sales = int(input('How many did you sell? ')) * 3
expense = 21
if sales > expense:
print('Profit')
elif sales < expense:
print('Loss')
else:
print('Broke Even')
| 3.6875 | 4 |
RSAMessengerDapp/User/views.py | slothmanxyz/RSAMessengerDapp | 0 | 32470 | from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.contrib.auth import login, logout, authenticate
from django.contrib.auth.forms import AuthenticationForm
from web3 import Web3
from .forms import SignupForm
from Key.models import Key
#The views and templates in this app a... | 2.125 | 2 |
app/__init__.py | Paulvitalis200/Store-Manager-API | 0 | 32471 | from flask import Flask, Blueprint
from flask_jwt_extended import JWTManager
def create_app(config):
app = Flask(__name__)
from instance.config import app_config
app.config.from_object(app_config[config])
app.config['JWT_SECRET_KEY'] = 'jwt-secret-string'
from .api.V1 import productsale_api as p... | 2.234375 | 2 |
scripts/MSP_IMPROV_to_12_folds.py | cnut1648/Multimodal-Transformer | 0 | 32472 | """
preprocess MSP IMPROV csv
run after MSP_IMPROV.py
"""
import os, torch, soundfile
from pathlib import Path
import librosa
import pandas as pd
ID2LABEL = {
0: "neu", 1: "sad", 2: "ang", 3: "hap"
}
pwd = Path(__file__).parent
csv_dir = pwd / "../data/datasets/MSP-IMPROV"
out_dir = pwd / "../data/datasets/MSP-IMP... | 2.375 | 2 |
User/User.py | howiemac/evoke4 | 0 | 32473 | """ evoke base User object
IHM 2/2/2006 and thereafter
CJH 2012 and therafter
gives session-based user validation
The database users table must have an entry with uid==1 and id==guest.
This is used to indicate no valid login.
The database users table must have an entry with uid==2 . This is the
sys admin user.
R... | 3.09375 | 3 |
richcomments/templatetags/richcomments.py | praekelt/django-richcomments | 2 | 32474 | from django import template
from django.template.loader import render_to_string
register = template.Library()
@register.simple_tag
def richcomments_static():
return render_to_string('richcomments/templatetags/richcomments_static.html')
| 1.851563 | 2 |
rosys/pathplanning/obstacle_map_demo.py | zauberzeug/rosys | 1 | 32475 | <reponame>zauberzeug/rosys
#!/usr/bin/env python3
from nicegui import ui
import pylab as pl
import numpy as np
import time
from rosys.world.pose import Pose
from rosys.world.spline import Spline
from grid import Grid
from robot_renderer import RobotRenderer
from obstacle_map import ObstacleMap
import plot_tools as pt
... | 2.140625 | 2 |
code/modern-python/quadratic.py | dushyantkhosla/testing4ds | 0 | 32476 | <gh_stars>0
from math import sqrt
from typing import Tuple
def quadratic(a: float, b: float, c: float) -> Tuple[float, float]:
'''Compute roots of the quadratic equation:
a*x**2 + b*x + c = 0
For example:
>>> x1, x2 = quadratic(a=4, b=11, c=7)
>>> x1
-1.0
... | 4.03125 | 4 |
Python/973.py | JWang169/LintCodeJava | 1 | 32477 | <reponame>JWang169/LintCodeJava
import heapq
class Solution:
def kClosest(self, points: List[List[int]], K: int) -> List[List[int]]:
results = []
heap = []
for x, y in points:
dist = x * x + y * y
heapq.heappush(heap, (dist, x, y))
for i in range(K):
... | 2.890625 | 3 |
tests/test_sphnf.py | JohnEdChristensen/NiggliOptimize | 0 | 32478 | <gh_stars>0
import pytest
import numpy as np
"""
def test_mono_39():
from pg_comp.base_mono import *
with open("tests/test_output/base_mono_1_200_n.out","r") as f:
n_500 = int(f.readline().strip())
srHNFs = []
for n in range(1,201):
temp = base_mono_37_39(n)
for t in temp:
... | 2.5625 | 3 |
homography-transformation-points.py | Tomikrys/RePhoto | 0 | 32479 | <gh_stars>0
import numpy as np
import cv2
import sys
import json
import os
if (len(sys.argv) != 5):
print('2 arguments required')
exit()
img1 = cv2.imread(sys.argv[1])
img2 = cv2.imread(sys.argv[2])
file = open(sys.argv[4], "r")
points = json.loads(file.read())
dst_pts = np.float32(points['old']).reshape(-... | 2.453125 | 2 |
cpp/opt.py | AtsushiSakai/optuna_sample | 1 | 32480 | <filename>cpp/opt.py
"""
Parameter optimization with optuna for Cpp code
author: <NAME>
"""
import optuna
import numpy as np
import matplotlib.pyplot as plt
import subprocess
def HimmelblauFunction(x, y):
"""
Himmelblau's function
see Himmelblau's function - Wikipedia, the free encyclopedia
http:/... | 2.734375 | 3 |
gui/select_excel.py | Tac213/ECConverter | 1 | 32481 | <reponame>Tac213/ECConverter<filename>gui/select_excel.py
# -*- coding: utf-8 -*-
# author: Tac
# contact: <EMAIL>
import os.path
from PyQt6.QtWidgets import QFrame, QVBoxLayout, QPushButton, QSizePolicy, QFileDialog, QMessageBox
from PyQt6.QtCore import Qt, QDir, QModelIndex
from gui.excel_list_view import ExcelLis... | 2.4375 | 2 |
i3razer/i3_razer.py | leofah/i3razer | 5 | 32482 | from logging import getLogger
from openrazer.client import DeviceManager, constants as razer_constants
from i3razer import config_contants as conf
from i3razer.config_parser import ConfigParser
from i3razer.layout import layouts
from i3razer.pyxhook import HookManager
ERR_DAEMON_OFF = -2 # openrazer is not running
... | 2.03125 | 2 |
samples/storage.py | xdvlabs/xumm-sdk-py | 4 | 32483 | #!/usr/bin/env python
# coding: utf-8
import logging
import asyncio
import xumm
class StorageExample:
def __init__(self):
logging.debug('')
self.sdk = xumm.XummSdk('API_KEY', 'API_SECRET')
self.logger = logging.getLogger(self.__module__)
self.logger.setLevel(level=logging.DEBUG)
... | 2.359375 | 2 |
packages/w3af/w3af/core/controllers/misc/dns_cache.py | ZooAtmosphereGroup/HelloPackages | 3 | 32484 | """
dns_cache.py
Copyright 2006 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed in the hope that it will b... | 2.1875 | 2 |
fretboard/chord.py | honorabel/python-fretboard | 69 | 32485 | <reponame>honorabel/python-fretboard<filename>fretboard/chord.py
import copy
import attrdict
import svgwrite
import yaml
from .compat import StringIO
from .fretboard import Fretboard
from .utils import dict_merge
CHORD_STYLE = '''
string:
muted_font_color: silver
open_font_color: steelblue
'''
class Chord... | 2.796875 | 3 |
cheatsheets/py/pyython.6a.keras.py | questsin/cheats | 0 | 32486 | <filename>cheatsheets/py/pyython.6a.keras.py
from keras.datasets import imdb
top_words = 10000
(x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=top_words)
#imdb.get_word_index()
word_dict = imdb.get_word_index()
word_dict = { key:(value + 3) for key, value in word_dict.items() }
word_dict[''] = 0 # Pad... | 2.6875 | 3 |
Analytics/resources/moving_sensors/export_to_kml.py | thanosbnt/SharingCitiesDashboard | 4 | 32487 | <reponame>thanosbnt/SharingCitiesDashboard<gh_stars>1-10
from http import HTTPStatus
import simplekml
from flask_jwt_extended import jwt_required
from flask_restful import Resource
from flask_restful import reqparse
from models.pin_location_data import Tracker
class ExportToKML(Resource):
"""
Export Locatio... | 2.359375 | 2 |
graphene_mongo/tests/conftest.py | pfrantz/graphene-mongo | 0 | 32488 | <gh_stars>0
import os
import pytest
from datetime import datetime
from .models import (
Article,
Editor,
EmbeddedArticle,
Player,
Reporter,
Child,
ProfessorMetadata,
ProfessorVector,
ChildRegisteredBefore,
ChildRegisteredAfter,
ParentWithRelationship,
CellTower,
Publ... | 2.125 | 2 |
scratch.py | chappers/lightning-rl | 0 | 32489 | <reponame>chappers/lightning-rl
import curses
scr = curses.initscr()
curses.halfdelay(5) # How many tenths of a second are waited, from 1 to 255
curses.noecho() # Wont print the input
while True:
char = scr.getch() # This blocks (waits) until the time has elapsed,
# or there is input to be handled
scr.c... | 3.109375 | 3 |
src/thenewboston/factories/network_validator.py | achalpatel/thenewboston-python | 122 | 32490 | from factory import Faker
from .network_node import NetworkNodeFactory
from ..constants.network import ACCOUNT_FILE_HASH_LENGTH, BLOCK_IDENTIFIER_LENGTH, MAX_POINT_VALUE, MIN_POINT_VALUE
from ..models.network_validator import NetworkValidator
class NetworkValidatorFactory(NetworkNodeFactory):
daily_confirmation_... | 2.265625 | 2 |
core/facade.py | vitorpvcampos/djmenu | 10 | 32491 | from menu.models import Menu
from products.models import Product, Category
def get_dashboard_data_summary():
cardapios = Menu.objects.all()
produtos = Product.objects.all()
categorias = Category.objects.all()
return {'total_cardapios': len(cardapios),
'total_produtos': len(produtos),
... | 1.976563 | 2 |
database/crawler/crawl_drugbank.py | tttor/csipb-jamu-prj | 5 | 32492 | # crawl_drugbank.py
import time
import pickle
import json
import MySQLdb
import httplib
import urllib2 as urllib
from collections import defaultdict
import dbcrawler_util as util
from datetime import datetime
from bs4 import BeautifulSoup as bs
outDir = '/home/tor/robotics/prj/csipb-jamu-prj/dataset/drugbank/drugbank... | 2.40625 | 2 |
k2/__init__.py | sequeender/k2 | 0 | 32493 | # -*- coding: utf-8 -*-
# flake8: noqa
# -------------- Add path of _k2.so into sys.path --------------
import os as _os
import sys as _sys
_current_module = _sys.modules[__name__]
_k2_dir = _os.path.dirname(_current_module.__file__)
if not hasattr(_current_module, "__path__"):
__path__ = [_k2_dir]
elif _k2_dir... | 1.898438 | 2 |
amipy/core/spiderhub.py | 01ly/Amipy | 24 | 32494 | #coding:utf-8
'''
author : linkin
e-mail : <EMAIL>
date : 2018-11-15
'''
import amipy
from amipy.BaseClass import Hub
from amipy.middlewares import MiddleWareManager
from amipy.util.load import load_py
from amipy.log import getLogger
class SpiderHub(Hub):
def __new__(cls, *args, **kwargs):
i... | 2.171875 | 2 |
contentcuration/contentcuration/test_settings.py | DXCanas/content-curation | 0 | 32495 | <filename>contentcuration/contentcuration/test_settings.py<gh_stars>0
from .not_production_settings import * # noqa
DEBUG = True
WEBPACK_LOADER["DEFAULT"][ # noqa
"LOADER_CLASS"
] = "contentcuration.tests.webpack_loader.TestWebpackLoader"
TEST_ENV = True
| 1.265625 | 1 |
estpop/simulation.py | defragworks/estpop | 0 | 32496 | import numpy as np
def ratios(pops1, pops2):
totals1 = np.array(pops1[0]) + np.array(pops1[1])
totals2 = np.array(pops2[0]) + np.array(pops2[1])
change_ratio = np.delete(totals2, 0) / np.delete(totals1, -1)
change_ratio = np.delete(change_ratio, -1)
baby_ratio = totals2[0] / np.sum(np.array(pops1... | 3.046875 | 3 |
python_exc_3/copyspecial.py | fpecek/python-exercise | 0 | 32497 | #!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import sys
import re
import os
import shutil
import subprocess
import zipfile
"""
Copy Speci... | 3.6875 | 4 |
models/autoencoder_model.py | piyushkaul/information_geometry | 0 | 32498 | <reponame>piyushkaul/information_geometry<filename>models/autoencoder_model.py
import torch.nn as nn
from core.fim_model import ModelFIM
import torch
features = [784,1000,500,250,30]
class Autoencoder(ModelFIM):
def __init__(self, args, init_from_rbm=False, hook_enable=True, logger=None):
super(Autoencod... | 2.453125 | 2 |
tests/test.py | ZhenningLang/py-proj-init | 0 | 32499 | <filename>tests/test.py<gh_stars>0
import os
import sys
CURRENT_PATH = os.path.split(os.path.realpath(__file__))[0]
sys.path.append(os.path.join(CURRENT_PATH, '..'))
from py_proj_init.__main__ import main # noqa
main()
| 1.953125 | 2 |