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 |
|---|---|---|---|---|---|---|
tests/test_blue_dot.py | webknjaz/BlueDot | 0 | 12778551 | from bluedot import MockBlueDot, BlueDotSwipe, BlueDotRotation
from time import sleep
from threading import Event, Thread
def test_default_values():
mbd = MockBlueDot()
assert mbd.device == "hci0"
assert mbd.port == 1
assert mbd.running
assert mbd.print_messages
assert mbd.double_press_time ==... | 2.359375 | 2 |
src/models/k_mean.py | tringn/image_clustering | 5 | 12778552 | <reponame>tringn/image_clustering<filename>src/models/k_mean.py
import os
import numpy as np
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
import pandas as pd
import json
def p... | 3 | 3 |
src/data_providing_module/data_providers/split_block_provider.py | Freitacr/ML-StockAnalysisProject | 0 | 12778553 | """Data Provider module for providing data blocks made from similar stocks over a set time period, but separated.
This data provider is not intended to be used outside of this module, instead, upon import, this module will create an
instance of a SplitBlockProvider and register it with the global DataProviderRegist... | 2.78125 | 3 |
aiakos/urls.py | aiakos/aiakos | 4 | 12778554 | <reponame>aiakos/aiakos
"""project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='... | 2.71875 | 3 |
AmbidexteriousBounce.py | l0vemachin3/AmbidexteriousBounce | 0 | 12778555 | <gh_stars>0
from tkinter import *
import random
import time
class Ball:
def __init__(self, canvas, paddle, paddle2, color):
self.canvas = canvas
self.paddle = paddle
self.paddle2 = paddle2
self.id = canvas.create_oval(10, 10, 25, 25, fill=color)
self.canvas.mo... | 3.3125 | 3 |
Python/lc_13.py | cmattey/leetcode_problems | 6 | 12778556 | <gh_stars>1-10
# 13. Roman to Integer
# Time: O(len(s))
# Space: O(1)
class Solution:
def romanToInt(self, s: str) -> int:
roman_map = {'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000,
'IV':4,'IX':9,
'XL':40,'XC':90,
'CD':400,'CM':900}
... | 3.234375 | 3 |
PEtab_problems/Code/Tumor_2d/tumor_script.py | EmadAlamoudi/FMC_paper | 0 | 12778557 | <gh_stars>0
from time import time
import tumor2d
from fitmulticell.sumstat import SummaryStatistics as ss
import matplotlib.pyplot as plt
from string import capwords
import os
import pyabc
from fitmulticell.model import MorpheusModel
import numpy as np
import scipy
def eucl_dist(sim, obs):
total = 0
for key ... | 2.03125 | 2 |
policykit/integrations/metagov/views.py | hozzjss/policykit | 1 | 12778558 | <filename>policykit/integrations/metagov/views.py
import json
import logging
from django.contrib.auth.models import ContentType, Permission
from django.contrib.contenttypes.models import ContentType
from django.http import (
HttpResponse,
HttpResponseBadRequest,
HttpResponseServerError,
HttpResponseNot... | 1.921875 | 2 |
piper/test/test_verbs.py | miketarpey/piper | 0 | 12778559 | <filename>piper/test/test_verbs.py
from piper.custom import to_julian
from piper.factory import dummy_dataframe
from piper.factory import sample_column_clean_text
from piper.factory import sample_data
from piper.factory import sample_phone_sales
from piper.factory import sample_sales
from piper.factory import simple_se... | 2.203125 | 2 |
wui/version_static_files.py | kspar/easy | 3 | 12778560 | import sys
import time
def create_versioned_files(src_filename, filenames):
timestamp = int(time.time())
with open(src_filename, encoding='utf-8') as html_file:
html_file_content = html_file.read()
for filename in filenames:
usages_count = html_file_content.count(filename)
... | 3.03125 | 3 |
test/iterator.py | trK54Ylmz/rocksdb-py | 3 | 12778561 | <gh_stars>1-10
import unittest
import rocksdbpy
import shutil
import tempfile
from rocksdbpy import WriteBatch
class TestIterator(unittest.TestCase):
def setUp(self):
self.temp = tempfile.mkdtemp()
wb = WriteBatch()
# add couple of keys and values
wb.add(b'test_add_1', b'test_val... | 2.796875 | 3 |
setup.py | michellab/bgflow | 42 | 12778562 | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name="bgflow",
version="0.1",
description="Boltzmann Generators in PyTorch",
author="<NAME>, <NAME>, <NAME>, <NAME>",
author_email="<EMAIL>",
url="https://www.mi.fu-berlin.de/en/math/groups/comp-mol-bio/index.html",
p... | 1.375 | 1 |
notevault/configmanager.py | Sebastian-Hojas/sortnote | 1 | 12778563 | import os
class ConfigManager:
def __init__(self, path, dryrun, verbose):
self.path = path
self.dryrun = dryrun
self.verbose = verbose
self.config = []
try:
with open(self.path, 'r') as f:
self.config = [line.strip('\n').strip('\r') for line in f.... | 2.90625 | 3 |
utils.py | gyhdtc/QATM_pytorch | 0 | 12778564 | from __future__ import print_function, division
import matplotlib.pyplot as plt
import math
from sklearn.metrics import auc
import numpy as np
import cv2
import os, sys
int_ = lambda x: int(round(x))
def IoU( r1, r2 ):
x11, y11, w1, h1 = r1
x21, y21, w2, h2 = r2
x12 = x11 + w1; y12 = y11 + h1
x22 = x... | 2.296875 | 2 |
FlaskBackend/main_wallet_create.py | IKalonji/mbongo_algorand_wallet | 4 | 12778565 | <reponame>IKalonji/mbongo_algorand_wallet<filename>FlaskBackend/main_wallet_create.py
import http.client
from os import getenv
# import dotenv
from flask import json
# dotenv.load_dotenv()
# api_key = getenv('API_KEY')
class MainWallet():
def __init__(self):
self.key = ""
def initialize_wallet(self)... | 2.75 | 3 |
examples/scripts/compare_lithium_ion_particle_distribution.py | katiezzzzz/PyBaMM | 1 | 12778566 | #
# Compare lithium-ion battery models with and without particle size distibution
#
import numpy as np
import pybamm
pybamm.set_logging_level("INFO")
# load models
models = [
pybamm.lithium_ion.DFN(name="standard DFN"),
pybamm.lithium_ion.DFN(name="particle DFN"),
]
# load parameter values
params = [models[0... | 2.640625 | 3 |
Adapters.indigoPlugin/Contents/Server Plugin/pyrescaler/__init__.py | jdhorne/temperature-converter-indigo-plugin | 1 | 12778567 | <reponame>jdhorne/temperature-converter-indigo-plugin<filename>Adapters.indigoPlugin/Contents/Server Plugin/pyrescaler/__init__.py<gh_stars>1-10
__all__ = ["pyrescaler", "temperature_scale", "length_scale", "power_scale"]
| 1.335938 | 1 |
experiments/launcher_exp2_collect.py | MenshovSergey/DetectChess | 144 | 12778568 | <filename>experiments/launcher_exp2_collect.py
import os
import pandas as pd
from os2d.utils.logger import extract_value_from_os2d_binary_log, mAP_percent_to_points
if __name__ == "__main__":
config_path = os.path.dirname(os.path.abspath(__file__))
config_job_name = "exp2"
log_path = os.path.abspath(os.p... | 2.109375 | 2 |
src/onevision/nn/model/debugger.py | phlong3105/onevision | 2 | 12778569 | <reponame>phlong3105/onevision
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Debugger to save results during training.
"""
from __future__ import annotations
import threading
from queue import Queue
from typing import Optional
from torch import Tensor
from onevision.type import Callable
from onevision.utils imp... | 2.390625 | 2 |
src/contact/views.py | hvpandey91/CuteCub-PlaySchool-Python-3-Django | 0 | 12778570 | from django.shortcuts import render
from django.core.mail import send_mail
from django.conf import settings
# from .forms import contactForms
# Create your views here.
def contact(request):
context = locals()
template = 'contact.html'
return render(request,template,context)
'''def contact(request):
title = 'Conta... | 2.140625 | 2 |
scripts/positioning.py | metratec/ros_ips | 3 | 12778571 | #!/usr/bin/env python
"""
Use this node to perform indoor zone location using the metraTec IPS tracking system. Prerequisites for using this node
is a running receiver-node that handles communication with the receiver and thus with the beacons in the vicinity.
Also, make sure that you have defined your zones correctly ... | 2.71875 | 3 |
networking/netmiko/main.py | maciej233/PYTHON | 0 | 12778572 | <reponame>maciej233/PYTHON
#!/home/maciej/environments/networking/bin/python python3
from netmiko import ConnectHandler
r1 = {'device_type': 'cisco_ios', 'host': '172.26.1.1', 'username': 'cisco', 'password': '<PASSWORD>'}
net_connect = ConnectHandler(**r1)
prompt = net_connect.find_prompt()
output_int = net_connect.... | 2.453125 | 2 |
bradley_terry.py | BryanWBear/py_bradleyterry2 | 0 | 12778573 | <filename>bradley_terry.py
from itertools import combinations
import pandas as pd
from helper import *
import statsmodels.api as sm
def counts_to_binomial(df):
upper = matrix_to_triangular(df, upper=True)
lower = matrix_to_triangular(df, upper=False)
return upper.join(lower, on=['row', 'col']).reset_index()
d... | 2.53125 | 3 |
codeforces/anirudhak47/1352/C.py | anirudhakulkarni/codes | 3 | 12778574 | # cook your dish here
for t in range(int(input())):
#n=input()
n,k=map(int,input().split())
if n!=2:
temp=k
sum=k
flag=False
while temp>=n:
sum+=temp//n
temp=temp%n+temp//n
if k==1:
print(1)
else:
... | 3.1875 | 3 |
src/card/types.py | Urumasi/tgc-server | 0 | 12778575 | from enum import Enum
class CardType(Enum):
NONE = 0
ARTIFACT = 1
BATTLEFIELD = 2
CREATURE = 3
EVENT = 4
EQUIPMENT = 5
HUMAN = CREATURE # Why does this exist...
class CardSubtype(Enum):
NONE = 0
ABOMINATION = 1
ANOMALY = 2
ARMOUR = 3
ATMOSPHERICS = 4
CAT = 5
... | 2.828125 | 3 |
old-scripts/cluster-mgmt/bin/cho-failover.py | opennetworkinglab/spring-open | 6 | 12778576 | #! /usr/bin/env python
import json
import sys
import os
import re
from check_status import *
import time
basename=os.getenv("ONOS_CLUSTER_BASENAME")
operation=['switch all', 'onos stop 8', 'onos stop 7', 'onos stop 6', 'onos stop 5', 'onos start 5;onos start 6;onos start 7;onos start 8', 'switch local']
nr_controlle... | 2.28125 | 2 |
deconz-tool/deconz.py | JasperAlgra/ha-scripts | 0 | 12778577 | <filename>deconz-tool/deconz.py
#!/usr/bin/env python3
import getopt
import json
import logging
import os
import sys
import voluptuous as vol
import yaml
# from deconzapi import DeCONZAPI, DECONZ_TYPE_USEABLE, DECONZ_ATTR_TYPE
from deconzapi import *
#################################################################
... | 1.804688 | 2 |
sourcerer/base.py | LISTERINE/sourcerer | 0 | 12778578 | #!env/bin/python
import re
from numbers import Number
class Statement(object):
""" A line of code
A Statement is a line of code that may or may not have a child Scope
"""
def __init__(self, code='', scope=None, whitespace='', line_ending=''):
"""
self.code is the actual line of code ... | 4.3125 | 4 |
3-2D-Array/7/2d-array-advanced.py | xuxpp/Python-3-exercise | 0 | 12778579 | <filename>3-2D-Array/7/2d-array-advanced.py
def get_fibonaccis(cnt):
l = [0, 1]
for _ in range(cnt-2): # Deduct inital 2 numbers
l.append(l[-1] + l[-2])
return l
def is_perfect(n):
return sum([ x for x in range(1, n) if n % x == 0 ]) == n
def get_non_perfect_nums(cnt):
l = []
n = 1
... | 3.75 | 4 |
orion/app.py | brian123zx/orion-server | 120 | 12778580 | from flask import Flask
from flask import jsonify
from flask import request
from flask_cors import CORS
from raven.contrib.flask import Sentry
from orion.context import Context
from orion.handlers import handler_classes
def init_app(app):
"""
Statefully initialize the Flask application. This involves creatin... | 2.515625 | 3 |
plan/time_range.py | CodePeasants/pyplan | 0 | 12778581 | <reponame>CodePeasants/pyplan<filename>plan/time_range.py
# Python standard lib
from datetime import datetime
# Package
from plan.serializable import Serializable
from plan.settings import TIME_ZONE
class TimeRange(Serializable):
def __init__(self, start=None, end=None):
if start is None:
st... | 2.84375 | 3 |
src/train.py | lotusxai/join-house-prices-solutions-project | 1 | 12778582 | <gh_stars>1-10
import numpy as np
import pandas as pd
import predict
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import preprocessing
import time
from datetime import datetime
import warnings
import os
warnings.filterwarnings('ignore')
# ML libraries
import lightgbm as lgb
import xgboost as xgb... | 2.421875 | 2 |
Action/action_enum.py | arunimasundar/Supervised-Learning-of-Procedures | 0 | 12778583 | <gh_stars>0
from enum import Enum
class Actions(Enum):
"""
Actions enum
"""
# framewise_recognition.h5
# squat = 0
# stand = 1
# walk = 2
# wave = 3
# framewise_recognition_under_scene.h5
# stand = 0
# walk = 1
# operate = 2
# fall_down = 3
# run = 4
# squ... | 2.78125 | 3 |
tappmq/tappmq.py | isysd/tappmq | 0 | 12778584 | """
A simple message queue for TAPPs using Redis.
"""
import json
import time
from sqlalchemy_models import create_session_engine, setup_database, util, exchange as em, user as um, wallet as wm
from tapp_config import setup_redis, get_config, setup_logging
def subscription_handler(channel, client, mykey=None, auth=Fa... | 2.78125 | 3 |
saleor/graphql/order/mutations/fulfillment_refund_and_return_product_base.py | eanknd/saleor | 1,392 | 12778585 | from typing import Optional
import graphene
from django.core.exceptions import ValidationError
from ....giftcard.utils import order_has_gift_card_lines
from ....order import FulfillmentLineData
from ....order import models as order_models
from ....order.error_codes import OrderErrorCode
from ....order.fetch import Or... | 2.109375 | 2 |
ParamFit_27Jan.py | gshowalt/VirusPopModel | 0 | 12778586 | <filename>ParamFit_27Jan.py
# importing all modules
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from matplotlib import cm
import matplotlib.tri as tri
from matplotlib.colors import LogNorm
import matplotlib.patches as mpatches
from matplotlib.ticker im... | 2.5 | 2 |
aldryn_jobs/migrations/0001_initial.py | what-digital/aldryn-jobs | 1 | 12778587 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import app_data.fields
import djangocms_text_ckeditor.fields
from django.conf import settings
import cms.models.fields
import aldryn_jobs.models
import sortedm2m.fields
class Migration(migrations.M... | 1.859375 | 2 |
src/scrapers/main_scrape_brownslocum.py | aizaz-shahid/airflow-tutorial | 0 | 12778588 | <gh_stars>0
#!/usr/bin/env python
# coding: utf-8
"""
This script runs through the tempdent scraper.
Default url: 'https://portal.brownslocumlink.com/Jobs'
run is as:
nohup python3 main_scrape_brownslocum.py <your root password> |& tee $(date "+%Y.%m.%d-%H.%M.%S").brownslocum_logs.txt
"""
import random
import os
im... | 2.59375 | 3 |
mlprogram/synthesizers/filtered_synthesizer.py | HiroakiMikami/mlprogram | 9 | 12778589 | from typing import Callable, Generator, Generic, Optional, TypeVar
from mlprogram import logging
from mlprogram.synthesizers.synthesizer import Result, Synthesizer
logger = logging.Logger(__name__)
Input = TypeVar("Input")
Output = TypeVar("Output")
class FilteredSynthesizer(Synthesizer[Input, Output], Generic[Inp... | 2.9375 | 3 |
dbpool.py | powerQiu/phone_number_seg_spider | 1 | 12778590 | <gh_stars>1-10
from contextlib import contextmanager
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.pool import QueuePool
import config
class Pool:
engine = create_engine(
config.db_uri,
pool_size=config.db_pool_size,
pool_recycle=config.db_p... | 2.609375 | 3 |
easylogger/log.py | barretobrock/easylogger | 0 | 12778591 | import os
import sys
import logging
import traceback
from logging import Logger
from types import TracebackType
from typing import Union, Tuple, Optional
from .argparser import LogArgParser
from .handlers import CustomTimedRotatingFileHandler
class Log:
"""Initiates a logging object to record processes and errors... | 3.515625 | 4 |
oo/carro.py | SergioVenicio21/pythonbirds | 0 | 12778592 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
EX:
>>> motor = Motor()
>>> direcao = Direcao()
>>> carro = Carro(direcao, motor)
>>> carro.acelerar()
>>> print(carro.calcular_direcao())
norte
>>> carro.virar_direita()
>>> print(carro.calcular_direcao())
leste
>>> carro.virar_dir... | 4.03125 | 4 |
lib/angel/constants.py | jpotter/angel | 0 | 12778593 |
# Defines constants -- values that MUST NOT be overriden or modified by any code, and that aren't variable in any way.
# As a silly example, DAYS_IN_WEEK = 7 would always be defined here, but START_DAY_OF_WEEK is a variable (0 or 1) and thus would be defined in defaults.py.
# To use, just do:
# import angel.setting... | 2.234375 | 2 |
app/schemas/__init__.py | EZhivaikin/TrialPython | 0 | 12778594 | <reponame>EZhivaikin/TrialPython
from app.schemas.brand import Brand
from app.schemas.product import Product | 0.820313 | 1 |
tests/test_fastnumbers_examples.py | pterjan/fastnumbers | 0 | 12778595 | <gh_stars>0
# -*- coding: utf-8 -*-
# Find the build location and add that to the path
import math
import sys
from typing import Callable, Iterator, List, cast
import pytest
from pytest import raises
import fastnumbers
# Each conversion test should test the following
# 1. float number
# 2. signed float string
# 3. f... | 2.4375 | 2 |
fltk/datasets/distributed/__init__.py | tudelft-eemcs-dml/fltk-testbed-gr-5 | 0 | 12778596 | <filename>fltk/datasets/distributed/__init__.py
from .dataset import DistDataset
from .cifar10 import DistCIFAR10Dataset
# from .cifar100 import CIFAR100Dataset
# from .fashion_mnist import FashionMNISTDataset
| 1.242188 | 1 |
src/lib/python/util/injected_files.py | memes/f5-bigip-image-generator | 34 | 12778597 | <reponame>memes/f5-bigip-image-generator
"""Module to read info about injected files"""
# Copyright (C) 2019-2021 F5 Networks, 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://w... | 2.109375 | 2 |
kenja/detection/pull_up_method.py | umr00/kenja | 0 | 12778598 | from __future__ import absolute_import
from itertools import product, combinations
from git.objects import Blob
from collections import defaultdict
from kenja.historage import *
from kenja.shingles import calculate_similarity
def get_extends(commit, org_file_name, classes):
classes_path = '/[CN]/'.join(classes)
... | 2.09375 | 2 |
apps/TCPB_-_Expressions/src/smartdict.py | mkromer-tc/threatconnect-playbooks | 0 | 12778599 | <reponame>mkromer-tc/threatconnect-playbooks<filename>apps/TCPB_-_Expressions/src/smartdict.py
# -*- coding: utf-8 -*-
"""Smartdict -- smart dictionary for formatting strings"""
from string import Formatter
from attrdict import AttrDict
__notfound__ = object()
class SmartDict:
"""Smart dictionary object"""
... | 2.65625 | 3 |
tests/test_blast2xl.py | peterk87/blast2xl | 1 | 12778600 | #!/usr/bin/env python
"""Tests for `blast2xl` package."""
from os.path import abspath
from pathlib import Path
from click.testing import CliRunner
from blast2xl import cli
def test_command_line_interface():
"""Test the CLI."""
runner = CliRunner()
help_result = runner.invoke(cli.main, ['--help'])
... | 2.375 | 2 |
jlm/src/jlm/datastore.py | UnofficialJuliaMirror/JuliaManager.jl-0cdbb3b1-e653-5045-b8d5-b31a04c2a6c9 | 9 | 12778601 | <filename>jlm/src/jlm/datastore.py
import hashlib
import json
import os
from contextlib import contextmanager
from pathlib import Path
from shutil import which
from typing import IO, Any, Dict, Iterator, List, Optional, Tuple
from . import __version__
from .runtime import JuliaRuntime
from .utils import ApplicationErr... | 2.03125 | 2 |
xtellixClient.py | markamo/xtellixClient | 0 | 12778602 | import requests
import json
__SERVER_HOST__ = "http://127.0.0.1:5057"
__CLIENT_SECRET__ = 1234567890
__SERVER_SECRET__ = 1234567890
__SERVER_START_API__ = "/api/start"
__SERVER_STOP_API__ = "/api/stop"
__SERVER_PARAMETERS_API__ = "/api/parameters"
__SERVER_ALLPARAME... | 2.28125 | 2 |
tests/test_wigner_H.py | moble/spherical | 15 | 12778603 | <reponame>moble/spherical
#!/usr/bin/env python
# Copyright (c) 2021, <NAME>
# See LICENSE file for details: <https://github.com/moble/spherical/blob/master/LICENSE>
import sympy
import numpy as np
import spherical as sf
import pytest
from .conftest import requires_sympy
slow = pytest.mark.slow
@requires_sympy
@s... | 2.28125 | 2 |
tuyaha/devices/switch.py | PaulAnnekov/tuya-ha | 153 | 12778604 |
from tuyaha.devices.base import TuyaDevice
class TuyaSwitch(TuyaDevice):
def turn_on(self):
if self._control_device("turnOnOff", {"value": "1"}):
self._update_data("state", True)
def turn_off(self):
if self._control_device("turnOnOff", {"value": "0"}):
self._update_d... | 2.671875 | 3 |
button_test.py | krame505/bs-generics-demo | 0 | 12778605 | <filename>button_test.py
#!/usr/bin/env python3
# Copyright 2021 Google LLC
#
# 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 req... | 2.734375 | 3 |
tools/polly/bin/detail/osx_dev_root.py | Kondr11/LABA7 | 861 | 12778606 | # Copyright (c) 2015, <NAME>
# All rights reserved.
import os
import re
def get(osx_version):
dev_dir = re.sub(r'\.', '_', osx_version)
dev_dir = 'OSX_{}_DEVELOPER_DIR'.format(dev_dir)
return os.getenv(dev_dir)
| 2.046875 | 2 |
99.py | juandarr/ProjectEuler | 0 | 12778607 | <filename>99.py
"""
Finds the biggest numeral in an array where each row has the format base, exponent
Author: <NAME>
"""
import math
pairs = """519432,525806
632382,518061
78864,613712
466580,530130
780495,510032
525895,525320
15991,714883
960290,502358
760018,511029
166800,575487
210884,564478
555151,523163
681146,5... | 3.1875 | 3 |
Otree/mygame/models.py | sb6998/delpro | 0 | 12778608 | <reponame>sb6998/delpro<filename>Otree/mygame/models.py
from otree.api import (
models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer,
Currency as c, currency_range
)
import csv
author = '<NAME>'
doc = """
Decision making using game theory
"""
class Constants(BaseConstants):
... | 2.625 | 3 |
src/kleis/config/config.py | santteegt/kleis-keyphrase-extraction | 16 | 12778609 | """config/config
Default corpus configs.
"""
import sys
import os
import inspect
from pathlib import Path
from kleis import kleis_data
ACLRDTEC = "acl-rd-tec-2.0"
SEMEVAL2017 = "semeval2017-task10"
KPEXTDATA_PATH = str(Path(inspect.getfile(kleis_data)).parent)
# Check for default paths for corpus
DEFAULT_CORPUS_P... | 2.390625 | 2 |
home_board/compositor.py | kdickerson/homeBoard | 7 | 12778610 | <reponame>kdickerson/homeBoard
# Generate in image from the provided weather, calendar, special_events data
import logging
import os
from PIL import Image, ImageDraw, ImageFont
from .util import local_file
EPD_WIDTH = 640
EPD_HEIGHT = 384
BLACK = 0
WHITE = 255
RED = 128
COLUMN_WIDTH = 160
COLUMNS = [0, COLUMN_WIDTH... | 2.453125 | 2 |
ba/set.py | mrtukkin/bachelor-thesis | 0 | 12778611 | from scipy.misc import imread
from tqdm import tqdm
import numpy as np
import os
import random
import warnings
class SetList(object):
'''A class to hold lists of inputs for a network'''
def __init__(self, source='', target=None):
'''Constructs a new SetList.
Args:
source (str): T... | 2.875 | 3 |
superseeded/calcResponse.py | BeneStrahm/WindTunnelPostprocessing | 0 | 12778612 | <reponame>BeneStrahm/WindTunnelPostprocessing
# ------------------------------------------------------------------------------
# Description: Calculating wind speeds at different return periods
# Author: <EMAIL>
# Created: 2020-09-16
# Execution: Import functions / collections (from folder.file import fu... | 2.265625 | 2 |
Source/crunch.py | furcelay/DRE | 0 | 12778613 | from Source import ModelsIO as MIO
import numpy as np
from h5py import File
def E_fit(_cube: np.ndarray((10, 13, 21, 128, 128), '>f4'),
data: np.ndarray((128, 128), '>f4'),
seg: np.ndarray((128, 128), '>f4'),
noise: np.ndarray((128, 128), '>f4')) -> np.ndarray((10, 13, 21), '>f4'):
... | 2.09375 | 2 |
pipelines/p2_aggregate_orca.py | CSE482Winter2021/Major-Dudes | 0 | 12778614 | import os
import pandas as pd
from tqdm import tqdm
import pipelines.p1_orca_by_stop as p1
from utils import constants, data_utils
NAME = 'p2_aggregate_orca'
WRITE_DIR = os.path.join(constants.PIPELINE_OUTPUTS_DIR, NAME)
def load_input():
path = os.path.join(constants.PIPELINE_OUTPUTS_DIR, f'{p1.NAME}.csv')
... | 2.84375 | 3 |
sorting.py | ivanbgd/Quick3-Sort-Py | 1 | 12778615 | <reponame>ivanbgd/Quick3-Sort-Py
import sys
import random
def partition3(a, l, r):
x = a[l]
j, o = l, l
for i in range(l+1, r+1):
if a[i] < x:
o += 1
a[i], a[o] = a[o], a[i]
a[j], a[o] = a[o], a[j]
j += 1
elif a[i] == x:
o += 1
... | 3.40625 | 3 |
ftocp.py | urosolia/SLIP | 1 | 12778616 | <filename>ftocp.py<gh_stars>1-10
from casadi import *
from numpy import *
import pdb
import itertools
import numpy as np
from cvxpy import *
import time
##### FTOCP ######
class FTOCP(object):
""" Finite Time Optimal Control Problem (FTOCP)
Methods:
- solve: solves the FTOCP given the initial condition x0 and term... | 2.875 | 3 |
Beginner/age123.py | man21/IOSD-UIETKUK-HacktoberFest-Meetup-2019 | 22 | 12778617 | a=int(input("Enter your age:"))
if (a>=18):
print("Adult")
elif (10<a<=18):
print("Teen")
elif(a<=10):
print("Child")
| 4.09375 | 4 |
src/datasets/coco_dataset.py | petersiemen/CVND---Image-Captioning-Project | 0 | 12778618 | import nltk
import os
import torch
import torch.utils.data as data
import numpy as np
import json
from .vocabulary import Vocabulary
from pycocotools.coco import COCO
from PIL import Image
from tqdm import tqdm
class CoCoDataset(data.Dataset):
def __init__(self, transform, mode, batch_size, vocab_threshold, voca... | 2.390625 | 2 |
WordGuesser/__init__.py | sourcery-ai-bot/word-guesser | 2 | 12778619 | from .WordGuesser import WordGuesser | 1.007813 | 1 |
vdgnn/dataset/dataloader.py | HCY123902/visdial-gnn | 44 | 12778620 | import os
import json
from six import iteritems
import h5py
import numpy as np
from tqdm import tqdm
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset
from vdgnn.dataset.readers import DenseAnnotationsReader, ImageFeaturesHdfReader
TRAIN_VAL_SPLIT = {'0.9': 80000, '1.0': 123287}
clas... | 2.203125 | 2 |
ronald.boadana/snakepro/fruit.py | LUDUSLab/stem-games | 2 | 12778621 | import random
from config import *
from wall import *
apple = pygame.image.load('../snakepro/assets/ronald.boadana_apple.png')
apple_pos = ((random.randint(32, 726) // 32 * 32), (random.randint(64, 576) // 32 * 32))
def apple_randomness_movement():
apple_x = (random.randint(32, 726) // 32 * 32)
apple_y = (r... | 2.578125 | 3 |
aio_databases/backends/_dummy.py | klen/aio-databases | 6 | 12778622 | import typing as t
from . import ABCDatabaseBackend, ABCConnection
from .common import Transaction
class Connection(ABCConnection):
transaction_cls = Transaction
async def _execute(self, query: str, *params, **options) -> t.Any:
return None
async def _executemany(self, query: str, *params, **o... | 2.421875 | 2 |
Exercicios-Python/CursoEmVideo/ex019.py | bruno1906/ExerciciosPython | 0 | 12778623 | from random import choices
n1=str(input('Digite o nome do primeiro aluno:'))
n2=str(input('Digite o nome do segundo aluno:'))
n3=str(input('Digite o nome do terceiro aluno:'))
n4=str(input('Digite o nome do quarto aluno'))
lista=[n1, n2, n3, n4]
e=choices(lista)
print('O aluno escolhido foi {}'.format(e))
| 3.6875 | 4 |
Demo/gui.py | mengfanShi/Pose-Estimate | 0 | 12778624 | <filename>Demo/gui.py
# -*- coding:utf-8 -*-
# @TIME :2018/12/28 15:36
# @File :gui_test.py
import tkinter as tk
from tkinter import filedialog
import threading
class Gui:
def __init__(self):
self.filepath = '/home/fan/Pose Estimation/Demo/pic.jpg'
self.id = 0 # 0 means ... | 3.078125 | 3 |
model/resnext/train.py | wan-h/JD-AI-Fashion-Challenge | 3 | 12778625 | from model.resnext import model1_val4
model1_val4.train()
| 1.375 | 1 |
week2/q4_get_ios_version.py | gerards/pynet_learning_python | 0 | 12778626 | <gh_stars>0
#!/usr/bin/env python
cisco_ios = "Cisco IOS Software, C880 Software (C880DATA-UNIVERSALK9-M), Version 15.0(1)M4, RELEASE SOFTWARE (fc1)"
cisco_ios_split = cisco_ios.split(",")
cisco_ios_version = cisco_ios_split[2][9:]
print(cisco_ios_version)
| 2.359375 | 2 |
scripts/scarv_pipeline/compute_SCARV_6.py | jtenwolde/SCARV | 0 | 12778627 | <reponame>jtenwolde/SCARV
import os
import numpy as np
import pandas as pd
import random
from scarv import scarv_assess
import sys
ancestry = sys.argv[1]
window_size = 575
chr_list = ["chr" + str(i) for i in range(1, 23)]
chr_list.extend(["chrXnonPAR", "chrXPAR"])
chr_lengths_raw = [248956422, 242193529, 198295559,... | 2.109375 | 2 |
libsaas/services/uservoice/comments.py | MidtownFellowship/libsaas | 155 | 12778628 | from libsaas import http, parsers
from libsaas.services import base
from . import resource, flags
class CommentsBase(resource.UserVoiceTextResource):
path = 'comments'
def wrap_object(self, name):
return {'comment': {'text': name}}
class Comments(CommentsBase):
def create(self, obj):
... | 2.5 | 2 |
backend/api/views/task.py | skaghzz/doccano | 3,989 | 12778629 | <filename>backend/api/views/task.py
from celery.result import AsyncResult
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
class TaskStatus(APIView):
permission_classes = (IsAuthenticated,)
def get(self, request, *arg... | 2.09375 | 2 |
zz.py | JITENDRAMINDA/singh | 0 | 12778630 | from pyrogram import Client, Filters, Emoji
import random
import time
app = Client("session",bot_token="<KEY>",api_id=605563,api_hash="7f2c2d12880400b88764b9b304e14e0b")
@app.on_message(Filters.command('bowl'))
def ran(client, message):
b = client.get_chat_member(message.chat.id,message.from_user.id)
cli... | 2.484375 | 2 |
twentiment/auth.py | katykennington/twentiment | 0 | 12778631 | <gh_stars>0
"""
This module is about authentication
"""
import tweepy
try:
from twentiment import secrets
except ImportError:
secrets = None
class AuthenticationError(ValueError):
pass
def authenticate(consumer_key=None, consumer_secret=None, access_token=None, access_secret=None) -> tweepy.OAuthHandl... | 2.890625 | 3 |
src/djshop/apps/sale/migrations/0002_sale_operation_number.py | diegojromerolopez/djshop | 0 | 12778632 | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-05-09 15:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sale', '0001_initial'),
]
operations = [
migrations.AddField(
mod... | 1.640625 | 2 |
backend/plans/serializers.py | moeenz/plannr | 2 | 12778633 | <reponame>moeenz/plannr
from rest_framework import serializers
from rest_framework.exceptions import NotAuthenticated
from plans.models import Plan
from utils.request import get_request_user
class PlanSerializer(serializers.Serializer):
"""Serializer for requests coming upon /plans api.
`django-restframework... | 2.296875 | 2 |
爬虫/第二页/动态抓取实例.py | Aloof-0/codesr | 1 | 12778634 | <filename>爬虫/第二页/动态抓取实例.py
# -*- coding: utf-8 -*-
# @Time : 2020/7/22 14:18
# @Author : Frosty
# @Email : <EMAIL>
# @File : 动态抓取实例.py
# @Time : 2020/7/22 14:18
# @Software: PyCharm
import requests
link = """https://api-zero.livere.com/v1/comments/list?callback=jQuery112403473268296510956_1531502963311&limi... | 2.640625 | 3 |
relic/graphics.py | matthiasdusch/relic | 0 | 12778635 | import matplotlib
matplotlib.use('TkAgg') # noqa
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from matplotlib.colors import LinearSegmentedColormap
import matplotlib.cm as cm
import matplotlib.colors as mcolors
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import cmocean
im... | 1.914063 | 2 |
test/test_database.py | Noiredd/Filmatyk | 2 | 12778636 | import os
import sys
from typing import List, Set, Tuple
import unittest
sys.path.append(os.path.join('..', 'filmatyk'))
import containers
import database
import filmweb
class DatabaseDifference():
"""Represents a difference between two DBs.
Can be constructed using the "compute" @staticmethod, which can be use... | 3.25 | 3 |
webapp/polls/admin.py | tristanrobert/batch7_rse | 5 | 12778637 | from django.contrib import admin
from .models import Company, DPEF, Sentence, ActivitySector
admin.site.register(Company)
admin.site.register(DPEF)
admin.site.register(Sentence)
admin.site.register(ActivitySector)
| 1.242188 | 1 |
src/pyclts/inventories.py | XachaB/pyclts | 6 | 12778638 | <filename>src/pyclts/inventories.py<gh_stars>1-10
"""
Module handles different aspects of inventory comparison.
"""
import attr
from collections import OrderedDict, namedtuple
from pyclts.api import CLTS
import statistics
from pyclts.cli_util import Table
from pyclts.util import jaccard
def reduce_features(sound, ts=... | 2.421875 | 2 |
tests/test_wellknowntext.py | akrherz/pyIEM | 29 | 12778639 | """tests"""
import pytest
from shapely.geometry import Point, Polygon, LineString
from pyiem import wellknowntext
def test_parsecoordinate_lists():
"""Parse!"""
with pytest.raises(ValueError):
wellknowntext.parse_coordinate_lists(" ")
def test_unknown():
"""Test an emptry string."""
with p... | 2.609375 | 3 |
api/lime_comb_api/database.py | n0npax/lime-comb | 1 | 12778640 | <reponame>n0npax/lime-comb
import base64
import logging
import sys
from flask import g
from google.cloud import firestore
from werkzeug.exceptions import Unauthorized
logging.basicConfig(stream=sys.stdout)
app_name = "lime-comb"
logger = logging.getLogger(app_name)
def doc_path(*, email, key_type, key_name):
_,... | 2.390625 | 2 |
amlpp/transformers/categorical.py | Asirg/papds | 1 | 12778641 | from sklearn.preprocessing import OrdinalEncoder
from typing import List
import pandas as pd
import numpy as np
from ._base_transform import BaseTransform
##############################################################################
class CategoricalEncoder(BaseTransform):
""" Categorical encoder
Parameter... | 3.203125 | 3 |
makePuddleworldTasks.py | lcary/ec-backup | 0 | 12778642 | """
Makes Puddleworld tasks.
Tasks are (gridworld, text instruction) -> goal coordinate.
Credit: tasks are taken from: https://github.com/JannerM/spatial-reasoning
"""
from puddleworldPrimitives import *
from utilities import *
from task import *
from type import *
OBJECT_NAMES = ["NULL", "puddle", "star", "circle", ... | 3.421875 | 3 |
te/TE.py | priyadarshitathagat/te-ns | 0 | 12778643 | #**********************************************************************************************
# Traffic Emulator for Network Services
# Copyright 2020 VMware, Inc
# The BSD-2 license (the "License") set forth below applies to all parts of
# the Traffic Emulator for Network Services project. You may not use this file
... | 0.945313 | 1 |
Genome.py | SwikarGautam/NEAT | 0 | 12778644 | <filename>Genome.py
from Node import Node
import random
from math import exp
class Genome:
def __init__(self):
self.connections = []
self.bias = Node(0, 0)
self.inp = [self.bias]
self.out = []
self.connection_set = set() # it is used to check if a connection... | 3.1875 | 3 |
sdk/python/v1beta1/kubeflow/katib/models/v1beta1_source_spec.py | ujjwalsh/katib | 2 | 12778645 | <reponame>ujjwalsh/katib<filename>sdk/python/v1beta1/kubeflow/katib/models/v1beta1_source_spec.py
# coding: utf-8
"""
Katib
Swagger description for Katib # noqa: E501
OpenAPI spec version: v1beta1-0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re... | 1.929688 | 2 |
crown/query.py | machine-w/crown | 25 | 12778646 | <reponame>machine-w/crown<gh_stars>10-100
# from types import SimpleNamespace
# from crown import Model
# from attr import field
from .common import *
from .field import *
from functools import reduce
import operator
class QueryCompiler(object):
field_map = {
'int': 'INT',
'smallint': 'SMALLINT',
... | 2.140625 | 2 |
chemreg/resolution/tests/test_substance_index.py | Chemical-Curation/chemcurator | 1 | 12778647 | <reponame>Chemical-Curation/chemcurator
import json
from unittest.mock import Mock, patch
from rest_framework.exceptions import APIException
import pytest
import requests
from chemreg.resolution.indices import SubstanceIndex
def test_substance_index_substance_search():
sample_response = {
"data": [
... | 2.40625 | 2 |
SATD_Detector/compare.py | isabelaedilene/technicalDebtTisVI | 0 | 12778648 | <filename>SATD_Detector/compare.py
from csv import writer
import pandas as pd
with open("../Sonar/analiseSonar.csv", "r", encoding="utf-8") as f:
csv_string = f.read()
with open("sonar_analysis.csv", "w", encoding="utf-8") as f:
csv = writer(f)
for line in csv_string.splitlines():
csv.writerow(li... | 3 | 3 |
eval/fig3.py | tk2lab/logbesselk | 0 | 12778649 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from . import common
def main(debug=False):
name = ['I', 'A', 'S', 'C']
suffix = ['', '', '', '']
df0 = []
for n, s in zip(name, suffix):
prec = pd.read_csv(f'results/logk_prec_{n}{s}.csv')
p... | 2.328125 | 2 |
i2b2/utils/path.py | jtourille/i2b2-coref-task1c-converter | 1 | 12778650 | <reponame>jtourille/i2b2-coref-task1c-converter<filename>i2b2/utils/path.py
import os
def ensure_dir(directory: str) -> None:
"""
Creates a directory
Args:
directory (str): path to create
Returns:
None
"""
try:
if not os.path.exists(directory):
os.makedir... | 2.90625 | 3 |