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 |
|---|---|---|---|---|---|---|
howdy/core/core_admin.py | tanimislam/plexstuff | 9 | 38100 | import requests, os, sys, numpy, requests
from plexapi.server import PlexServer
from tqdm import tqdm
#
from howdy.core import core, return_error_raw
def get_tautulli_apikey( username, password, endpoint ):
"""
Gets the tautulli API key with provided Tautulli_ username and password.
:param str usernam... | 2.5 | 2 |
halolib/models.py | yoramk2/halolib | 2 | 38101 | from __future__ import print_function
import datetime
import hashlib
import logging
from abc import ABCMeta
from pynamodb.attributes import UnicodeAttribute
from pynamodb.models import Model
from halolib.exceptions import DbIdemError
from halolib.logs import log_json
from .settingsx import settingsx
settings = sett... | 2.109375 | 2 |
cblue/data/__init__.py | dfhby0/CBLUE | 293 | 38102 | <gh_stars>100-1000
from .data_process import EEDataProcessor, REDataProcessor, ERDataProcessor, CTCDataProcessor, \
CDNDataProcessor, STSDataProcessor, QQRDataProcessor, QICDataProcessor, QTRDataProcessor
from .dataset import EEDataset, REDataset, ERDataset, CTCDataset, CDNDataset, STSDataset, \
QQRDataset, QIC... | 1.085938 | 1 |
write_input_files.py | jensengroup/take_elementary_step | 4 | 38103 | <gh_stars>1-10
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import rdMolDescriptors
def get_fragments(mol,name):
fragment_names = []
fragments = Chem.GetMolFrags(mol,asMols=True)
labels = ["A","B","C"]
for label,fragment in zip(labels,fragments):
fragment_names.append(n... | 2.328125 | 2 |
djapi/authtoken/models.py | Suor/djapi | 12 | 38104 | <reponame>Suor/djapi<gh_stars>10-100
import binascii
import os
from django.conf import settings
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible
class Token(models.Model):
"""
The de... | 2.171875 | 2 |
app/lib/docker_config.py | joshburt/com.shapeandshare.therowantree.client.api | 0 | 38105 | <reponame>joshburt/com.shapeandshare.therowantree.client.api
# Allow over-riding the defaults with non-secure ENV variables, or secure docker secrets
import therowantree_config as default_config
import os
###############################################################################
# Direcrtory Options
###########... | 1.609375 | 2 |
run/__init__.py | ealcobaca/optimizer_pool | 1 | 38106 | <reponame>ealcobaca/optimizer_pool<filename>run/__init__.py<gh_stars>1-10
from run.run_real import Run_real
from run.run_PSO import Run_PSO
| 1.09375 | 1 |
scripts/util/test_cloudlab.py | neilgiri/hotstuff | 2 | 38107 | <filename>scripts/util/test_cloudlab.py
#!/usr/bin/env python
import cloudlab_util as cl
from geni.rspec import pg as rspec
from geni.util import loadContext
def see_slice():
c = loadContext("/tmp/context.json", key_passphrase='<PASSWORD>')
print(c.cf.listProjects(c))
cl.do_release(c, 'testing138', ['cl-u... | 1.914063 | 2 |
cdp_scrapers/instances/__init__.py | dhanya-shraddha/cdp-scrapers | 0 | 38108 | # -*- coding: utf-8 -*-
"""
Individual scratchpad and maybe up-to-date CDP instance scrapers.
"""
| 0.855469 | 1 |
src/lager/core.py | jessekrubin/lager | 1 | 38109 | # -*- coding: utf-8 -*-
"""Python lager brewed by a loguru"""
import asyncio
from functools import wraps
from time import time
from typing import Union
from loguru import logger
from lager.const import LOG_LEVELS
__all__ = ['loglevel', 'flog', 'handlers', 'logger', 'log', 'LOG', 'ln', 'LN']
logger.t = logger.trac... | 2.640625 | 3 |
Tests/Plot/LamHole/test_Hole_54_plot.py | PMSMcqut/pyleecan-of-manatee | 2 | 38110 | # -*- coding: utf-8 -*-
"""
@date Created on Wed Jan 13 17:45:15 2016
@copyright (C) 2015-2016 EOMYS ENGINEERING.
@author pierre_b
"""
from os.path import join
from unittest import TestCase
import matplotlib.pyplot as plt
from numpy import pi
from pyleecan.Classes.Frame import Frame
from pyleecan.Classes.LamHole imp... | 2.390625 | 2 |
invenio_rdm_records/config.py | kprzerwa/invenio-rdm-records | 0 | 38111 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""DataCite-based data model for Invenio."""
from .utils import... | 1.546875 | 2 |
tests/dictionary1.py | Oshanath/lpython | 0 | 38112 | def test_Dict():
x: dict[i32, i32]
x = {1: 2, 3: 4}
# x = {1: "2", "3": 4} -> sematic error
y: dict[str, i32]
y = {"a": -1, "b": -2}
z: i32
z = y["a"]
z = y["b"]
z = x[1]
def test_dict_insert():
y: dict[str, i32]
y = {"a": -1, "b": -2}
y["c"] = -3
def test_dict_get(... | 3.078125 | 3 |
mysite/addOne.py | xinkaiwang/robotJump | 0 | 38113 | #!/usr/bin/env python
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
import django
django.setup()
# your imports, e.g. Django models
from buckets.models import *
from buckets.name2date import name2date
bucket = BucketInfo.objects.get(name='xinkaibuk1')
allInDb = set()
allInDb.update(I... | 2.109375 | 2 |
backend/test.py | Harin329/Masterplan | 0 | 38114 | <reponame>Harin329/Masterplan<gh_stars>0
import boto3
import os
from dotenv import load_dotenv
load_dotenv()
client = boto3.client(
'dynamodb',
aws_access_key_id=os.getenv('AWS_ACCESS_KEY_ID'),
aws_secret_access_key=os.getenv('AWS_SECRET_ACCESS_KEY'),
region_name="us-east-1"
)
| 1.84375 | 2 |
buildingspy/__init__.py | marcusfuchs/BuildingsPy | 66 | 38115 | <reponame>marcusfuchs/BuildingsPy<filename>buildingspy/__init__.py
"""
:mod:`buildingspy` Modules for post-processing simulation output files
======================================================================
"""
import os
# Version.
version_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'VERSION'... | 1.695313 | 2 |
kuryr_kubernetes/tests/unit/controller/drivers/test_public_ip.py | BoringWenn/kuryr-kubernetes | 0 | 38116 | # Copyright (c) 2017 RedHat, Inc.
# 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... | 1.867188 | 2 |
day/day19part1.py | swemoney/adventofcode2020 | 1 | 38117 | from functools import cached_property
from puzzle import Puzzle # pylint: disable=import-error
class Day19Part1:
puzzle = None
def run(self):
self.rules, messages = self.parsed_input
print(sum([self.match('0', message) for message in messages]))
def match(self, rule_id, message):
... | 2.890625 | 3 |
volatility/volatility/plugins/linux/pslist.py | williamclot/MemoryVisualizer | 2 | 38118 | <gh_stars>1-10
# Volatility
# Copyright (C) 2007-2013 Volatility Foundation
#
# This file is part of Volatility.
#
# Volatility 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; either version 2 of the License, ... | 1.8125 | 2 |
demo/code/2016-11-08/asyncio_demo/2.py | uxlsl/uxlsl.github.io | 0 | 38119 |
import asyncio
async def f1():
print("f1")
return "f1"
async def f2():
result = await f1()
print(result)
return "f2"
loop = asyncio.get_event_loop()
try:
result = loop.run_until_complete(f2())
print(result)
finally:
print("exit")
| 3.3125 | 3 |
src/opendr/control/mobile_manipulation/mobileRL/envs/eeplanner.py | makistsantekidis/opendr | 3 | 38120 | # Copyright 2020-2021 OpenDR European Project
#
# 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 agree... | 1.890625 | 2 |
spectral_clustering_audio.py | gamaievsky/DescripteursHarmoniquesAudio | 0 | 38121 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
======================
Laplacian segmentation
======================
This notebook implements the laplacian segmentation method of
`McFee and Ellis, 2014 <http://bmcfee.github.io/papers/ismir2014_spectral.pdf>`_,
with a couple of minor stability improvements.
This impleme... | 2.484375 | 2 |
src/distributed_cache.py | kontexia/soam | 1 | 38122 | <reponame>kontexia/soam
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from typing import Optional, Dict, Union, List
from dask.distributed import Client, Variable, Lock, ActorFuture, TimeoutError
from src.kv_cache import KVGraphCache, KVCacheValueType
class DistributedCache:
def __init__(self, config: Optional... | 2.484375 | 2 |
snaps/openstack/tests/create_user_tests.py | hashnfv/hashnfv-snaps | 0 | 38123 | <filename>snaps/openstack/tests/create_user_tests.py<gh_stars>0
# Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
# and others. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 2.140625 | 2 |
eveonline-assistant/users/menus.py | wengole/eveonline-assistant | 1 | 38124 | <filename>eveonline-assistant/users/menus.py<gh_stars>1-10
from django.core.urlresolvers import reverse
from menu import Menu, MenuItem
def profile_title(request):
"""
Return a personalized title for our profile menu item
"""
# we don't need to check if the user is authenticated because our menu
#... | 2.609375 | 3 |
thetagang_notifications/earnings.py | major/thetagang-notifications | 0 | 38125 | <gh_stars>0
"""Handle earnings updates."""
from functools import cached_property
import logging
import re
from discord_webhook import DiscordWebhook, DiscordEmbed
import tweepy
from thetagang_notifications import config, utils
log = logging.getLogger(__name__)
# Earnings notification colors.
EARNINGS_COLOR_BEAT = ... | 2.734375 | 3 |
client/Client.py | DSteam1/Sudoku | 0 | 38126 | <filename>client/Client.py
from mtTkinter import *
import tkMessageBox
from socket import AF_INET, SOCK_STREAM, socket, error
import OtherViews as OV
import MainView as MV
import GameView as GV
from threading import Thread
from common.utils import init_logging
from common.constants import *
import common.protocol as p... | 2.890625 | 3 |
idact/detail/deployment_sync/nodes/get_nodes_deployment_definition.py | intdata-bsc/idact | 5 | 38127 | <filename>idact/detail/deployment_sync/nodes/get_nodes_deployment_definition.py
from idact.detail.deployment_sync.deployment_definition import \
DeploymentDefinition
from idact.detail.deployment_sync.nodes.get_expiration_date_from_nodes \
import get_expiration_date_from_nodes
from idact.detail.nodes.nodes_impl ... | 1.960938 | 2 |
setup.py | muhammad-alaref/CAM2RequestsCLI | 0 | 38128 | <reponame>muhammad-alaref/CAM2RequestsCLI
from setuptools import setup, find_packages
setup(
name='CAM2RequestsCLI',
version='v1.0-rc0',
packages=find_packages(),
zip_safe=False,
install_requires=[
'click',
'requests',
],
entry_points='''
[console_scripts]
CAM2RequestsCLI=CAM2RequestsCLI:cli
''',
)
| 1.429688 | 1 |
work/fromcsv.py | ujjvlh/pdf-glyph-mapping | 0 | 38129 | <gh_stars>0
# Downloaded from Google Sheets, edited out the first line, and then...
# reader = csv.DictReader(open('from-sheets.csv', newline=''))
import csv
import toml
reader = csv.reader(open('from-sheets.csv', newline=''))
rows = [row for row in reader]
final_bold = {}
final_regular = {}
for (i, row) in enumerate(... | 2.84375 | 3 |
agnostic/postgres.py | a6patch/agnostic | 0 | 38130 | import subprocess
import pg8000
from agnostic import AbstractBackend
class PostgresBackend(AbstractBackend):
''' Support for PostgreSQL. '''
def backup_db(self, backup_file):
'''
Return a ``Popen`` instance that will backup the database to the
``backup_file`` handle.
'''
... | 2.59375 | 3 |
vasppy/scripts/fat_bands.py | cajfisher/vasppy | 28 | 38131 | <reponame>cajfisher/vasppy
#! /usr/bin/env python3
from vasppy import procar
from vasppy.outcar import reciprocal_lattice_from_outcar
import argparse
#def x_axis( cartesian_k_points ):
# if cartesian_k_points is not None:
# x_axis = [ 0.0 ]
# for i in range( 1, len(cartesian_k_points) ):
# ... | 2.25 | 2 |
io_scene_vrm/editor/extension.py | 989onan/VRM_Addon_for_Blender | 344 | 38132 | <reponame>989onan/VRM_Addon_for_Blender
import bpy
from .vrm0.property_group import Vrm0PropertyGroup
class VrmAddonArmatureExtensionPropertyGroup(bpy.types.PropertyGroup): # type: ignore[misc]
addon_version: bpy.props.IntVectorProperty( # type: ignore[valid-type]
size=3 # noqa: F722
)
vrm0: ... | 1.460938 | 1 |
examples/data/data.py | chenyangh/pytorch-struct | 0 | 38133 | <filename>examples/data/data.py
from torchtext.legacy import data
import torch
def token_pre(tokenizer, q):
st = " ".join(q)
s = tokenizer.tokenize(st)
out = [0]
cur = 0
expect = ""
first = True
for i, w in enumerate(s):
if len(expect) == 0:
cur += 1
expect... | 2.765625 | 3 |
start.py | FoerMaster/GachiBot-Discord | 1 | 38134 | <gh_stars>1-10
import gachi
import discord
import functions
import kachalochka
commands = functions.commands()
gachi = gachi.gachi() #gachi class
kachalaka = kachalochka.kachalka()
################################################################
## FUNCS INITIALIZATION ... | 2.203125 | 2 |
pushit/backends/mpns.py | rhblind/django-pushit | 0 | 38135 | <reponame>rhblind/django-pushit<filename>pushit/backends/mpns.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from pushit.backends import PushBackend
class MPNSPushBackend(PushBackend):
"""
"""
def __init__(self, connection_alias, **options):
super(MPNSPushB... | 1.851563 | 2 |
hic_covid_repository/versions/002_Virology.py | LCBRU/hic_covid | 0 | 38136 | <filename>hic_covid_repository/versions/002_Virology.py
from sqlalchemy import (
MetaData,
Table,
Column,
Integer,
NVARCHAR,
DateTime,
Date,
Boolean,
)
meta = MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
t = Table(
"virology",
meta,
... | 2.078125 | 2 |
marlgrid/pz_envs/contentFB.py | aivaslab/marlgrid | 0 | 38137 | <filename>marlgrid/pz_envs/contentFB.py
from ..base_AEC import *
from ..objects import *
from random import randrange
import random
import math
class ContentFBEnv(para_MultiGridEnv):
"""
Environment with a door and key, sparse reward.
Similar to DoorKeyEnv in
https://github.com/maximecb/gym-minigr... | 2.6875 | 3 |
run.py | BloomTech-Labs/tally-ai-ds | 8 | 38138 | <filename>run.py<gh_stars>1-10
""" Entry point for the Yelp API Flask Reviews for Tally-ai"""
from yelpapi.app import create_app
APP = create_app()
if __name__=='__main__':
APP.run(host="0.0.0.0")
| 1.320313 | 1 |
day6.py | xpqz/aoc-17 | 0 | 38139 | <filename>day6.py
from itertools import cycle
import re
def read_data(filename="data/input6.data"):
with open(filename) as f:
return [int(n) for n in re.findall(r"-?\d+", f.read())]
def maxindex(data):
m = data[0], 0
for i in range(len(data)):
if data[i] > m[0]:
m = data[i], ... | 3.234375 | 3 |
analysis/Therapy_abi-initialcondition.py | Harshavardhan-BV/Cancer-compe-strat | 1 | 38140 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import common_fn as cf
import seaborn as sns
plt.rcParams["svg.hashsalt"]=0
pre_path='EnvEq/All3/'
parm_format='{:.2e}'
parm_name='therapy_abi-Tneg_initratio-Totcell'
parm_name_array=['Tneg_initratio','Totcell']
post_path1='o2-Null_test-HE/'
parm_n... | 1.859375 | 2 |
batch/batch/globals.py | vrautela/hail | 0 | 38141 | <reponame>vrautela/hail
states = {'Pending', 'Ready', 'Creating', 'Running', 'Cancelled', 'Error', 'Failed', 'Success'}
complete_states = ('Cancelled', 'Error', 'Failed', 'Success')
valid_state_transitions = {
'Pending': {'Ready'},
'Ready': {'Creating', 'Running', 'Cancelled', 'Error'},
'Creating': {'Read... | 1.65625 | 2 |
decodense/tools.py | luna-component/decodense | 0 | 38142 | #!/usr/bin/env python
# -*- coding: utf-8 -*
"""
tools module
"""
__author__ = 'Dr. <NAME>, University of Bristol, UK'
__maintainer__ = 'Dr. <NAME>'
__email__ = '<EMAIL>'
__status__ = 'Development'
import sys
import os
import copy
import numpy as np
try:
import opt_einsum as oe
OE_AVAILABLE = True
except Imp... | 2.0625 | 2 |
needy/platforms/__init__.py | carlbrown/needy | 65 | 38143 | <gh_stars>10-100
import sys
from .generic import GenericPlatform
from .android import AndroidPlatform
from .osx import OSXPlatform
from .ios import iOSPlatform, iOSSimulatorPlatform
from .tvos import tvOSPlatform, tvOSSimulatorPlatform
from .windows import WindowsPlatform
def available_platforms():
pl... | 2.203125 | 2 |
starfish/pipeline/filter/white_tophat.py | joshmoore/starfish | 0 | 38144 | import numpy as np
from ._base import FilterAlgorithmBase
class WhiteTophat(FilterAlgorithmBase):
"""
Performs "white top hat" filtering of an image to enhance spots. "White top hat filtering" finds spots that are both
smaller and brighter than their surroundings.
See Also
--------
https://e... | 3.203125 | 3 |
lambda/lambda/avm-create-bitbucket-repo/avm-create-bitbucket.py | khiann/terraform-aws-avm | 0 | 38145 | <filename>lambda/lambda/avm-create-bitbucket-repo/avm-create-bitbucket.py<gh_stars>0
import json
import stashy
import avm_common
import urllib3
import boto3
import base64
from botocore.exceptions import ClientError
urllib3.disable_warnings()
# import pprint
# pp = pprint.PrettyPrinter(indent=4)
class gitMgr:
"""... | 2.421875 | 2 |
artsci2019/display.py | fhennig/artsci-2019 | 5 | 38146 | import datetime
import cv2
import numpy as np
from artsci2019.lib.frame_checker import FrameChecker
from artsci2019.lib.util import scale_frame, scale_point, is_in_frame
from artsci2019.lib.face_recog import get_faces
from artsci2019.lib.sound import SoundPlayer
def draw_checked_frame(frame, checked_frame, factor):
... | 2.34375 | 2 |
tests/examples/simple.py | Tiendil/coulson | 0 | 38147 | <reponame>Tiendil/coulson
def assigned_type_mismatch():
x = 666
x = '666'
return x
def annotation_type_mismatch(x: int = '666'):
return x
def assigned_type_mismatch_between_calls(case):
if case:
x = 666
else:
x = '666'
return x
| 2.828125 | 3 |
tests/test_dataset_manager.py | METASPACE2020/sm-engine | 3 | 38148 | from unittest.mock import patch, MagicMock, call
import json
from datetime import datetime
from copy import deepcopy
import pytest
from PIL import Image
from sm.engine import DB, ESExporter, QueuePublisher
from sm.engine.dataset_manager import SMapiDatasetManager, SMDaemonDatasetManager
from sm.engine.dataset_manager ... | 1.945313 | 2 |
tests/test_service_catalog/test_views/test_admin/test_settings/test_catalog/test_services/test_create.py | LaudateCorpus1/squest | 112 | 38149 | <gh_stars>100-1000
from copy import copy
from io import BytesIO
from PIL import Image
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.urls import reverse
from service_catalog.models import Service
from tests.test_service_catalog.base import BaseTest
class ServiceCreateTestCase(BaseTest):... | 2.34375 | 2 |
deep_q_tf/main_tf.py | murtazayusuf/Reinforcement_Learning | 0 | 38150 | import gym
from dqn_tf import DeepQNetwork, Agent
import numpy as np
from gym import wrappers
def preprocess(observation):
return np.mean(observation[30:, :], axis=2).reshape(180, 160, 1)
def stack_frames(stacked_frames, frame, buffer_size):
if stacked_frames is None:
stacked_frames = np.zeros((buff... | 2.46875 | 2 |
gz.17zwd.com/17wang.py | zzh-python/all-project | 58 | 38151 | from bs4 import BeautifulSoup
import requests
import csv
import sys
from urllib.error import HTTPError
sys.path.append("..")
import mytemp
import time
import json
url='https://gz.17zwd.com/api/shop/get-list/73'
resp=requests.get(url)
f=open('17wang.txt','w+',encoding='utf-8')
f.write(resp.text)
print(res... | 2.953125 | 3 |
extra/dream_examples/anticor.py | cyankaet/bumps | 44 | 38152 | #!/usr/bin/env python
"""
Example model with strong correlations between the fitted parameters.
We use a*x = y + N(0,1) made complicated by defining a=p1+p2.
The expected distribution for p1 and p2 will be uniform, with p2 = a-p1 in
each sample. Because this distribution is inherently unbounded, artificial
bounds a... | 2.984375 | 3 |
tests/plugins/test_brittv.py | fuglede/streamlink | 0 | 38153 | <gh_stars>0
import unittest
from streamlink.plugins.brittv import BritTV
class TestPluginBritTV(unittest.TestCase):
def test_can_handle_url(self):
should_match = [
'http://brittv.co.uk/watch/?channel=1',
]
for url in should_match:
self.assertTrue(BritTV.can_handle_... | 2.796875 | 3 |
src/Modules/Lighting/lighting.py | bopopescu/PyHouse_1 | 1 | 38154 | <gh_stars>1-10
"""
-*- test-case-name: PyHouse.Modules.Lighting.test.test_lighting -*-
@name: PyHouse/src/Modules/Lighting/lighting.py
@author: <NAME>
@contact: <EMAIL>
@copyright: (c) 2010-2016 by <NAME>
@note: Created on Apr 2, 2010
@license: MIT License
@summary: Handle the home lighting system a... | 1.875 | 2 |
tests/math/unary/test_hyperbolictrig.py | Zac-HD/MyGrad | 0 | 38155 | <reponame>Zac-HD/MyGrad
import numpy as np
from mygrad import cosh, coth, csch, sech, sinh, tanh
from tests.wrappers.uber import backprop_test_factory, fwdprop_test_factory
def _is_nonzero(x):
return np.all(np.abs(x.data) > 1e-8)
@fwdprop_test_factory(
mygrad_func=sinh, true_func=np.sinh, index_to_bnds={0:... | 2.34375 | 2 |
hwrt/data_analyzation_metrics.py | MartinThoma/hwrt | 65 | 38156 | """Data analyzation metrics
Each algorithm works on a set of handwritings. They have to be applied like
this:
>>> import hwrt.data_analyzation_metrics
>>> from hwrt.handwritten_data import HandwrittenData
>>> data_json = '[[{"time": 123, "x": 45, "y": 67}]]'
>>> a = [{'is_in_testset': 0,
... 'formula_id': "31L",
.... | 2.59375 | 3 |
tests/test_spiral_spanning_tree_coverage_path_planner.py | duken72/PythonRobotics | 15,431 | 38157 | import conftest # Add root path to sys.path
import os
import matplotlib.pyplot as plt
from PathPlanning.SpiralSpanningTreeCPP \
import spiral_spanning_tree_coverage_path_planner
spiral_spanning_tree_coverage_path_planner.do_animation = True
def spiral_stc_cpp(img, start):
num_free = 0
for i in range(img... | 2.421875 | 2 |
codewars-python/Build-Tower.py | fmelihh/competitive-programming-solutions | 2 | 38158 | <reponame>fmelihh/competitive-programming-solutions<gh_stars>1-10
# https://www.codewars.com/kata/576757b1df89ecf5bd00073b/train/python
def tower_builder(n_floors):
times = 1
space = ((2*n_floors -1) // 2)
tower = []
for _ in range(n_floors):
tower.append((' '*space) + ('*' * times) + (' ... | 3.5 | 4 |
test/test_degrees_kernel.py | remenska/KM3Net | 1 | 38159 | from __future__ import print_function
import numpy as np
from kernel_tuner import run_kernel
from .context import skip_if_no_cuda_device, create_plot
from km3net.util import get_kernel_path, generate_correlations_table
def test_degrees_kernel():
skip_if_no_cuda_device()
def in_degrees(correlations):
... | 2.359375 | 2 |
datasets.py | mi-erasmusmc/Sard | 0 | 38160 | import numpy as np
import torch
import torch.nn.functional as F
from scipy.sparse import coo_matrix
from sklearn.preprocessing import StandardScaler
from torch.utils.data import Dataset
from torch_geometric.data import InMemoryDataset, Data, Batch
from tqdm.auto import tqdm
from utils.data_utils import window_data_sor... | 2.390625 | 2 |
Python3-world2/ex068.py | samirsaravia/Python_101 | 0 | 38161 | <filename>Python3-world2/ex068.py
import random
title = 'par ou ímpar'.upper()
print('~~' * 10)
print(f'\033[7;30m{title:^20}\033[m')
print('~~' * 10)
# poi = par ou impar
# vop = vitoria ou perda
poi = vop = ''
cont = 0
while True:
cont += 1
escolha_numero = int(input('Digite um número: '))
escolha_parinpa... | 3.5625 | 4 |
2018_01__Python_introduction_for_MATLAB_users__at_Supelec/examples/Solving_a_2D_Ordinary_Differential_Equation.py | pierre-haessig/slides | 10 | 38162 | #! /usr/bin/env python
# -*- coding: utf8 -*-
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint # use Runge-Kutta 4
def pend(y, t, b, c): # function definition
"""Gives 2D vector dy/dt as function of y and t, with parameters b and c."""
return np.array([y[1], -b*y[1] - c... | 3.296875 | 3 |
learning/challenge/challenge7.py | Nephrin/Tut | 2 | 38163 | <gh_stars>1-10
# Arithmetic progression
# A + (A+B) + (A+2B) + (A+3B) + ... + (A+(C-1)B))
def main():
N = int(input("data:\n"))
l = []
for x in range(0,N):
a,b,c = input().split(" ")
a,b,c = int(a),int(b),int(c)
s = 0
for each in range(0,c):
s += a + (... | 3.484375 | 3 |
test-app/test_app/core/tests/test_image.py | dchiquito/girder-pytest-pyppeteer | 5 | 38164 | import pytest
def test_image_checksum(image_factory):
# Use "build" strategy, so database is not required
image = image_factory.build()
image.compute_checksum()
assert image.checksum is not None
@pytest.mark.django_db
def test_image_rest_retrieve(api_client, image):
resp = api_client.get(f'/api/... | 2.328125 | 2 |
rem/_dummy_fork_locking.py | heni/rem | 14 | 38165 | <reponame>heni/rem
import threading
__all__ = ["acquire_fork", "acquire_lock", "release_fork", "release_lock"]
class TwoExclusiveResourcesDispatcher(object):
def __init__(self):
self.FirstResourceUsage = 0
self.SecondResourceUsage = 0
self.lock = threading.Lock()
self.FirstResourc... | 2.78125 | 3 |
my/core/error.py | thetomcraig/HPI | 0 | 38166 | <reponame>thetomcraig/HPI<filename>my/core/error.py
"""
Various error handling helpers
See https://beepb00p.xyz/mypy-error-handling.html#kiss for more detail
"""
from itertools import tee
from typing import Union, TypeVar, Iterable, List, Tuple, Type
T = TypeVar('T')
E = TypeVar('E', bound=Exception) # TODO make cov... | 2.4375 | 2 |
Jira/CVE-2019-8451/__init__.py | csadsl/poc_exp | 11 | 38167 | import requests
import sys
# http://www.jas502n.com:8080/plugins/servlet/gadgets/makeRequest?url=http://www.jas502n.com:8080@www.baidu.com/
def ssrf_poc(url, ssrf_url):
if url[-1] == '/':
url = url[:-1]
else:
url = url
vuln_url = url + "/plugins/servlet/gadgets/makeRequest?url=" + url + ... | 2.8125 | 3 |
tests/__init__.py | NickolasHKraus/statikos | 0 | 38168 | # -*- coding: utf-8 -*-
"""Unit test package for statikos."""
| 0.957031 | 1 |
lib/googlecloudsdk/sql/tools/ssl_certs/__init__.py | bopopescu/google-cloud-sdk | 0 | 38169 | # Copyright 2013 Google Inc. All Rights Reserved.
"""Provide commands for managing SSL certificates of Cloud SQL instances."""
from googlecloudsdk.calliope import base
class SslCerts(base.Group):
"""Provide commands for managing SSL certificates of Cloud SQL instances.
Provide commands for managing SSL certif... | 2.515625 | 3 |
SciDataTool/GUI/WVectorSelector/WVectorSelector.py | TinaTabo/SciDataTool | 0 | 38170 | from PySide2.QtWidgets import QWidget
from SciDataTool.GUI.WVectorSelector.Ui_WVectorSelector import Ui_WVectorSelector
from PySide2.QtCore import Signal
from PySide2.QtGui import QStandardItem
COMP_DICT = {
"radial": "radial",
"circumferential": "tangential",
"axial": "axial",
"x-axis component": "co... | 2.609375 | 3 |
tezosetl/jobs/export_job.py | blockchain-etl/tezos-etl | 7 | 38171 | <reponame>blockchain-etl/tezos-etl
# MIT License
#
# Copyright (c) 2020 <NAME>, <EMAIL>
#
# 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... | 1.328125 | 1 |
examples/amq/rpc/rpc-client.py | JohnSitarski/gestalt | 8 | 38172 | <gh_stars>1-10
import argparse
import asyncio
import logging
import random
from aio_pika.exceptions import DeliveryError
from gestalt.amq.requester import Requester
from gestalt.serialization import CONTENT_TYPE_JSON
from gestalt.runner import run
logger = logging.getLogger(__name__)
if __name__ == "__main__":
... | 2.203125 | 2 |
api/v1/views/index.py | bdbaraban/HolbertonBnB | 1 | 38173 | #!/usr/bin/env python3
"""Defines a status route for the HolbertonBnB API."""
from flask import jsonify
from flasgger import swag_from
from models import storage
from api.v1.views import app_views
@app_views.route("/status")
@swag_from("../apidocs/status/status.yml")
def status():
"""Returns the server status.
... | 2.46875 | 2 |
helper.py | NorthwoodsDev/CircuitPython_Companion_Bot | 0 | 38174 | <reponame>NorthwoodsDev/CircuitPython_Companion_Bot
import os
import storage
import time
import board
import random
import microcontroller
def get_rndRGB():
a = (random.randint(20, 235))
b = (random.randint(20, 235))
c = (random.randint(20, 235))
return (a,b,c)
def timelasp(monoClk_last, monoClk_Inter... | 2.265625 | 2 |
data_strctures/queue.py | CodenameREBIRTH/algopy | 4 | 38175 | import inspect
class Queue(object):
'''
Queue data structure FIFO - First In First Out
'''
def __init__(self, capacity = 10):
'''
:param size: max capacity of the queue, default is 10
'''
self.queue = []
self.front = None
self.rear = None
self.s... | 3.875 | 4 |
course_science.py | 9999years/brandeis-classes | 0 | 38176 | <filename>course_science.py
import itertools
import os.path
from collections import Counter
from glob import glob
from typing import List, Mapping
import brandeis
COURSES = {}
def all_courses() -> Mapping[str, List[brandeis.Course]]:
global COURSES
if COURSES:
return COURSES
else:
COURSE... | 3.125 | 3 |
merak/utils/refs.py | Yao1993/merak | 16 | 38177 | # Copyright 2021 (David) <NAME>. 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 applicable law ... | 2.078125 | 2 |
Python/kth-largest-element-in-a-stream.py | se77enn/LeetCode-Solution | 1 | 38178 | # Time: O(nlogk)
# Space: O(k)
import heapq
class KthLargest(object):
def __init__(self, k, nums):
"""
:type k: int
:type nums: List[int]
"""
self.__k = k
self.__min_heap = []
for n in nums:
self.add(n)
def add(self, val):
"""
... | 3.578125 | 4 |
youtube_series_downloader/gateways/config_gateway.py | Senth/youtube-series-downloader | 3 | 38179 | import os
import platform
from configparser import ExtendedInterpolation
from pathlib import Path
from subprocess import run
from sys import exit
from typing import List
from blulib.config_parser import ConfigParser
from tealprint import TealPrint
from tealprint.teallevel import TealLevel
from youtube_series_downloade... | 2.328125 | 2 |
activeClassifier/env/input_fn.py | dHonerkamp/ActiveClassifier | 0 | 38180 | <reponame>dHonerkamp/ActiveClassifier
import tensorflow as tf
def parse_function(filename, label, FLAGS):
image_string = tf.read_file(filename)
# Don't use tf.image.decode_image, or the output shape will be undefined
image = tf.image.decode_png(image_string, channels=FLAGS.img_shape[-1])
# This will... | 2.703125 | 3 |
investigateModules/compareModulePatches.py | kromerh/solarAnalytics | 0 | 38181 | import pandas as pd
import numpy as np
import os
import re
| 1.078125 | 1 |
amical/data_processing.py | anand0xff/AMICAL | 0 | 38182 | """
@author: <NAME> (University of Sydney)
-------------------------------------------------------------------------
AMICAL: Aperture Masking Interferometry Calibration and Analysis Library
-------------------------------------------------------------------------
Function related to data cleaning (ghost, background c... | 2.109375 | 2 |
lyaf_optdepth/corrections.py | VikrantKamble/lyaf_optdepth | 0 | 38183 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import binned_statistic
def var_correct(qso, rest_ranges=None, zq_range=[1.6, 4.], fit_model=True,
savefile=False):
""" Corrections to the vriance assigned to the pixels by the pipeline
Notes:
1. Scaling s... | 1.9375 | 2 |
backend/common/databases/tosurnament/user.py | SpartanPlume/Tosurnament | 7 | 38184 | <reponame>SpartanPlume/Tosurnament<filename>backend/common/databases/tosurnament/user.py
"""User table"""
from mysqldb_wrapper import Base, Id
class User(Base):
"""User class"""
__tablename__ = "user"
id = Id()
discord_id = bytes()
discord_id_snowflake = str()
osu_id = str()
verified = ... | 2.109375 | 2 |
snakeswitch.py | TheRedSpy15/Snakeswitch | 0 | 38185 | from requests import get
import time
import gi
ip_starting = ""
recon_command = ""
rate = 60
def main():
print("Example: nordvpn disconnect && nordvpn connect")
recon_command = input("Enter the command used to reconnect to VPN: ")
ip_starting = get('https://api.ipify.org').text
print("Starting ip:", ip_startin... | 2.859375 | 3 |
consumerui/grapher.py | AlexRogalskiy/kubeplus | 396 | 38186 | <filename>consumerui/grapher.py
import sys
import json
import subprocess
import sys
import os
from graphviz import Digraph
from graphviz import Graph
class ConnectionsGraph(object):
def draw(self, connections_json, output_folder, relsToHide):
#print(connections_json)
cmd = "ls -ltr /root/"
out = subprocess.Pop... | 2.734375 | 3 |
scratch/interesting_cc.py | mikeboers/PyFlickr | 0 | 38187 | import os
import sys
import datetime
from pprint import pprint
import logging
logging.basicConfig(file=sys.stderr, level=logging.DEBUG)
from flickr import Flickr
from flickr.util import *
key = os.environ.get('FLICKR_KEY')
secret = os.environ.get('FLICKR_SECRET')
if not (key and secret):
print 'please set FLICK... | 2.703125 | 3 |
fused_biattention.py | utahnlp/layer_augmentation_qa | 6 | 38188 | import sys
import torch
from torch import nn
from torch.autograd import Variable
from view import *
from holder import *
from util import *
from join_table import *
from trilinear_prod import *
from fusion import *
# fused bidir attention
class FusedBiAttention(torch.nn.Module):
def __init__(self, opt, shared):
su... | 1.875 | 2 |
neos/secrets.py | mralext20/neos.py | 2 | 38189 | import random
import string
def generate() -> str:
"""
direct reimpl of secretID.js from account.neosvr.com
"""
length = 12
valid_chars = string.ascii_letters + string.digits
return "".join(random.choices(valid_chars, k=length))
| 2.796875 | 3 |
BresMaker.py | EvolveWithProseeker/Proseeker | 3 | 38190 | # Simplified Bres Maker
# Version: 1.0
#Python Version: 2.0
# IMPORTS
import pandas as pd
import numpy as np
from sklearn.cluster import KMeans
from numpy import asarray
from numpy import savetxt
import sys
import os
# DEFINITIONS
def find(s, ch):
return [i for i, ltr in enumerate(s) if ltr == ch]
# DATALOAD... | 2.421875 | 2 |
Ity/Tools/test_TestResults.py | rmomizo/Ubiqu-Ity | 11 | 38191 | <reponame>rmomizo/Ubiqu-Ity
import copy
from unittest import TestCase
import TestResults
__author__ = 'zthomae'
class TestArgumentParser(TestCase):
def setUp(self):
self.parser = TestResults.make_parser()
def test_type_should_not_be_optional(self):
try:
TestResults.parse_args(sel... | 2.484375 | 2 |
01-datamodeling/project02-data-modeling-with-cassandra/file_mgr.py | ultranet1/DATA-ENGINEERING-NANODEGREE-UDACITY | 33 | 38192 | <filename>01-datamodeling/project02-data-modeling-with-cassandra/file_mgr.py
import os
import glob
import pandas as pd
class FileMgr:
"""
Manage I/O files and directories and transform files to pandas dataframe and vice versa.
"""
@staticmethod
def get_directory_files_list(directory_path: str):
... | 3.4375 | 3 |
Day-111/quick_sort.py | arvimal/100DaysofCode-Python | 1 | 38193 | #!/usr/bin/env python3
# Algorithm: Quick sort
# Referrence: https://github.com/TheAlgorithms/Python/blob/master/sorts/quick_sort.py
def quick_sort(num_list):
"""
Quick sort in Python
If length of the list is 1 or less, there is no point in sorting it.
Hence, the code works on lists with sizes grea... | 4.3125 | 4 |
modules/sequence_generators.py | ZhaozhiQIAN/neurawkes | 0 | 38194 | <reponame>ZhaozhiQIAN/neurawkes<gh_stars>0
# -*- coding: utf-8 -*-
"""
Here are the sequence generators
including LSTM generator and Hawkes generator
@author: hongyuan
"""
import pickle
import time
import numpy
import theano
from theano import sandbox
import theano.tensor as tensor
import os
#import scipy.io
from co... | 2.421875 | 2 |
SeeThru_Feeds/Library/Components/HTTP.py | SeeThru-Networks/Python-Feed | 3 | 38195 | <filename>SeeThru_Feeds/Library/Components/HTTP.py
from SeeThru_Feeds.Model.Components.ComponentBase import ComponentBase
from SeeThru_Feeds.Model.Properties.Properties import FillableProperty, ResultProperty
import requests
class HTTPBase(ComponentBase):
URL = FillableProperty(name="url", required=True)
COOK... | 2.65625 | 3 |
scrapyd_dash/operations/versions_delete.py | Dainius-P/scrapyd-dash | 3 | 38196 | import requests
"""
Delete a project version.
If there are no more versions available for a given project, that project will be deleted too.
"""
def delete_version(server, project, version):
url = "http://{}/delversion.json".format(server)
data = {
"project": project,
"version": version
}
with requests.Sess... | 3.234375 | 3 |
login.py | kepler0301/test_git | 1 | 38197 | print('helo world')
<<<<<<< HEAD
from flask import Flask
app = Flask(__name__)
def index():
return 'hello world'
id __name__ == '__main__'
app.run()
=======
from flask import Flask
app = Flask(__name__)
@app/route('/')
def index():
return 'hello world'
>>>>>>> b644c89d3eb5e1fcd31fedf63470ab57d597d9dd
... | 3.140625 | 3 |
tests/test_svd.py | owenl131/pylinlin | 0 | 38198 | <filename>tests/test_svd.py<gh_stars>0
import pytest
from pylinlin.matrix import Matrix
from pylinlin.matrix_view import MatrixView
import pylinlin.matrix_utils as utils
from pylinlin.svd import \
compute_svd, \
reduce_to_bidiagonal, \
compute_svd_bidiagonal
class TestSVD:
def test_reduce_to_bidiagon... | 2.359375 | 2 |
translateSfw.py | tkarabela/translate-swf | 1 | 38199 | <gh_stars>1-10
#!/usr/bin/env python3
import pyTranslateSwf
import sys
def main():
cli = pyTranslateSwf.PyTranslateSwfCLI()
return cli.run(sys.argv[1:])
if __name__ == '__main__':
sys.exit(main())
| 1.726563 | 2 |