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 |
|---|---|---|---|---|---|---|
src/zebrafish_ec_migration/pipelines/cell_trajectory_analysis_pipeline/compute_trajectory_features.py | wgiese/zebrafish_ec_migration | 0 | 24500 | <reponame>wgiese/zebrafish_ec_migration<gh_stars>0
import pandas as pd
from typing import Dict, List
import numpy as np
import pylab as plt
def compute_trajectory_features_set1(aligned_trajector_key_file: pd.DataFrame, parameters: Dict, start_time, end_time):
features_df = pd.DataFrame()
data_statistics_df = ... | 2.28125 | 2 |
scripts/beck/st/error_injection.py | papan-singh/cortx-motr-1 | 0 | 24501 | <gh_stars>0
#!/usr/bin/python3
#
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
#
# 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/LICENS... | 2.328125 | 2 |
vaksinasi/migrations/0003_auto_20211029_0123.py | harmonica-pacil/invid19 | 1 | 24502 | <reponame>harmonica-pacil/invid19
# Generated by Django 3.2.8 on 2021-10-28 18:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vaksinasi', '0002_alter_pendaftar_nik'),
]
operations = [
migrations.AlterField(
model_name='p... | 1.664063 | 2 |
classes/stack.py | EashanKaushik/Data-Structures | 0 | 24503 | # node class for develping linked list
class Node:
def __init__(self, data=None, pointer=None):
self.data = data
self.pointer = pointer
def set_data(self, data):
self.data = data
def get_data(self):
return self.data
def set_pointer(self, pointer):
... | 4.03125 | 4 |
demo.py | jjegg01/abp.spherical2d.pairdistribution | 0 | 24504 | <filename>demo.py<gh_stars>0
#!/usb/bin/env python3
"""Demo script for abp.spherical2d.pairdistribution module."""
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright (C) 2019 <NAME>, <NAME>"
__license__ = "MIT"
__version__ = "1.0"
import argparse
import numpy as np
import matplotlib.pyplot as plt
from matplot... | 2.734375 | 3 |
pdfMerge/pdf_merge.py | R3CEPT0R/pdfuse | 0 | 24505 | <filename>pdfMerge/pdf_merge.py
import PyPDF2
import fitz
import io
from PIL import Image
import os
import random
import string
import pikepdf
from tqdm import tqdm
from zipfile import ZipFile
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
from pathlib import Path
"""
Converts entire P... | 2.8125 | 3 |
grAdapt/sampling/equidistributed/Mitchell.py | mkduong-ai/grAdapt | 25 | 24506 | # Python Standard Libraries
import warnings
# grAdapt
# from .base import Equidistributed
from .MaximalMinDistance import MaximalMinDistance
class Mitchell(MaximalMinDistance):
"""
[Mitchell et al., 1991],
Spectrally optimal sampling for distribution ray tracing
"""
def __init__(self, m=3):
... | 2.890625 | 3 |
poly_py_tools/payload.py | mjmunger/PolyPyTools | 7 | 24507 | <reponame>mjmunger/PolyPyTools<filename>poly_py_tools/payload.py
import os
from poly_py_tools.dialplan_entry import Entry
from poly_py_tools.polypy_config import PolypyConfig
class Payload:
dialplan_entry = None
provisioned_directory = None
config = None
sources = None
def __init__(self, config:... | 2.15625 | 2 |
tests/test_cosine_estimator.py | lefnire/lefnire_ml_utils | 3 | 24508 | <gh_stars>1-10
from ml_tools import CosineEstimator, Similars
from ml_tools.fixtures import articles
import numpy as np
corpus = articles()
split_ = len(corpus)//3
x, y = corpus[split_:], corpus[:split_] # note reversal; x should be smaller
x, y = Similars(x, y).embed().value()
def test_cosine_estimator():
dnn ... | 2.609375 | 3 |
tests/test_euclidean_distance.py | danielwardega141196/unittests-with-pytest | 0 | 24509 | <reponame>danielwardega141196/unittests-with-pytest<filename>tests/test_euclidean_distance.py<gh_stars>0
from application.euclidean_distance import euclidean_distance
def test_euclidean_distance():
point_a = (0, 0)
point_b = (3, 4)
distance_between_a_and_b = euclidean_distance(point_a, point_b)
asse... | 2.75 | 3 |
Material.py | YuvalAriel/Path_Tracing | 0 | 24510 | import numpy as np
class Material:
"""send color as list of 3 floats in range of 0-1"""
def __init__(self, color, reflection=0, transparency=0, emission=np.array((0, 0, 0)), refraction_ind=1):
self.color = np.array(color)
self.emission = emission # only for light sources
self.reflect... | 3.40625 | 3 |
MTVulnerability/models/DRNSegDepth.py | yamizi/taskaugment | 0 | 24511 | <reponame>yamizi/taskaugment
import math
import sys
import torch
from torch import nn
import models.drn as drn
# class Decoder(nn.Module):
#
# def __init__(self,
# output_channels = 3,
# ):
#
# self.output_channels = 3
#
# # DEFINING MODEL AS COMPLEMENT OF BASE CH... | 2.359375 | 2 |
src/web/modules/post/controllers/post/create.py | unkyulee/elastic-cms | 2 | 24512 | <gh_stars>1-10
from flask import request, render_template
import json
import traceback
import lib.es as es
import web.util.tools as tools
import web.modules.post.services.workflow as workflow
import web.modules.post.services.upload as upload
import web.util.jinja as jinja
import web.modules.admin.services.notification ... | 2.25 | 2 |
stibium/bot.py | szymonszl/stibium | 0 | 24513 | <gh_stars>0
"""This module provies the main Bot class"""
import time
import traceback
import json
import threading
import sched
from fbchat import models
from ._fbclient import Client
from ._logs import log
from .dataclasses import Thread
from .handlers import BaseHandler
from ._i18n import _
class Bot(object):
... | 2.046875 | 2 |
train.py | SwatiSharda/Solar-forecasting | 3 | 24514 | import pandas as pd
from torch.utils.data import DataLoader
import multiprocessing as mp
import argparse
from DataSet import Dataset
import torch
import torch.nn as nn
from os import path
import Infer
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
cpu = torch.device('cpu')
parser = argparse.A... | 2.3125 | 2 |
txtpp/src/txtpp.py | Cc618/dotmgt | 2 | 24515 | #!/usr/bin/env python3
import re
import sys
import io
import os
import traceback
class TextPreprocessorError(Exception):
def __init__(self, file_id, line, msg):
super().__init__(f"{file_id}:{line}: {msg}")
def debug_print(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def preprocess(
... | 3.265625 | 3 |
vggface/resnet50/__init__.py | claudiourbina/VGGFace | 0 | 24516 | from .resnet50 import ResNet50 | 1.015625 | 1 |
supportal/tests/app/management/commands/test_email_users_with_expiring_assignments.py | Elizabeth-Warren/supportal-backend | 34 | 24517 | from datetime import datetime, timezone
from io import StringIO
from unittest import mock
import freezegun
import pytest
from django.conf import settings
from django.core.management import call_command
from django.utils import timezone
from model_bakery import baker
from supportal.app.common.enums import CanvassResul... | 1.976563 | 2 |
reinforcement_learning/rl_hvac_coach_energyplus/src/eplus/envs/data_center_env.py | jpmarques19/tensorflwo-test | 5 | 24518 | import gym
from gym import error, spaces, utils
from gym.utils import seeding
from eplus.envs import pyEp
import socket
from eplus.envs.socket_builder import socket_builder
import numpy as np
import os
class DataCenterEnv(gym.Env):
def __init__(self, config):
#timestep=12, days=1, eplus_path=None,
... | 2.5 | 2 |
test1.py | ktbyers/pyneta | 2 | 24519 | <filename>test1.py
print("hello")
while True:
print("Infinite loop")
| 2.546875 | 3 |
srblib/__init__.py | srbcheema1/srblib | 2 | 24520 | __version__ = '0.1.6'
__mod_name__ = 'srblib'
from .colour import Colour # A class with color names and a static print function which prints coloured output to stderr
from .debugger import debug # a boolean whose value can be changed in ~/.config/srblib/debug.json
from .debugger import on_appveyor # a boolean value ... | 1.804688 | 2 |
src/msfbe/handlers/CountiesHandler.py | Noella-W/MethaneSourceFinder-BackEndDocker-1 | 0 | 24521 | """
Copyright (c) 2018 Jet Propulsion Laboratory,
California Institute of Technology. All rights reserved
"""
import json
from msfbe.webmodel import BaseHandler, service_handler
import requests
import psycopg2
class CountiesColumns:
COUNTY_ID = 0
NAME = 1
AREA = 2
PERIMETER = 3
CACOA = 4
CACO... | 2.71875 | 3 |
ai for simple games/connect 4/tictoc.py | gustasvs/AI | 1 | 24522 | import time
def tic():
#Homemade version of matlab tic and toc functions
global startTime_for_tictoc
startTime_for_tictoc = time.time()
def toc():
if 'startTime_for_tictoc' in globals():
print("Elapsed time is " + str(time.time() - startTime_for_tictoc) + " seconds.")
else:
print... | 3.40625 | 3 |
contrib/enginedesign/openmdao.examples.enginedesign/openmdao/examples/enginedesign/releaseinfo.py | mjfwest/OpenMDAO-Framework | 69 | 24523 |
# This file is automatically generated
__version__ = '0.10.3.2'
__comments__ = """too many spaces :/
Merge pull request #1848 from swryan/work"""
__date__ = '2014-11-15 09:50:34 -0500'
__commit__ = '<PASSWORD>'
| 1.070313 | 1 |
Utils/get_skeleton.py | Kohulan/DECIMER-Image-Segmentation | 29 | 24524 | '''
* This Software is under the MIT License
* Refer to LICENSE or https://opensource.org/licenses/MIT for more information
* Written by ©<NAME> 2020
'''
from skimage import img_as_float
from skimage import io, color, morphology
import matplotlib.pyplot as plt
def get_skeleton_and_thin(input_image):
image = img_as... | 2.609375 | 3 |
Task/CSV-to-HTML-translation/Python/csv-to-html-translation-5.py | mullikine/RosettaCodeData | 1 | 24525 | from csv import DictReader
from xml.etree import ElementTree as ET
def csv2html_robust(txt, header=True, attr=None):
# Use DictReader because, despite what the docs say, reader() doesn't
# return an object with .fieldnames
# (DictReader expects an iterable that returns lines, so split on \n)
reader = D... | 3.296875 | 3 |
src/gausskernel/dbmind/tools/sqldiag/load_sql_from_wdr.py | opengauss-mirror/openGauss-graph | 0 | 24526 | <gh_stars>0
import os
import re
import sys
import argparse
from preprocessing import templatize_sql
from utils import DBAgent, check_time_legality
__description__ = "Get sql information based on wdr."
def parse_args():
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
... | 2.5625 | 3 |
program_train/hachina1.py | zhujisheng/HAComponent | 39 | 24527 | <filename>program_train/hachina1.py
"""
文件名:hachina.py.
演示程序,三行代码创建一个新设备.
"""
def setup(hass, config):
"""HomeAssistant在配置文件中发现hachina域的配置后,会自动调用hachina.py文件中的setup函数."""
# 设置实体hachina.Hello_World的状态。
# 注意1:实体并不需要被创建,只要设置了实体的状态,实体就自然存在了
# 注意2:实体的状态可以是任何字符串
hass.states.set("hachina.hel... | 1.6875 | 2 |
simple_ddl_parser/dialects/hql.py | swiatek25/simple-ddl-parser | 0 | 24528 | <reponame>swiatek25/simple-ddl-parser
from simple_ddl_parser.utils import check_spec, remove_par
class HQL:
def p_expression_location(self, p):
"""expr : expr LOCATION STRING"""
p[0] = p[1]
p_list = list(p)
p[0]["location"] = p_list[-1]
def p_row_format(self, p):
"""ro... | 2.609375 | 3 |
pydaemon/tx_sms_service_.py | tmkasun/pysmsgate | 0 | 24529 | import json
import sys
import time
from twisted.internet.task import deferLater
from twisted.web import http
from twisted.web.resource import Resource
from twisted.web.server import Site
from twisted.internet import reactor
from gsmmodem.modem import GsmModem, SentSms
from gsmmodem.exceptions import TimeoutException,... | 1.96875 | 2 |
plugins/vad/snr_vad/test_snr_vad.py | kowo-zahl/Naomi | 194 | 24530 | # -*- coding: utf-8 -*-
from naomi import testutils
from . import snr_vad
class TestSNR_VADPlugin(testutils.Test_VADPlugin):
def setUp(self):
super(TestSNR_VADPlugin, self).setUp()
self.plugin = testutils.get_plugin_instance(
snr_vad.SNRPlugin,
self._test_input
)
... | 2.171875 | 2 |
dali/test/python/test_operator_rotate.py | L-Net-1992/DALI | 0 | 24531 | # Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | 1.914063 | 2 |
graph/templatetags/helpers.py | Soaring-Outliers/news_graph | 1 | 24532 | <filename>graph/templatetags/helpers.py
from django import template
import bleach
# import the logging library
import logging
# Get an instance of a logger
logger = logging.getLogger(__name__)
register = template.Library()
@register.filter
def sanitize(text):
ALLOWED_TAGS = ['p', 'span', 'h5', 'h6']
ALL... | 2.296875 | 2 |
rbf/linalg.py | aaronbalzac/rbf-neural-network | 1 | 24533 | <filename>rbf/linalg.py
'''
Module for linear algebra routines.
'''
import logging
import warnings
import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as spla
from scipy.linalg.lapack import (dpotrf, dpotrs, dtrtrs, dgetrf,
dgetrs)
from rbf.sputils import row_norm... | 2.609375 | 3 |
week_3/cnn.py | jimichailidis/UVA_AML18 | 0 | 24534 | #%%
import os
print(os.getcwd())
from Blocks import ReLU, SequentialNN, Dense, Hinge, SGD
from dataset_utils import load_mnist
import numpy as np
from convolution_layer import ConvLayer
from maxpool_layer import MaxPool2x2
from flatten_layer import FlattenLayer
import sys
def iterate_minibatches(x, y, batch_size=16, ... | 2.640625 | 3 |
methylprep/processing/preprocess.py | WonyoungCho/methylprep | 5 | 24535 | # Normal-exponential using out-of-band probes
# normex: negative control probes
# noob: ‘out-of-band’ Infinium I probes
# Lib
import logging
import numpy as np
import pandas as pd
from statsmodels import robust
from scipy.stats import norm, lognorm
# App
from ..models import ControlType, ArrayType
from ..models.sketch... | 2.140625 | 2 |
examples/llvm_rl/model/inference_result.py | xtremey/CompilerGym | 0 | 24536 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import List
import numpy as np
from pydantic import BaseModel, validator
from ray.rllib.agents.dqn import ApexTrain... | 2.125 | 2 |
Calculator/Division.py | rn44/statsCalculator | 0 | 24537 | <filename>Calculator/Division.py
def division(a, b):
b = float(b)
if b == 0:
c = 0
print('Cannot divide by 0.')
return c
else:
a = float(a)
c = round(a / b, 9)
return c
| 3.859375 | 4 |
fabulous/script_gen.py | FPGA-Research-Manchester/nextpnr-fabulous | 1 | 24538 | import re
from array import *
import fileinput
import sys, getopt
import csv
def main(argv):
vlog = ''
top = ''
try:
opts, args = getopt.getopt(argv,"hf:t:",["Vlog=","Top="])
except getopt.GetoptError:
print ('script_gen.py -r <verilog file> -t <top module name>')
sys.exit(2)
... | 2.5625 | 3 |
src/app/buy_btc.py | simondorfman/hello_cb_pro | 0 | 24539 | <reponame>simondorfman/hello_cb_pro
import os
from cbt.private_client import PrivateClient
from cbt.auth import get_new_private_connection
if __name__ == "__main__":
usd = os.getenv("USD_BUY")
auth = get_new_private_connection()
client = PrivateClient(auth)
client.market_buy_btc(usd)
| 2.1875 | 2 |
sample/tensor_functions.py | TheLampshady/tensor_tutorial | 2 | 24540 | <gh_stars>1-10
import numpy as np
from os import getcwd, path
import scipy.misc as misc
import tensorflow as tf
from tensorflow.contrib.tensorboard.plugins import projector
def variable_summaries(var, histogram_name='histogram'):
"""
Attach a lot of summaries to a Tensor (for TensorBoard visualization).
:... | 2.71875 | 3 |
test/example_project/main_package/workflow1.py | Tismas/bigflow | 63 | 24541 | <gh_stars>10-100
import bigflow as bf
from .job import ExampleJob
workflow1 = bf.Workflow(
workflow_id='workflow1',
definition=[ExampleJob('job1')]) | 1.609375 | 2 |
hello/migrations/0002_auto_20201116_1409.py | chenyuan99/OwlSavesCats | 0 | 24542 | # Generated by Django 3.0.8 on 2020-11-16 19:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('hello', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Author',
fi... | 1.875 | 2 |
Curso Em Video-python/PYTHON (MUNDO 1, MUNDO 2 E MUNDO 3)/pythonAulas/Aula18-listas-dentro-listas.py | AlamoVinicius/code-pratice | 0 | 24543 | <reponame>AlamoVinicius/code-pratice<gh_stars>0
""" aula sobre lista 18 repare como as listas podem ser incluidas dentro de uma lista. """
teste = []
teste.append('Álamo')
teste.append(26)
galera = []
galera.append(teste[:]) # é preciso fazer uma cópia com [:] para o sistema não duplicar
teste[0] = 'Francielli'
test... | 4.125 | 4 |
src/flups/io.py | spalato/flups | 0 | 24544 | <gh_stars>0
# flups.io: tools for reading and writing files
import re
import logging
import numpy as np
from .calib import load_latest, calibration
logger = logging.getLogger(__name__)
def read_asc(fname):
"""
Read a single `asc` file, the ASCII format from Andor Solis.
"""
logger.debug("Loading `.asc... | 2.65625 | 3 |
tests/test_text_search.py | jdvala/kulhadi | 3 | 24545 | import multiprocessing as mp
import pytest
from kawadi.text_search import SearchInText
@pytest.fixture()
def input_data():
text_to_find = "String distance algorithm"
text_to_search = """SIFT4 is a general purpose string distance algorithm inspired by JaroWinkler and Longest Common Subsequence. It was develo... | 2.859375 | 3 |
cbandits/core/bayesian_nn.py | AlliedToasters/dev_bandits | 0 | 24546 | <reponame>AlliedToasters/dev_bandits
"""Define the abstract class for Bayesian Neural Networks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class BayesianNN(object):
"""A Bayesian neural network keeps a distribution over neural nets."""
def... | 2.921875 | 3 |
maidwhite/__init__.py | tihtw/maidwhite-python | 1 | 24547 | # -*- coding: utf-8 -*-
from .MaidWhite import MaidWhite
name = "MaidWhite"
__all__ = (MaidWhite) | 1.210938 | 1 |
app/main/config.py | leskeylevy/flaskBackend | 0 | 24548 | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY')
DEBUG = False
class DevelopmentConfig:
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://levy:Dadiesboy12@localhost/ronchezfitness'
SQLALCHEMY_TRACK_MODIFICATIONS =... | 2.015625 | 2 |
crosstab/mega_analysis/lateralised_intensities.py | karandahele/Epilepsy-Repository | 2 | 24549 | import pandas as pd
from crosstab.mega_analysis.pivot_result_to_pixel_intensities import *
def lateralisation_to_pixel_intensities(all_combined_gifs, df,
semiology_term,
quantiles, method='non-linear', scale_factor=10,
... | 2.609375 | 3 |
requests_test.py | AnakinJiang/PythonDemo | 0 | 24550 | <filename>requests_test.py
'''
@Author: AnakinJiang
@Email: <EMAIL>9 AT gmail.com
@Descripttion: requests测试demo
@Date: 2019-08-27 15:37:14
@LastEditors: AnakinJiang
@LastEditTime: 2019-08-27 16:55:06
'''
import requests
def get_test():
url1 = 'https://www.douban.com/'
r1 = requests.get(url1)
print(r1.statu... | 2.9375 | 3 |
allennlp/training/learning_rate_schedulers/polynomial_decay.py | alle-pawols/allennlp | 2 | 24551 | from overrides import overrides
import torch
from allennlp.common.checks import ConfigurationError
from allennlp.training.learning_rate_schedulers.learning_rate_scheduler import LearningRateScheduler
@LearningRateScheduler.register("polynomial_decay")
class PolynomialDecay(LearningRateScheduler):
"""
Impleme... | 2.671875 | 3 |
Scripts/fill_year.py | usuallyunusual/The-Explorer | 0 | 24552 |
"""
TO DO:
1. Lot of edge cases not accounted for
2. Could use some unit testing scripts for sanity check
3. What are the bounds for years?
"""
import mysql
from mysql.connector import Error
import re
import numpy as np
def reject_outliers(data, m = 6.):
d = np.abs(data - np.median(data))
... | 2.765625 | 3 |
tests/web/client.py | bigbluedeer/instagram_private_api | 0 | 24553 | from ..common import (
WebApiTestBase, WebClientError as ClientError,
WebClientLoginError as ClientLoginError,
WebClient as Client,
compat_mock, compat_urllib_error
)
class ClientTests(WebApiTestBase):
"""Tests for client related functions."""
@staticmethod
def init_all(api):
retu... | 2.296875 | 2 |
setup.py | dasmanov/pyEcovent | 0 | 24554 | <gh_stars>0
from setuptools import setup
long_description = None
with open("README.md", 'r') as fp:
long_description = fp.read()
setup(
name = 'pyEcovent',
packages = ['ecovent'],
version='0.8.4',
description='Python3 library for single-room energy recovery ventilators from Vents / Blauberg / Fle... | 1.28125 | 1 |
voicepuppet/atvgnet/train_atnet.py | taylorlu/voicepuppet | 20 | 24555 | <filename>voicepuppet/atvgnet/train_atnet.py
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import tensorflow as tf
import numpy as np
import os
from optparse import OptionParser
import logging
from atnet import ATNet
from dataset.generator import ATNetDataGenerator
from plot import *
logging.basicConfig(level=loggin... | 2.3125 | 2 |
tests/test_errors.py | althonos/pyhmmer | 26 | 24556 | import unittest
from pyhmmer.easel import Alphabet
from pyhmmer.errors import UnexpectedError, AllocationError, EaselError, AlphabetMismatch
class TestErrors(unittest.TestCase):
def test_unexpected_error(self):
err = UnexpectedError(1, "p7_ReconfigLength")
self.assertEqual(repr(err), "Unexpected... | 2.921875 | 3 |
electrum_gui/common/provider/chains/cfx/sdk/cfx_address/base32.py | BixinKey/electrum | 12 | 24557 | import base64
STANDARD_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
CUSTOM_ALPHABET = 'abcdefghjkmnprstuvwxyz0123456789'
ENCODE_TRANS = str.maketrans(STANDARD_ALPHABET, CUSTOM_ALPHABET)
DECODE_TRANS = str.maketrans(CUSTOM_ALPHABET, STANDARD_ALPHABET)
PADDING_LETTER = '='
def encode(buffer):
assert type(buffer) ... | 3.234375 | 3 |
saefportal/datalakes/models/__init__.py | harry-consulting/SAEF1 | 0 | 24558 | from .one_drive_datalake import OneDriveDatalake
from .google_drive_datalake import GoogleDriveDatalake
from .dropbox_datalake import DropboxDatalake
from .google_cloud_storage_datalake import GoogleCloudStorageDatalake
from .azure_blob_storage_datalake import AzureBlobStorageDatalake
from .azure_data_lake_datalake imp... | 1.125 | 1 |
PathPlanning/AStar/a_star.py | Pythocrates/PythonRobotics | 0 | 24559 | """
A* grid planning
author: <NAME>(@Atsushi_twi)
<NAME> (<EMAIL>)
See Wikipedia article (https://en.wikipedia.org/wiki/A*_search_algorithm)
"""
import math
from node import Node
from obstacle_map import Position
class AStarPlanner:
def __init__(self, obstacle_map):
"""
Initialize gr... | 3.703125 | 4 |
Wordle v3.py | favet/wordle | 0 | 24560 | <filename>Wordle v3.py
wordle = open("Wordle.txt", "r")
wordList = []
for line in wordle:
stripped_line = line.strip()
wordList.append(stripped_line)
mutableList = []
outcomeList = []
def blackLetter(letter, list):
for word in list:
if letter in word:
list.remove(word)
d... | 3.765625 | 4 |
tests/resources/test_wallet_transactions.py | andreshndz/cuenca-python | 6 | 24561 | import datetime as dt
import pytest
from cuenca_validations.types import (
EntryType,
SavingCategory,
TransactionStatus,
WalletTransactionType,
)
from cuenca import BalanceEntry, Saving, WalletTransaction
@pytest.mark.vcr
def test_create_wallet_transaction():
wallet_id = 'LAvWUDH6OpQk-ber3E_zUEi... | 2.1875 | 2 |
xldlib/xlpy/inputs.py | Alexhuszagh/XLDiscoverer | 0 | 24562 | '''
XlPy/inputs
___________
Validates input file selection, configurations, and matches file types.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
'''
# load modules
import operator as op
from xldlib.onstart.main ... | 2.453125 | 2 |
ros/src/tl_detector/mocked_tl_detector.py | nyukhalov/CarND-Capstone | 3 | 24563 | #!/usr/bin/env python
import rospy
from std_msgs.msg import Int32
from geometry_msgs.msg import PoseStamped, Pose
from styx_msgs.msg import TrafficLightArray, TrafficLight
from styx_msgs.msg import Lane
from sensor_msgs.msg import Image
from scipy.spatial import KDTree
import cv2
import yaml
import math
import numpy as... | 2.21875 | 2 |
reamber/algorithms/generate/sv/generators/svFuncSequencer.py | Bestfast/reamberPy | 0 | 24564 | <filename>reamber/algorithms/generate/sv/generators/svFuncSequencer.py
from typing import Callable, List, Union
from numpy import arange
from reamber.algorithms.generate.sv.SvPkg import SvPkg
from reamber.algorithms.generate.sv.SvSequence import SvSequence
def svFuncSequencer(funcs: List[Union[float, Callable[[floa... | 2.96875 | 3 |
e_secretary/migrations/0010_auto_20190329_2219.py | tsitsikas96/e-secretary | 0 | 24565 | # Generated by Django 2.1.7 on 2019-03-29 20:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('e_secretary', '0009_profile'),
]
operations = [
migrations.AlterModelOptions(
name='professor',
options={'ordering':... | 1.828125 | 2 |
catenets/models/jax/pseudo_outcome_nets.py | AliciaCurth/CATENets | 33 | 24566 | """
Implements Pseudo-outcome based Two-step Nets, namely the DR-learner, the PW-learner and the
RA-learner.
"""
# Author: <NAME>
from typing import Callable, Optional, Tuple
import jax.numpy as jnp
import numpy as onp
import pandas as pd
from sklearn.model_selection import StratifiedKFold
import catenets.logger as l... | 2.21875 | 2 |
gender_converter/logger_aegender.py | roebel/DeepGC | 0 | 24567 | import random
from plotting_utils import plot_spectrogram_to_numpy, image_for_logger, plot_to_image
import numpy as np
import tensorflow as tf
class GParrotLogger():
def __init__(self, logdir, ali_path='ali'):
# super(ParrotLogger, self).__init__(logdir)
self.writer = tf.summary.create_file_write... | 2.25 | 2 |
itmo/2015-16/final/weight.py | dluschan/olymp | 0 | 24568 | <gh_stars>0
weight = []
diff = 0
n = int(input())
for i in range(n):
q, c = map(int, input().split())
if c == 2:
q *= -1
weight.append(q)
diff += q
min_diff = abs(diff)
for i in range(n):
if abs(diff - 2*weight[i]) < min_diff:
min_diff = abs(diff - 2*weight[i])
for j in range(i+1... | 2.75 | 3 |
open_spiel/python/examples/test.py | ThorvaldAagaard/open_spiel | 0 | 24569 | import pyspiel
game = pyspiel.load_game('bridge(use_double_dummy_result=false)')
line = '30 32 10 35 50 45 21 7 1 42 39 43 0 16 40 20 36 15 22 44 26 6 4 51 47 46 25 14 29 5 34 11 49 31 37 9 41 13 24 8 28 17 48 23 33 18 3 19 38 2 27 12 56 57 52 63 52 52 52 0 32 48 8 3 51 47 15 44 28 16 4 14 50 2 10 49 5 37 9 36 31 24 2... | 2.953125 | 3 |
texel/keys.py | Xen0byte/texel | 119 | 24570 | <filename>texel/keys.py
import curses
class Key:
def __init__(self, *values):
self.values = values
self._hash = hash(values)
self._keyset = set(values)
def __eq__(self, other):
return self._hash == other._hash
def __hash__(self):
return self._hash
class Keys:
... | 3.328125 | 3 |
tests/test_number_cleaner.py | theseus-automl/gorgona | 1 | 24571 | import pytest
from gorgona.stages.cleaners import NumberCleaner
@pytest.fixture()
def setup_number_cleaner():
nc = NumberCleaner(
'',
'',
)
return nc
def test_positive_integer_single_digit_single_digit(setup_number_cleaner):
assert setup_number_cleaner("7") == ""
def test_positiv... | 2.6875 | 3 |
test/test_digitalbitbox.py | matejcik/HWI | 54 | 24572 | #! /usr/bin/env python3
import argparse
import atexit
import json
import os
import subprocess
import sys
import time
import unittest
from test_device import (
Bitcoind,
DeviceEmulator,
DeviceTestCase,
TestDeviceConnect,
TestGetKeypool,
TestGetDescriptors,
TestSignTx,
)
from hwilib.devices... | 2.15625 | 2 |
docs/conf.py | maru/fiubar | 5 | 24573 | import os
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
extensions = []
templates_path = ['_templates']
source_suffix = ['.rst', '.md']
master_doc = 'index'
project = u'fiubar'
copyright = u'2008-2018, <NAME>'
version = '2.0.0'
release = '2.0.0'
exclude_trees = ['_build']
pygments_style = 'sphinx'
html_stati... | 1.476563 | 1 |
2021/day9.py | tobeannouncd/AdventOfCode | 0 | 24574 | from io import StringIO
import itertools
import numpy as np
import numpy.ma as ma
inputfile = './input/day9.txt'
# inputfile = StringIO('''2199943210
# 3987894921
# 9856789892
# 8767896789
# 9899965678''')
def neighbors(ar, i, j):
return {ar[i-1,j],
ar[i+1,j],
ar[i,j-1],
ar[i... | 2.84375 | 3 |
ml-env/examples/train.py | RafalSkolasinski/dockerfiles | 0 | 24575 | <reponame>RafalSkolasinski/dockerfiles
import numpy as np
import joblib
from sklearn import datasets
from sklearn import svm
from sklearn.model_selection import train_test_split
filename_p = "model.joblib"
if __name__ == "__main__":
digits = datasets.load_digits()
X_train, X_test, y_train, y_test = train... | 2.296875 | 2 |
vocoder/datasets/__init__.py | ZENGZHEN-TTS/LVCNet | 45 | 24576 | <reponame>ZENGZHEN-TTS/LVCNet<gh_stars>10-100
from .audio_mel import PWGAudioMelNoiseDataset, DataLoader
dataset_class_dict = {
"PWGAudioMelNoiseDataset": PWGAudioMelNoiseDataset
}
def create_dataloader(dataset_classname,
dataset_config,
batch_size=1,
... | 2.640625 | 3 |
src/mdfserver/models.py | UCHIC/iUTAHData | 2 | 24577 | from django.db import models
# from tinymce import models as tinymce_models
#
# # Create your models here.
#
# class Page(models.Model):
# title = models.CharField(max_length=200)
# url = models.CharField(max_length=200)
# content = models.TextField(max_length=20000) #tinymce_models.HTMLField()#forms.CharFi... | 2.375 | 2 |
tests/test_connectors_bigquery.py | bbc/foxglove | 0 | 24578 | """
Copyright 2019 BBC. Licensed under the terms of the Apache License 2.0.
"""
from unittest.mock import Mock
import pytest
from google.cloud.bigquery import Client
from foxglove.connectors.bigquery import BigQueryConnector
@pytest.fixture
def fake_bq_client():
return Mock(spec=Client(project='test_project')... | 2.234375 | 2 |
activitfinal.py | AjayBadrinath/Python-Stuff | 0 | 24579 | import sys
#"splchar":["!","@","#","$",".",",",":","%","^","*"]
splchar=[chr(i) for i in range(33,48)]#ASCII spl charecter range from 33-48 and58-65#and i here is the mapping expression ie the thing thet is executed evry iteration
splchar1=[chr(i) for i in range(58,65)]#Instead of explicit declaration of for loop ... | 3.65625 | 4 |
pytests/backup/ibr.py | ramalingam-cb/testrunner | 0 | 24580 | __author__ = 'ashvinder'
import re
import os
import gc
import logger
import time
from TestInput import TestInputSingleton
from backup.backup_base import BackupBaseTest
from remote.remote_util import RemoteMachineShellConnection
from couchbase_helper.documentgenerator import BlobGenerator
from couchbase_helper.documentg... | 1.773438 | 2 |
examples/test_feasibility.py | OllieBoyne/sslap | 7 | 24581 | """Check the feasibility of a bipartite graph by using SSLAP's feasibility module"""
import numpy as np
from sslap import hopcroft_solve
# All 3 methods will use the same input bipartite graph:
# i = 0 connects to j = 0, 1
# i = 1 connects to j = 1, 2
# i = 2 connects to j = 1, 4
# i = 3 connects to j = 2
# i = 4 con... | 3.671875 | 4 |
clot/app.py | elliptical/clot | 0 | 24582 | <filename>clot/app.py
"""A simple command-line interface to the clot.torrent package."""
from argparse import ArgumentParser
from os import path, walk
import shutil
from clot import __version__, torrent
def main():
"""Execute actions according to the command-line arguments."""
args = _parse_command_line()
... | 3.125 | 3 |
app/converter/nsl/substance_cv_converter.py | c0d3m0nkey/xml-to-json-converter | 0 | 24583 | <gh_stars>0
from lxml import objectify, etree
from operator import itemgetter
from ..xml_converter import XmlConverter
class SubstanceCVConverter(XmlConverter):
def convert(self, xml):
item = {}
item["term_english_equiv"] = str(xml.attrib["term-english-equiv"])
item["term_id"] = str(xml.at... | 2.609375 | 3 |
cardiffshop/cardiffshop/urls.py | yigitguler/admin-example | 0 | 24584 | <gh_stars>0
from products.views import ProductDetail
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^products/(?P<slug>[-\w]+)/', ProductDeta... | 1.679688 | 2 |
headlineVsHeadline/polls/models.py | bacarpenter/headline-vs-headline | 0 | 24585 | from django.db import models
# Create your models here.
class HeadlineListing(models.Model):
headline_text = models.CharField(max_length=500)
accessed = models.DateTimeField()
source_url = models.CharField(max_length=200)
author = models.CharField(default="", max_length=200)
source = models.CharFie... | 2.328125 | 2 |
plot_result.py | PrimordialOcean/diffusion-plagioclase | 0 | 24586 | import matplotlib.pyplot as plt
import pandas as pd
def main():
times = [ 1, 100, 365, 365*20, 365*100, 100000]
df = pd.read_csv('tmp.csv')
df_ini = pd.read_csv("initial_value.csv")
xan_measured = (df_ini["distance"], df_ini["XAn"])
df_m = pd.read_csv('measured_value.csv')
measured_da... | 3.09375 | 3 |
tests/unit/test_core_context.py | nickchen-mitac/fork | 0 | 24587 | <reponame>nickchen-mitac/fork
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import pytest
from pydispatch import dispatcher
from ava.core.context import Context, get_core_context
class MockAgent(object):
def __init__(self):
self.greenlets = []
se... | 1.96875 | 2 |
Nitesh-Bhosle-Visualization-for-company-stakeholders/code.py | Niteshnupur/greyatom-python-for-data-science | 3 | 24588 | <reponame>Niteshnupur/greyatom-python-for-data-science
# --------------
# Loan Status
# Loan Status
# Let's start with the simple task of visualizing the company's record with respect to loan approvals.
#Importing header files
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# The path ... | 4.34375 | 4 |
tests/migration_tests.py | psbsgic/rabbitai | 0 | 24589 | <gh_stars>0
import json
from rabbitai.migrations.versions.fb13d49b72f9_better_filters import (
Slice,
upgrade_slice,
)
from .base_tests import RabbitaiTestCase
class TestMigration(RabbitaiTestCase):
def test_upgrade_slice(self):
slc = Slice(
slice_name="FOO",
viz_type="fi... | 2.140625 | 2 |
pyaz/mariadb/__init__.py | py-az-cli/py-az-cli | 0 | 24590 | '''
Manage Azure Database for MariaDB servers.
'''
from .. pyaz_utils import _call_az
from . import db, server, server_logs
| 1.054688 | 1 |
utils/pvacapi/controllers/database.py | mrichters/pVACtools | 96 | 24591 | import os
import re
import csv
import sys
import json
import yaml
import time
import socket
import connexion
import postgresql as psql
from flask import current_app
from urllib.parse import urlencode
from hashlib import md5
from bokeh.embed import server_document
from .processes import fetch_process, is_running, proce... | 2.453125 | 2 |
BiasedPUlearning/nnPUSB/model.py | XINGXIAOYU/PUlearning | 24 | 24592 | import numpy as np
import chainer
from chainer import cuda, Function, gradient_check, Variable
from chainer import optimizers, serializers, utils
from chainer import Link, Chain, ChainList
import chainer.functions as F
import chainer.links as L
class normalNN(Chain):
def __init__(self, dim):
super().__ini... | 2.546875 | 3 |
scripts/set_examples_to_doc.py | sasmirnov/numba-dppy | 0 | 24593 | """ This script is needed to convert gdb scripts from commands to documentation
"""
import os
def convert_commands_to_docs():
commands_dir = os.getcwd() + "/numba_dppy/examples/debug/commands"
examples = os.listdir(commands_dir)
os.chdir(commands_dir + "/docs")
for file in examples:
if file !=... | 3.21875 | 3 |
Phidget22/Devices/Accelerometer.py | keysie/python-fast-data-visualization | 1 | 24594 | <filename>Phidget22/Devices/Accelerometer.py<gh_stars>1-10
import sys
import ctypes
from Phidget22.PhidgetSupport import PhidgetSupport
from Phidget22.PhidgetException import PhidgetException
from Phidget22.Phidget import Phidget
class Accelerometer(Phidget):
def __init__(self):
Phidget.__init__(self)
self.hand... | 2.46875 | 2 |
prickly-pufferfish/python_questions/merge_ranges.py | Vthechamp22/summer-code-jam-2021 | 40 | 24595 | <filename>prickly-pufferfish/python_questions/merge_ranges.py
"""
In HiCal, a meeting is stored as tuples of integers (start_time, end_time). /
These integers represent the number of 30-minute blocks past 9:00am. /
For example: /
(2, 3) # meeting from 10:00 - 10:30 am /
(6, 9) # meeting from 12:00 - 1:30 pm /
Write a f... | 2.984375 | 3 |
tests/tokenizers.py | theeluwin/textrankr | 219 | 24596 | import json
import requests
from typing import List
from konlpy.tag import Okt
from requests.models import Response
class OktTokenizer:
"""
A POS-tagger based tokenizer functor. Note that these are just examples. The `phrases` function usually gives a better result than an ordinary POS tokenizer.
... | 3.171875 | 3 |
Module/engine.py | NoahSchiro/physics-engine | 0 | 24597 | from free_bodies import *
# This is the actual engine which is apply physics to objects
class physics_engine:
FB = [] # Array holds all of the objects in our simulation. FB = free bodies
# Add free bodies to the system
def add_fb(self, fb):
self.FB.append(fb)
# Remove a free body fro... | 3.53125 | 4 |
venv/lib/python3.8/site-packages/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/psapi.py | GiulianaPola/select_repeats | 2 | 24598 | <filename>venv/lib/python3.8/site-packages/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/psapi.py
/home/runner/.cache/pip/pool/57/99/fd/1d22e7d1fbf9ab07bcdf332318605c4de276c282734bf85d8c6421a6ce | 1.054688 | 1 |
tests/test_spi.py | petermankowski510/python-periphery-master | 0 | 24599 | <reponame>petermankowski510/python-periphery-master<filename>tests/test_spi.py
import sys
import periphery
from .asserts import AssertRaises
if sys.version_info[0] == 3:
raw_input = input
spi_device = None
def test_arguments():
print("Starting arguments test...")
# Invalid mode
with AssertRaises(Va... | 2.46875 | 2 |