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 |
|---|---|---|---|---|---|---|
stockprophet/__init__.py | chihyi-liao/stockprophet | 1 | 8200 | <gh_stars>1-10
from stockprophet.cli import entry_point
from stockprophet.crawler import (
init_stock_type, init_stock_category
)
from stockprophet.db import init_db
from .utils import read_db_settings
def preprocessing() -> bool:
result = False
# noinspection PyBroadException
try:
db_config ... | 2.25 | 2 |
2021/day_25.py | mpcjanssen/Advent-of-Code | 1 | 8201 | <gh_stars>1-10
import aoc_helper
RAW = aoc_helper.day(25)
print(RAW)
def parse_raw():
...
DATA = parse_raw()
def part_one():
...
def part_two():
...
aoc_helper.submit(25, part_one)
aoc_helper.submit(25, part_two)
| 2.109375 | 2 |
6/6.2.py | Hunter1753/adventofcode | 1 | 8202 | <gh_stars>1-10
def setIntersectionCount(group):
return len(set.intersection(*group))
groupList = []
tempGroup = []
with open("./6/input.txt") as inputFile:
for line in inputFile:
line = line.replace("\n","")
if len(line) > 0:
tempGroup.append(set(line))
else:
groupList.append(tempGroup)
tempGroup = []... | 3.265625 | 3 |
demo/gpnas/CVPR2021_NAS_competition_gpnas_demo.py | ZichaoGuo/PaddleSlim | 926 | 8203 | <filename>demo/gpnas/CVPR2021_NAS_competition_gpnas_demo.py
# Copyright (c) 2021 PaddlePaddle 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.a... | 1.921875 | 2 |
pages/migrations/0004_auto_20181102_0944.py | yogeshprasad/spa-development | 0 | 8204 | <reponame>yogeshprasad/spa-development<gh_stars>0
# Generated by Django 2.0.6 on 2018-11-02 09:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pages', '0003_coachingcourse'),
]
operations = [
migrations.AlterField(
model_... | 1.484375 | 1 |
imageclassification/src/sample/splitters/_StratifiedSplitter.py | waikato-datamining/keras-imaging | 0 | 8205 | from collections import OrderedDict
from random import Random
from typing import Set
from .._types import Dataset, Split, LabelIndices
from .._util import per_label
from ._RandomSplitter import RandomSplitter
from ._Splitter import Splitter
class StratifiedSplitter(Splitter):
"""
TODO
"""
def __init_... | 2.75 | 3 |
revenuecat_python/enums.py | YuraHavrylko/revenuecat_python | 1 | 8206 | <reponame>YuraHavrylko/revenuecat_python
from enum import Enum
class SubscriptionPlatform(Enum):
ios = 'ios'
android = 'android'
macos = 'macos'
uikitformac = 'uikitformac'
stripe = 'stripe'
class AttributionNetworkCode(Enum):
apple_search_ads = 0
adjust = 1
apps_flyer = 2
branch... | 2.3125 | 2 |
windows_packages_gpu/torch/nn/intrinsic/qat/modules/linear_relu.py | codeproject/DeepStack | 353 | 8207 | from __future__ import absolute_import, division, print_function, unicode_literals
import torch.nn.qat as nnqat
import torch.nn.intrinsic
import torch.nn.functional as F
class LinearReLU(nnqat.Linear):
r"""
A LinearReLU module fused from Linear and ReLU modules, attached with
FakeQuantize modules f... | 2.765625 | 3 |
venv/Lib/site-packages/PyOpenGL-3.0.1/OpenGL/GL/EXT/draw_buffers2.py | temelkirci/Motion_Editor | 1 | 8208 | <reponame>temelkirci/Motion_Editor
'''OpenGL extension EXT.draw_buffers2
This module customises the behaviour of the
OpenGL.raw.GL.EXT.draw_buffers2 to provide a more
Python-friendly API
Overview (from the spec)
This extension builds upon the ARB_draw_buffers extension and provides
separate blend enables and co... | 1.742188 | 2 |
pymemcache/client/retrying.py | liquidpele/pymemcache | 0 | 8209 | """ Module containing the RetryingClient wrapper class. """
from time import sleep
def _ensure_tuple_argument(argument_name, argument_value):
"""
Helper function to ensure the given arguments are tuples of Exceptions (or
subclasses), or can at least be converted to such.
Args:
argument_name: s... | 3.21875 | 3 |
8.1.py | HuaichenOvO/EIE3280HW | 0 | 8210 | <reponame>HuaichenOvO/EIE3280HW
import numpy as np
import numpy.linalg as lg
A_mat = np.matrix([
[0, 1, 1, 1, 0],
[1, 0, 0, 0, 1],
[1, 0, 0, 1, 1],
[1, 0, 1, 0, 1],
[0, 1, 1, 1, 0]
])
eigen = lg.eig(A_mat) # return Arr[5] with 5 different linear independent eigen values
vec = eigen[1... | 2.734375 | 3 |
classroom/migrations/0025_myfile_file.py | Abulhusain/E-learing | 5 | 8211 | # Generated by Django 2.2.2 on 2019-08-25 09:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('classroom', '0024_auto_20190825_1723'),
]
operations = [
migrations.AddField(
model_name='myfile',
name='file',
... | 1.554688 | 2 |
jumbo_api/objects/profile.py | rolfberkenbosch/python-jumbo-api | 3 | 8212 | <filename>jumbo_api/objects/profile.py
from jumbo_api.objects.store import Store
class Profile(object):
def __init__(self, data):
self.id = data.get("identifier")
self.store = Store(data.get("store"))
def __str__(self):
return f"{self.id} {self.store}"
| 2.5625 | 3 |
tmp/real_time_log_analy/logWatcher.py | hankai17/test | 7 | 8213 | <gh_stars>1-10
#!/usr/bin/env python
import os
import sys
import time
import errno
import stat
import datetime
import socket
import struct
import atexit
import logging
#from lru import LRUCacheDict
from logging import handlers
from task_manager import Job, taskManage
from ctypes import *
from urlparse import *
from m... | 2.125 | 2 |
lazyblacksmith/views/ajax/__init__.py | jonathonfletcher/LazyBlacksmith | 49 | 8214 | # -*- encoding: utf-8 -*-
from flask import request
from lazyblacksmith.utils.request import is_xhr
import logging
logger = logging.getLogger('lb.ajax')
def is_not_ajax():
"""
Return True if request is not ajax
This function is used in @cache annotation
to not cache direct call (http 40... | 2.359375 | 2 |
src/automata_learning_with_policybank/Traces.py | logic-and-learning/AdvisoRL | 4 | 8215 | import os
class Traces:
def __init__(self, positive = set(), negative = set()):
self.positive = positive
self.negative = negative
"""
IG: at the moment we are adding a trace only if it ends up in an event.
should we be more restrictive, e.g. consider xxx, the same as xxxxxxxxxx (wher... | 3.5625 | 4 |
example/comp/urls.py | edwilding/django-comments-xtd | 0 | 8216 | import django
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
if django.VERSION[:2] > (1, 9):
from django.views.i18n import JavaScriptCatalog
else:
from django.views.i18n import javas... | 1.882813 | 2 |
09_multiprocessing/prime_validation/primes_factor_test.py | jumploop/high_performance_python | 0 | 8217 | <filename>09_multiprocessing/prime_validation/primes_factor_test.py<gh_stars>0
import math
import time
def check_prime(n):
if n % 2 == 0:
return False, 2
for i in range(3, int(math.sqrt(n)) + 1):
if n % i == 0:
return False, i
return True, None
if __name__ == "__main__":
... | 2.734375 | 3 |
python/test/test_dynamic_bitset.py | hagabb/katana | 0 | 8218 | import pytest
from katana.dynamic_bitset import DynamicBitset
__all__ = []
SIZE = 50
@pytest.fixture
def dbs():
return DynamicBitset(SIZE)
def test_set(dbs):
dbs[10] = 1
assert dbs[10]
def test_set_invalid_type(dbs):
try:
dbs[2.3] = 0
assert False
except TypeError:
p... | 2.171875 | 2 |
tests/basic/test_basic.py | kopp/python-astar | 133 | 8219 | import unittest
import astar
class BasicTests(unittest.TestCase):
def test_bestpath(self):
"""ensure that we take the shortest path, and not the path with less elements.
the path with less elements is A -> B with a distance of 100
the shortest path is A -> C -> D -> B with a distanc... | 3.8125 | 4 |
potions.py | abdza/skyrim_formulas | 0 | 8220 | #!/bin/env python3
import csv
def intersect(list1,list2):
list3 = [ value for value in list1 if value in list2]
return list3
def category(list1,effects):
cat = 'Good'
good = 0
bad = 0
for ing in list1:
if effects[ing]=='Good':
good += 1
else:
bad += 1
... | 3.359375 | 3 |
src/clients/ctm_api_client/models/user_additional_properties.py | IceT-M/ctm-python-client | 5 | 8221 | # coding: utf-8
"""
Control-M Services
Provides access to BMC Control-M Services # noqa: E501
OpenAPI spec version: 9.20.215
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from clients.ctm_api_client.conf... | 1.695313 | 2 |
Tests/Methods/Mesh/Interpolation/test_interpolation.py | harshasunder-1/pyleecan | 2 | 8222 | <filename>Tests/Methods/Mesh/Interpolation/test_interpolation.py<gh_stars>1-10
# -*- coding: utf-8 -*-
import pytest
import numpy as np
from unittest import TestCase
from pyleecan.Classes.CellMat import CellMat
from pyleecan.Classes.MeshSolution import MeshSolution
from pyleecan.Classes.PointMat import PointMat
from ... | 2.375 | 2 |
lib/models.py | ecarg/grace | 7 | 8223 | # -*- coding: utf-8 -*-
"""
Pytorch models
__author__ = 'Jamie (<EMAIL>)'
__copyright__ = 'No copyright. Just copyleft!'
"""
# pylint: disable=no-member
# pylint: disable=invalid-name
###########
# imports #
###########
import torch
import torch.nn as nn
from embedder import Embedder
from pos_models import PosTag... | 2.71875 | 3 |
pyseqlogo/__init__.py | BioGeek/pyseqlogo | 24 | 8224 | <filename>pyseqlogo/__init__.py
# -*- coding: utf-8 -*-
"""Top-level package for pyseqlogo."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
from .pyseqlogo import draw_logo
from .pyseqlogo import setup_axis
| 1.15625 | 1 |
setup.py | edulix/apscheduler | 0 | 8225 | # coding: utf-8
import os.path
try:
from setuptools import setup
extras = dict(zip_safe=False, test_suite='nose.collector', tests_require=['nose'])
except ImportError:
from distutils.core import setup
extras = {}
import apscheduler
here = os.path.dirname(__file__)
readme_path = os.path.join(here, 'R... | 1.359375 | 1 |
object_detection/exporter_test.py | travisyates81/object-detection | 1 | 8226 | <reponame>travisyates81/object-detection
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# <NAME>
"""Tests for object_detection.export_inference_graph."""
import os
import mock
import numpy as np
import tensorflow as tf
from object_detection import exporter
from object_detection.builders import model_b... | 2.265625 | 2 |
run.py | matthewyoung28/macmentum | 0 | 8227 | import os
import sys
import random
def get_next_wallpaper(curr_path):
lst_dir = os.listdir()
rand_index = random.randint(0, len(lst_dir) - 1)
return lst_dir[rand_index]
def get_wall_dir():
return "/Users/MYOUNG/Pictures/mmt"
def main():
script = "osascript -e 'tell application \"Finder\" to s... | 2.78125 | 3 |
noxfile.py | dolfno/mlops_demo | 0 | 8228 | """Automated CI tools to run with Nox"""
import nox
from nox import Session
locations = "src", "noxfile.py", "docs/conf.py"
nox.options.sessions = "lint", "tests"
@nox.session(python="3.9")
def tests(session: Session) -> None:
"""Run tests with nox"""
session.run("poetry", "install", external=True)
sessi... | 2.390625 | 2 |
cocotb_test/run.py | canerbulduk/cocotb-test | 0 | 8229 |
import cocotb_test.simulator
# For partial back compatibility
def run(simulator=None, **kwargs):
if simulator:
sim = simulator(**kwargs)
sim.run()
else:
cocotb_test.simulator.run(**kwargs)
| 1.6875 | 2 |
kanban_backend/project_management/apps.py | hamzabouissi/kanban_backend | 0 | 8230 | <filename>kanban_backend/project_management/apps.py
from django.apps import AppConfig
class ProjectManagementConfig(AppConfig):
name = 'kanban_backend.project_management'
def ready(self):
try:
import kanban_backend.users.signals # noqa F401
except ImportError:
pass
| 1.21875 | 1 |
src/framework/tracing.py | davidhozic/Discord-Shiller | 12 | 8231 | <reponame>davidhozic/Discord-Shiller
"""
~ Tracing ~
This modules containes functions and classes
related to the console debug long or trace.
"""
from enum import Enum, auto
import time
__all__ = (
"TraceLEVELS",
"trace"
)
m_use_debug = None
class TraceLEVELS(Enum):
"""
Info: Level ... | 2.609375 | 3 |
sunkit_image/__init__.py | jeffreypaul15/sunkit-image | 0 | 8232 | <gh_stars>0
"""
sunkit-image
============
A image processing toolbox for Solar Physics.
* Homepage: https://sunpy.org
* Documentation: https://sunkit-image.readthedocs.io/en/latest/
"""
import sys
from .version import version as __version__ # NOQA
# Enforce Python version check during package import.
__minimum_pyt... | 1.914063 | 2 |
app/view.py | lucasblazzi/stocker | 0 | 8233 | <gh_stars>0
import plotly.graph_objects as go
import plotly.express as px
import pandas as pd
class View:
def __init__(self, st):
self.st = st
self.st.set_page_config(layout='wide')
self.side_bar = st.sidebar
def show_message(self, location, _type, message):
if location == "sb"... | 2.5625 | 3 |
ch_4/stopping_length.py | ProhardONE/python_primer | 51 | 8234 | # Exercise 4.11
# Author: <NAME>
import sys
g = 9.81 # acceleration due to gravity
try:
# initial velocity (convert to m/s)
v0 = (1000. / 3600) * float(sys.argv[1])
mu = float(sys.argv[2]) # coefficient of friction
except IndexError:
print 'Both v0 (in km/s) and mu must be supplied on the command li... | 3.625 | 4 |
TestFiles/volumioTest.py | GeorgeIoak/Oden | 0 | 8235 | <filename>TestFiles/volumioTest.py
# Testing code to check update status on demand
from socketIO_client import SocketIO, LoggingNamespace
from threading import Thread
socketIO = SocketIO('localhost', 3000)
status = 'pause'
def on_push_state(*args):
print('state', args)
global status, position, duratio... | 2.53125 | 3 |
examples/DeepWisdom/Auto_NLP/deepWisdom/transformers_/__init__.py | zichuan-scott-xu/automl-workflow | 3 | 8236 | __version__ = "2.1.1"
# Work around to update TensorFlow's absl.logging threshold which alters the
# default Python logging output behavior when present.
# see: https://github.com/abseil/abseil-py/issues/99
# and: https://github.com/tensorflow/tensorflow/issues/26691#issuecomment-500369493
try:
import absl.logging... | 1.984375 | 2 |
src/use-model.py | sofieditmer/self-assigned | 0 | 8237 | #!/usr/bin/env python
"""
Info: This script loads the model trained in the cnn-asl.py script and enables the user to use it for classifying unseen ASL letters. It also visualizes the feature map of the last convolutional layer of the network to enable the user to get an insight into exactly which parts of the original ... | 3.421875 | 3 |
examples/hello_world/src/Algorithm.py | algorithmiaio/algorithmia-adk-python | 4 | 8238 | from Algorithmia import ADK
# API calls will begin at the apply() method, with the request body passed as 'input'
# For more details, see algorithmia.com/developers/algorithm-development/languages
def apply(input):
# If your apply function uses state that's loaded into memory via load, you can pass that loaded s... | 3.375 | 3 |
src/gluonts/nursery/autogluon_tabular/estimator.py | Xiaoxiong-Liu/gluon-ts | 2,648 | 8239 | # Copyright 2018 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | 2.578125 | 3 |
src/dcar/errors.py | andreas19/dcar | 1 | 8240 | <filename>src/dcar/errors.py
"""Errors module."""
__all__ = [
'Error',
'AddressError',
'AuthenticationError',
'TransportError',
'ValidationError',
'RegisterError',
'MessageError',
'DBusError',
'SignatureError',
'TooLongError',
]
class Error(Exception):
"""Base class."""
... | 2.546875 | 3 |
Packs/CortexXDR/Integrations/XDR_iocs/XDR_iocs_test.py | SergeBakharev/content | 1 | 8241 | from XDR_iocs import *
import pytest
from freezegun import freeze_time
Client.severity = 'INFO'
client = Client({'url': 'test'})
def d_sort(in_dict):
return sorted(in_dict.items())
class TestGetHeaders:
@freeze_time('2020-06-01T00:00:00Z')
def test_sanity(self, mocker):
"""
Given:
... | 2.234375 | 2 |
project/users/models.py | rchdlps/django-docker | 0 | 8242 | <gh_stars>0
from django.contrib.auth.models import AbstractUser
from django.db.models import CharField
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.db import models
from PIL import Image
class User(AbstractUser):
# First Name and Last Name do not cover name ... | 2.265625 | 2 |
cloudify_terminal_sdk/netconf_connection.py | cloudify-incubator/cloudify-plugins-sdk | 1 | 8243 | <reponame>cloudify-incubator/cloudify-plugins-sdk
# Copyright (c) 2015-2020 Cloudify Platform Ltd. 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.apa... | 1.734375 | 2 |
Seismic_Conv1D_dec.py | dyt1990/Seis_DCEC | 1 | 8244 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 19 17:48:13 2018
@author: Sediment
"""
# -*- coding: utf-8 -*-
'''
Keras implementation of deep embedder to improve clustering, inspired by:
"Unsupervised Deep Embedding for Clustering Analysis" (Xie et al, ICML 2016)
Definition can accept som... | 2.28125 | 2 |
ppq/utils/round.py | xiguadong/ppq | 0 | 8245 | from decimal import ROUND_HALF_DOWN, ROUND_HALF_EVEN, ROUND_HALF_UP, Decimal
from math import ceil, floor, log2
from typing import Union
import torch
from ppq.core import RoundingPolicy
def ppq_numerical_round(value: float,
policy: RoundingPolicy=RoundingPolicy.ROUND_HALF_EVEN) -> int:
"""
reference... | 2.984375 | 3 |
python/repair/train.py | maropu/scavenger | 0 | 8246 | <filename>python/repair/train.py
#!/usr/bin/env python3
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apac... | 1.867188 | 2 |
howl/roomsensor/urls.py | volzotan/django-howl | 0 | 8247 | from django.conf.urls import patterns, url
from roomsensor import views
urlpatterns = patterns('',
url(r'^$', views.index, name='roomsensor'),
# ex: /roomsensor/name/
url(r'^(?P<roomsensor_name>\w+)/$', views.display, name='roomsensor_display'),
url(r'^(?P<roomsensor_name>\w+)/read/$', views.read, na... | 2.09375 | 2 |
main.py | vu-telab/DAKOTA-moga-post-processing-tool | 0 | 8248 | # main.py
#
# currently just an example script I use to test my optimization_results module
#
# WARNING: design point numbers 0-indexed in pandas database, but
# eval_id column is the original 1-indexed value given by DAKOTA
import optimization_results as optr
def main():
a4 = optr.MogaOptimizationResults()
... | 2.171875 | 2 |
Topaz/Core.py | Rhodolite/Gem.py.UnitTest | 0 | 8249 | #
# Copyright (c) 2017 <NAME>. All rights reserved.
#
@gem('Topaz.Core')
def gem():
require_gem('Gem.Global')
from Gem import gem_global
gem_global.testing = true
require_gem('Gem.Cache2')
require_gem('Gem.DumpCache')
require_gem('Gem.GeneratedConjureQuadruple')
require_gem('Gem.Map... | 1.789063 | 2 |
app.py | kosovojs/wikibooster | 0 | 8250 | <gh_stars>0
import flask
from flask import Flask
from flask import jsonify
from flask import request
from flask_cors import CORS, cross_origin
from flask import render_template
import mwoauth
import requests_oauthlib
import os
import yaml
import mwapi
from tasks.main import Tasks
from save import Save
from db import ... | 2.359375 | 2 |
pre_embed.py | shelleyyyyu/few_shot | 253 | 8251 | import numpy as np
from collections import defaultdict, Counter
import random
import json
from tqdm import tqdm
def transX(dataset):
rel2id = json.load(open(dataset + '/relation2ids'))
ent2id = json.load(open(dataset + '/ent2ids'))
with open('../Fast-TransX/' + dataset + '_base/entity2id.txt', 'w') as... | 2.21875 | 2 |
botc/gamemodes/troublebrewing/FortuneTeller.py | Xinverse/BOTC-Bot | 1 | 8252 | <filename>botc/gamemodes/troublebrewing/FortuneTeller.py<gh_stars>1-10
"""Contains the Fortune Teller Character class"""
import json
import random
import discord
import datetime
from botc import Action, ActionTypes, Townsfolk, Character, Storyteller, RedHerring, \
RecurringAction, Category, StatusList
from botc.B... | 2.703125 | 3 |
src/schmetterling/build/tests/test_maven.py | bjuvensjo/schmetterling | 0 | 8253 | <filename>src/schmetterling/build/tests/test_maven.py
from unittest.mock import call, MagicMock, patch
from schmetterling.build.maven import build_multi_modules
from schmetterling.build.maven import create_build_result
from schmetterling.build.maven import create_command
from schmetterling.build.maven import create_mu... | 2.140625 | 2 |
Copados y Clases/Mastermind_DEBUG.py | FdelMazo/7540rw-Algo1 | 1 | 8254 | <filename>Copados y Clases/Mastermind_DEBUG.py
#Sacar las lineas con DEBUG para que el juego funcione
import random
DIGITOS = 4
def mastermind():
"""Funcion principal del juego Mastermind"""
print("Bienvenido al Mastermind!")
print("Instrucciones: Tenes que adivinar un codigo de {} digitos distintos. Tu cant... | 3.875 | 4 |
setup.py | ovnicraft/runa | 5 | 8255 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open("README.rst") as readme_file:
readme = readme_file.read()
with open("HISTORY.rst") as history_file:
history = history_file.read()
requirements = ["Click>=6.0", "suds2==0.7.1"]
setup_... | 1.5 | 2 |
PyPortal_User_Interface/code.py | RichardA1/Adafruit_Learning_System_Guides | 1 | 8256 | import time
import board
import displayio
import busio
from analogio import AnalogIn
import neopixel
import adafruit_adt7410
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text.label import Label
from adafruit_button import Button
import adafruit_touchscreen
from adafruit_pyportal import PyPortal
#... | 2.640625 | 3 |
btse_futures/order.py | yottatix/btse-python | 0 | 8257 | import json
from btse_futures.constants import OrderType, Side, TimeInForce
class Order:
"""
Class to represent a BTSE Order
...
Attributes
----------
size : int
order quantity or size. e.g. 1
price : float
price. e.g. 7000.0
side: str
order side. B... | 2.875 | 3 |
tests/mock_responses.py | md-reddevil/blinkpy | 0 | 8258 | <filename>tests/mock_responses.py
"""Simple mock responses definitions."""
from blinkpy.helpers.util import BlinkURLHandler
import blinkpy.helpers.constants as const
LOGIN_RESPONSE = {
'region': {'mock': 'Test'},
'networks': {
'1234': {'name': 'test', 'onboarded': True}
},
'authtoken': {'autht... | 2.546875 | 3 |
fits_tools.py | steveschulze/Photometry | 6 | 8259 | from astropy import coordinates as coord
from astropy import wcs
from astropy.io import fits
from astropy import units as u
from misc import bcolors
import numpy as np
import os
def convert_hms_dd(RA, DEC):
'''
Convert HMS to DD system
'''
if (':' in RA) and (':' in DEC):
Coord_dd = coord.SkyCoord(RA, DEC... | 2.5625 | 3 |
test_stbp_snn_eval.py | neurom-iot/n3ml | 11 | 8260 | <reponame>neurom-iot/n3ml
import argparse
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
from n3ml.model import DynamicModel_STBP_SNN
def validate(val_loader, model, encoder, criterion, opt):
model.eval()
total_images = 0
num_corrects = 0
total_los... | 2.234375 | 2 |
section_07_(files)/read_csv.py | govex/python-lessons | 5 | 8261 | # If you're new to file handling, be sure to check out with_open.py first!
# You'll also want to check out read_text.py before this example. This one is a bit more advanced.
with open('read_csv.csv', 'r') as states_file:
# Instead of leaving the file contents as a string, we're splitting the file into a list... | 4.25 | 4 |
kaggle_melanoma/schedulers.py | tinve/kaggle_melanoma | 8 | 8262 | import math
from torch.optim.lr_scheduler import _LRScheduler
from torch.optim.optimizer import Optimizer
class PolyLR(_LRScheduler):
"""
Sets the learning rate of each parameter group according to poly learning rate policy
"""
def __init__(self, optimizer, max_iter=90000, power=0.9, last_epoch=-1):... | 2.421875 | 2 |
data/data/__init__.py | PumpkinYing/GAT | 0 | 8263 | from .dataset import load_data | 1.078125 | 1 |
utils.py | federicosapienza/InboxNotionTelegramBot | 0 | 8264 | import json
import logging
logger = logging.getLogger(__name__)
with open('configuration.json') as f:
config = json.load(f)
TELEGRAM_TOKEN = config["telegram-bot-token"]
NOTION_TOKEN = config["notion-token"]
NOTION_TABLE_URL = config["inbox_table"]["table_url"]
def check_allowed_user(user_id):
"""
chec... | 2.515625 | 3 |
enaml/core/byteplay/__init__.py | timgates42/enaml | 0 | 8265 | <reponame>timgates42/enaml
#------------------------------------------------------------------------------
# Copyright (c) 2013-2018, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------... | 1.46875 | 1 |
cassiopeia/datastores/riotapi/match.py | artemigkh/cassiopeia | 1 | 8266 | from time import time
from typing import Type, TypeVar, MutableMapping, Any, Iterable, Generator, Union
import arrow
import datetime
import math
from datapipelines import DataSource, PipelineContext, Query, NotFoundError, validate_query
from .common import RiotAPIService, APINotFoundError
from ...data import Platform... | 2.140625 | 2 |
Lib/site-packages/hackedit/vendor/jedi/cache.py | fochoao/cpython | 1 | 8267 | """
This caching is very important for speed and memory optimizations. There's
nothing really spectacular, just some decorators. The following cache types are
available:
- module caching (`load_parser` and `save_parser`), which uses pickle and is
really important to assure low load times of modules like ``numpy``.
-... | 3.203125 | 3 |
sandia_hand/ros/sandia_hand_teleop/simple_grasp/simple_grasp.py | adarshrs/Drone-Simulator-for-ROS-Kinetic | 0 | 8268 | <reponame>adarshrs/Drone-Simulator-for-ROS-Kinetic
#!/usr/bin/env python
#
# Software License Agreement (Apache License)
#
# Copyright 2013 Open Source Robotics Foundation
# Author: <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... | 1.96875 | 2 |
ui/ui_prestamo_libros.py | edzzn/Manejo_Liberia | 0 | 8269 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'PrestamoDeLibros.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromU... | 1.851563 | 2 |
src/zope/app/content/__init__.py | zopefoundation/zope.app.content | 0 | 8270 | <reponame>zopefoundation/zope.app.content<filename>src/zope/app/content/__init__.py
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# ... | 1.640625 | 2 |
python-modules/robcoewmrobotconfigurator/robcoewmrobotconfigurator/run.py | yschiebelhut/ewm-cloud-robotics | 0 | 8271 | <filename>python-modules/robcoewmrobotconfigurator/robcoewmrobotconfigurator/run.py
#!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
#
# This file is part of ewm-cloud-robotics
# (see https://github.com/SAP/ewm-cloud-robotics).
#
# This file is lic... | 2.359375 | 2 |
website/addons/forward/views/__init__.py | DanielSBrown/osf.io | 1 | 8272 | from . import config, widget # noqa
| 1.070313 | 1 |
hwtest/automated/usb3_test.py | crvallance/wlanpi-hwtest | 0 | 8273 | from hwtest.shell_utils import run_command
def test_linux_usb3hub():
"""
Test for Linux Foundation 3.0 root hub in `lsusb` output
"""
resp = run_command(["lsusb"])
assert "1d6b:0003" in resp
| 1.96875 | 2 |
ninjabackend.py | tp-m/meson | 0 | 8274 | # Copyright 2012-2014 The Meson development team
# 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.90625 | 2 |
tests/strategies/common/test_cputime.py | y-tetsu/othello | 10 | 8275 | """Tests of cputime.py
"""
import unittest
from reversi.strategies.common import CPU_TIME
class TestCputime(unittest.TestCase):
"""cputime
"""
def test_cputime(self):
self.assertEqual(CPU_TIME, 0.5)
| 2.3125 | 2 |
experiments/cifar10_recon.py | coopersigrist/RecurrentNeuralSystem- | 3 | 8276 | <reponame>coopersigrist/RecurrentNeuralSystem-
# -*- coding: utf-8 -*-
"""ReNS experiments - CIFAR10
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1byZ4xTfCK2x1Rhkxpl-Vv4sqA-bo4bis
# SETUP
"""
#@title Insatlling Pyorch
# !pip install torch
# !pip i... | 2.296875 | 2 |
horizon/forms/__init__.py | ameoba/horizon | 2 | 8277 | <gh_stars>1-10
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, Inc.
#
# 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/L... | 1.148438 | 1 |
heat/tests/test_rpc_listener_client.py | noironetworks/heat | 1 | 8278 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | 2.1875 | 2 |
amadeus/travel/trip_parser_jobs/_status.py | akshitsingla/amadeus-python | 125 | 8279 | <reponame>akshitsingla/amadeus-python<gh_stars>100-1000
from amadeus.client.decorator import Decorator
class TripParserStatus(Decorator, object):
def __init__(self, client, job_id):
Decorator.__init__(self, client)
self.job_id = job_id
def get(self, **params):
'''
Returns the ... | 2.6875 | 3 |
tools/third_party/iniconfig/testing/test_iniconfig.py | meyerweb/wpt | 2,479 | 8280 | <gh_stars>1000+
import py
import pytest
from iniconfig import IniConfig, ParseError, __all__ as ALL
from iniconfig import iscommentline
from textwrap import dedent
check_tokens = {
'section': (
'[section]',
[(0, 'section', None, None)]
),
'value': (
'value = 1',
[(0, None, ... | 2.453125 | 2 |
jskparser/jskparser/util.py | natebragg/java-sketch | 15 | 8281 | import os
from subprocess import call
from . import glob2
pwd = os.path.dirname(__file__)
def get_files_from_path(path, ext):
# use set to remove duplicate files. weird...but it happens
if os.path.isfile(path): return set([os.path.abspath(path)])
else: # i.e., folder
files = glob2.glob(os.path.a... | 2.609375 | 3 |
fiftyone/core/patches.py | SNeugber/fiftyone | 0 | 8282 | """
Patches views.
| Copyright 2017-2021, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
from copy import deepcopy
import eta.core.utils as etau
import fiftyone.core.aggregations as foa
import fiftyone.core.dataset as fod
import fiftyone.core.fields as fof
import fiftyone.core.labels as fol
import fifty... | 1.953125 | 2 |
{{cookiecutter.repo_name}}/setup.py | ocesaulo/cookiecutter-ocn_sci | 0 | 8283 | <filename>{{cookiecutter.repo_name}}/setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
{%- set license_classifiers = {
'MIT license': 'License :: OSI Approved :: MIT ... | 1.546875 | 2 |
src/zope/app/debug/debug.py | zopefoundation/zope.app.debug | 0 | 8284 | ##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | 1.984375 | 2 |
transfer_learning.py | terryli710/SIIM-ACR-Pneumothorax-Classification | 0 | 8285 | <reponame>terryli710/SIIM-ACR-Pneumothorax-Classification
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 18 22:42:54 2020
@author: mike
"""
import numpy as np
import tensorflow as tf
from tensorflow import keras
from sklearn.model_selection import train_test_split
from tensorflow.keras.applica... | 2.25 | 2 |
core/tests/test_polyflow/test_workflows/test_hyperband.py | erexer/polyaxon | 0 | 8286 | <reponame>erexer/polyaxon
#!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, Inc.
#
# 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
#
# Unle... | 1.84375 | 2 |
Class Work oop.py | fatimatswanya/fatimaCSC102 | 0 | 8287 |
class Student:
studentLevel = 'first year computer science 2020/2021 session'
studentCounter = 0
registeredCourse='csc102'
def __init__(self, thename, thematricno, thesex,thehostelname,theage,thecsc102examscore):
self.name = thename
self.matricno = thematricno
self.sex = thesex
... | 3.671875 | 4 |
clickhouse_sqlalchemy/drivers/reflection.py | Fozar/clickhouse-sqlalchemy | 0 | 8288 | <reponame>Fozar/clickhouse-sqlalchemy
from sqlalchemy.engine import reflection
from clickhouse_sqlalchemy import Table, engines
class ClickHouseInspector(reflection.Inspector):
def reflect_table(self, table, *args, **kwargs):
# This check is necessary to support direct instantiation of
# `clickho... | 2.21875 | 2 |
tests/test_disque.py | abdul-khalid/pydisque | 1 | 8289 | """
Unit Tests for the pydisque module.
Currently, most of these tests require a fresh instance of
Disque to be valid and pass.
"""
import unittest
import json
import time
import random
import six
from pydisque.client import Client
from redis.exceptions import ResponseError
class TestDisque(unittest.TestCase):
... | 2.828125 | 3 |
src/runner.py | samirsahoo007/Naive-Bayes-and-Decision-Tree-Classifiers | 1 | 8290 | # -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ runner.py ]
# Synopsis [ main program that runs the 'Naive Bayes' and 'Decision Tree' training / testing ]
# Author [ <NAME> (Andi611) ]
# Copyright [ Copyl... | 2.375 | 2 |
igibson/metrics/agent.py | Nick-AhSen/iGibson | 0 | 8291 | import copy
import numpy as np
import pybullet as p
from igibson.metrics.metric_base import MetricBase
class BehaviorRobotMetric(MetricBase):
def __init__(self):
self.initialized = False
self.state_cache = {}
self.next_state_cache = {}
self.agent_pos = {part: [] for part in ["l... | 2.171875 | 2 |
fontslice/__init__.py | Arahabica/font-subset-css | 0 | 8292 | <filename>fontslice/__init__.py<gh_stars>0
import sys
from .main import (
_chunk_list,
_get_unicode_range_hash,
convert_unicode_range,
get_120_unicode_ranges,
get_unicode_ranges_from_text,
generate_css,
main,
)
__all__ = [
"_chunk_list",
"_get_unicode_range_hash",
"convert_unico... | 1.804688 | 2 |
src/ttkbootstrap/dialogs/dialogs.py | MrJaatt/ttkbootstrap | 1 | 8293 | <filename>src/ttkbootstrap/dialogs/dialogs.py<gh_stars>1-10
"""
This module contains various base dialog base classes that can be
used to create custom dialogs for the end user.
These classes serve as the basis for the pre-defined static helper
methods in the `Messagebox`, and `Querybox` container cl... | 2.8125 | 3 |
Google-Play-Store-App-Rating/code.py | venky4121994/ga-learner-dsmp-repo | 0 | 8294 | <gh_stars>0
# --------------
#Importing header files
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#Code starts here
data = pd.read_csv(path)
data.hist(['Rating'])
data = data[data['Rating']<=5]
data.hist(['Rating'])
#Code ends here
# --------------
# code starts here
total_null = dat... | 2.828125 | 3 |
converters/brat2iob.py | Banguiskode/nerds | 15 | 8295 | import argparse
import operator
import os
import re
import shutil
import spacy
import tempfile
from nerds.utils import spans_to_tokens, get_logger
def segment_text_to_sentences(text_file, sentence_splitter):
""" Segment text into sentences. Text is provided by BRAT in .txt
file.
Args:
... | 3.046875 | 3 |
kraken/lib/util.py | zjsteyn/kraken | 1 | 8296 | """
Ocropus's magic PIL-numpy array conversion routines. They express slightly
different behavior from PIL.Image.toarray().
"""
import unicodedata
import numpy as np
from PIL import Image
__all__ = ['pil2array', 'array2pil']
def pil2array(im: Image.Image, alpha: int = 0) -> np.array:
if im.mode == '1':
... | 3.171875 | 3 |
analysis/calculate_holding_amount.py | hao44le/ico_top_holder_analysis | 538 | 8297 | import sys
sys.path.insert(0,'..')
from data.whale_data import exchnage_accounts
from data.html_helper import check_if_address_name_exists
from data.whale_eth_tx_data import *
from data.whale_token_tx_data import identify_investor_type_token
holding_account = "holding_account"
deposit_account = 'deposit_account'
withd... | 2.21875 | 2 |
textbox/trainer/trainer.py | JBoRu/TextBox-1 | 1 | 8298 | # @Time : 2020/11/14
# @Author : <NAME>, <NAME>
# @Email : <EMAIL>
# UPDATE:
# @Time : 2020/12/2, 2020/11/27, 2020/12/3, 2020/12/26
# @Author : <NAME>, <NAME>, <NAME>, <NAME>
# @Email : <EMAIL>, <EMAIL>, <EMAIL>, <EMAIL>
r"""
textbox.trainer.trainer
################################
"""
import os
import torch
i... | 2.9375 | 3 |
rsserpent/plugins/builtin/__init__.py | EurusEurus/RSSerpent | 0 | 8299 | from ...models import Persona, Plugin
from . import example, example_cache, example_ratelimit, example_with_args
plugin = Plugin(
name="rsserpent-plugin-builtin",
author=Persona(
name="queensferryme",
link="https://github.com/queensferryme",
email="<EMAIL>",
),
repository="http... | 1.78125 | 2 |