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/fiaas_deploy_daemon/test_logsetup.py | ariadnarouco/fiaas-deploy-daemon | 57 | 45100 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8
# Copyright 2017-2019 The FIAAS Authors
#
# 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/LIC... | 1.828125 | 2 |
vibromaf/signal/spectrum.py | hofbi/vibromaf | 1 | 45101 | """Spectrum module"""
import numpy as np
from scipy.stats import norm
def pow2db(power: np.array) -> np.array:
"""
Convert power to decibels
https://de.mathworks.com/help/signal/ref/pow2db.html
"""
return 10.0 * np.log10(power)
def db2pow(decibel: np.array) -> np.array:
"""
Convert deci... | 2.984375 | 3 |
src/condor_tests/ornithology/io.py | sridish123/htcondor | 217 | 45102 | <reponame>sridish123/htcondor
# Copyright 2019 HTCondor Team, Computer Sciences Department,
# University of Wisconsin-Madison, WI.
#
# 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:... | 2.40625 | 2 |
pfproject_py/pfgrid.py | assassin945/PixelFight | 2 | 45103 | <reponame>assassin945/PixelFight<filename>pfproject_py/pfgrid.py
# !/usr/bin/env python3
# -*- coding:utf-8 -*-
__author__ = '<NAME>'
__date__ = '2018/7/20 22:01'
import taginfo
class GridTag(object):
type_land = 'land'
attribution_empty = 'empty'
class PixelGrid(object):
def __init__(self, *, ptype=G... | 2.515625 | 3 |
example_snippets/multimenus_snippets/Snippets/SciPy/Physical and mathematical constants/CODATA physical constants/N/natural unit of mom.um in MeVc.py | kuanpern/jupyterlab-snippets-multimenus | 0 | 45104 | <reponame>kuanpern/jupyterlab-snippets-multimenus<filename>example_snippets/multimenus_snippets/Snippets/SciPy/Physical and mathematical constants/CODATA physical constants/N/natural unit of mom.um in MeVc.py
constants.physical_constants["natural unit of mom.um in MeV/c"] | 1.148438 | 1 |
tools/console.py | mhlyv/pico-chip8 | 0 | 45105 | <filename>tools/console.py
#!/usr/bin/env python3
import serial
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("device", help="serial device to use")
parser.add_argument("-b", "--baud-rate", type=int,
default=115200, help="baud rate")
args = parser.parse_args()
def read_as... | 3.21875 | 3 |
api/handler.py | ClayAssis/HEALTH-INSURANCE-CROSS-SELL-PREDICTION | 3 | 45106 | <reponame>ClayAssis/HEALTH-INSURANCE-CROSS-SELL-PREDICTION
import joblib
import pandas as pd
from crosssell.CrossSell import CrossSell
from flask import Flask, request, Response
## Loading Model
model = joblib.load('../models/linear_regression_cycle1.joblib')
## initialize API
app = Flask(__name__)
@app.route('/cros... | 2.796875 | 3 |
tests/models/FiBiNET_test.py | shenweichen/mlmodels | 0 | 45107 | import pytest
from deepctr.models import FiBiNET
from ..utils import check_model, SAMPLE_SIZE, get_test_data, get_test_data_estimator, check_estimator, TEST_Estimator
@pytest.mark.parametrize(
'bilinear_type',
["each",
"all", "interaction"]
)
def test_FiBiNET(bilinear_type):
model_name = "FiBiNET"
... | 2.15625 | 2 |
storm/internal_types/asgi/events.py | Rud356/Storm | 1 | 45108 | from abc import ABC, abstractmethod
from .base_event import Event
from .supported_types import ASGI_SUPPORTED_TYPES
class HttpEvent(Event, ABC):
"""
Base class for http related events.
"""
class HttpSendEvent(HttpEvent, ABC):
"""
Event for sending data via http protocol.
"""
@abstractm... | 3.109375 | 3 |
config/models/transformer.py | IdiosyncraticDragon/OpenNMT-tf | 2 | 45109 | <reponame>IdiosyncraticDragon/OpenNMT-tf
from opennmt.models.catalog import Transformer
model = Transformer
| 0.917969 | 1 |
config.py | ilpan/feishu-errbot-backend | 3 | 45110 | import logging
BACKEND = 'Feishu'
BOT_EXTRA_BACKEND_DIR = r'<path/to/feishu-errbot-backend>'
BOT_DATA_DIR = r'<path/to/your/errbot/data/directory>'
BOT_EXTRA_PLUGIN_DIR = r'<path/to/your/errbot/plugin/directory>'
BOT_LOG_FILE = r'<path/to/your/errbot/logfile.log>'
BOT_LOG_LEVEL = logging.INFO
BOT_IDENTITY = {
"... | 1.578125 | 2 |
plotly/tests/test_core/test_graph_objs/test_frames.py | SamLau95/plotly.py | 2 | 45111 | from __future__ import absolute_import
from unittest import TestCase
from plotly import exceptions
from plotly.graph_objs import Bar, Frames
class FramesTest(TestCase):
def test_instantiation(self):
native_frames = [
{},
{'data': []},
'foo',
{'data': [],... | 2.6875 | 3 |
build/lib/pyhpeimc/version.py | HPNetworking/HP-Intelligent-Management-Center | 13 | 45112 | def version():
"""Function takes no aruguments and returns a STR value of the current version of the library. This value should match
the value in the setup.py
:param None
:return str value of the current version of the library
:rtype str
>>> version()
1.0.33
"""
print ('1.0.34') | 2.0625 | 2 |
main.py | m-zakeri/ADAFEST | 2 | 45113 | <reponame>m-zakeri/ADAFEST
"""
The main module of DAFEST project.
ADAFEST is an abbreviation: 'A Data-Driven Approach to Estimating / Evaluating Software Testability'
The full version of source code will be available
as soon as the relevant paper(s) are published.
"""
class Main():
"""Welcome to project ADAFE... | 2.015625 | 2 |
finders/sublime.py | commoncode/djangogirls-offline | 0 | 45114 | <filename>finders/sublime.py
def sublime():
return [
('MacOS', 'https://download.sublimetext.com/Sublime%20Text%20Build%203126.dmg', 'sublime/sublime.dmg'),
('Windows (32-bit)', 'https://download.sublimetext.com/Sublime%20Text%20Build%203126%20Setup.exe', 'sublime/sublime-x86.exe'), # noqa
... | 2.046875 | 2 |
rsm/scripts/download_ravdess.py | Cerenaut/rsm | 0 | 45115 | """Downloads the RAVDESS Video Dataset."""
import os
import sys
import zipfile
import argparse
import urllib.request
NUM_ACTORS = 24
DATA_TYPES = ['song', 'speech']
BASE_DOWNLOAD_URL = 'https://zenodo.org/record/1188976/files/{0}?download=1'
def main(dest):
for datatype in DATA_TYPES:
base_filename = 'Video_... | 2.96875 | 3 |
src/gruenbeck/requests/__init__.py | xancoder/gruenbeck | 0 | 45116 | import random
import xml.etree.ElementTree
import requests
def get_data(host, parameters):
result_data = {}
url = f'http://{host}/mux_http'
request_id = random.randint(4000, 6000)
payload_header = f'id={request_id}&show='
data = '|'.join(parameters)
payload = f'{payload_header}{data}~'
... | 2.578125 | 3 |
lambdata_trevorjames/function_tests.py | trevorwjames/lamdata | 0 | 45117 | """
Tests for python modules
"""
import unittest
# testing two different functions in my package
from lambdata_trevorjames.things import Character, Wizard
# import from other modules for testing
class UnitTests(unittest.TestCase):
def test_character(self):
"""Testing Character feilds are met"""
x... | 3.46875 | 3 |
barbados_stockex_scraper/spiders/bb_trading.py | chrisdev/barbados_stockex_scraper | 1 | 45118 | <reponame>chrisdev/barbados_stockex_scraper
from scrapy.spider import Spider
from dateutil.parser import parse
from datetime import date
from barbados_stockex_scraper.items import PDFItem
from dateutil import rrule
from dateutil.rrule import MO, TU, WE, TH, FR
def bdate_range(start, end):
return rrule.rrule(
... | 2.65625 | 3 |
bin/tools/test_cam.py | wew84/cnn_hmi | 0 | 45119 | <filename>bin/tools/test_cam.py<gh_stars>0
import rospy
import numpy as np
import timeit
COMPRESSED = False
if not COMPRESSED:
from cv_bridge import CvBridge, CvBridgeError
from sensor_msgs.msg import Image
else:
import numpy as np
import cv2
from sensor_msgs.msg import CompressedImage
class tes... | 2.515625 | 3 |
amplify/backend/function/plateletImageResize/src/index.py | LamVu1/platelet | 17 | 45120 | import boto3
import os
import uuid
from urllib.parse import unquote_plus
from PIL import Image
s3_client = boto3.client('s3')
def resize_image(picture_file_path, crop_dimensions=None):
# get the profile pics store ready
image = Image.open(picture_file_path)
if crop_dimensions:
image = image.crop(c... | 2.296875 | 2 |
Source Code/10 fold cross validation using LightGBM .py | AbhibhavS/AE-LGBM | 0 | 45121 | <gh_stars>0
import os
import numpy as np
import pandas as pd
import math
import lightgbm as lgb
from sklearn.metrics import confusion_matrix
#os.chdir('C:/Protein')
# load or create your dataset
Mydata = pd.read_csv("gbm_human.csv", header=0)
Mydata.columns.name = None
data = Mydata.drop(Mydata.col... | 2.546875 | 3 |
files/tag_analysis/test_grapher.py | AzureBlueCobalt/analyze-gelbooru | 0 | 45122 | import numpy as np
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
def data_to_2d_heatmap(X):
pca = PCA(n_components=2)
pca.fit(X)
X_simple = pca.transform(X)
X_simple = np.array(X_simple)
# print(X_simple)
x_simple = X_simple[:,0]
y_simple = X_simple[:,1]
# fig, ax = pl... | 3.046875 | 3 |
hvm/exceptions.py | hyperevo/py-helios-node | 0 | 45123 | class PyEVMError(Exception):
"""
Base class for all py-hvm errors.
"""
pass
class VMNotFound(PyEVMError):
"""
Raised when no VM is available for the provided block number.
"""
pass
class NoGenesisBlockPresent(PyEVMError):
"""
Raised when a block is imported but there is no gen... | 2.578125 | 3 |
tensor2tensor/data_generators/tokenizer.py | vohoaiviet/tensor2tensor | 6 | 45124 | # Copyright 2017 The Tensor2Tensor Authors.
#
# 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 ... | 2.71875 | 3 |
built-in/ACL_PyTorch/Official/cv/DB_for_PyTorch/test/parse.py | Ascend/modelzoo | 12 | 45125 | <filename>built-in/ACL_PyTorch/Official/cv/DB_for_PyTorch/test/parse.py
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | 2.203125 | 2 |
scripts/run_scripts/main.py | ECP-copa/CabanaPIC | 10 | 45126 | from git import Repo
import subprocess
import os, shutil
# I use this later to lazily generate an error with a message
class CustomError(Exception):
pass
repo_path = "../../"
r = Repo(repo_path)
repo_heads = r.heads # or it's alias: r.branches
repo_heads_names = [h.name for h in repo_heads]
#kokkos_src = '/Users... | 2.265625 | 2 |
clam/utils/converters.py | Clam-Bot/Clam | 0 | 45127 | <gh_stars>0
from discord.ext import commands
from .formats import plural
class StringMaxLengthConverter(commands.Converter):
"""A converter that only accepts strings under a certain length."""
def __init__(self, length):
super().__init__()
self.length = length
async def convert(self, ctx... | 3.140625 | 3 |
src/cfcs/__init__.py | KamasamaK/sublimetext-cfml | 0 | 45128 | <gh_stars>0
from .cfcs import build_project_cfcs
from .completions import get_dot_completions
from .documentation import get_inline_documentation, get_goto_cfml_file, get_completions_doc, get_method_preview
from .di import CfmlDiPropertyCommand
from .. import completions, inline_documentation, goto_cfml_file, method_pr... | 1.367188 | 1 |
xeda/flows/vivado/vivado.py | XedaHQ/xeda | 16 | 45129 | # © 2020 [<NAME>](mailto:<EMAIL>)
import html
import logging
from xeda.utils import try_convert
from xml.etree import ElementTree
from ..flow import Flow, DebugLevel
from functools import reduce
logger = logging.getLogger()
def supported_vivado_generic(k, v, sim):
if sim:
return True
if isinstance(v,... | 1.96875 | 2 |
misago/misago/socialauth/admin/tests/test_providers_list.py | vascoalramos/misago-deployment | 2 | 45130 | from django.urls import reverse
admin_link = reverse("misago:admin:settings:socialauth:index")
def test_providers_list_renders(admin_client):
response = admin_client.get(admin_link)
assert response.status_code == 200
def test_providers_list_renders_with_active_provider(admin_client, provider):
respons... | 1.914063 | 2 |
AoC20/day_01/__init__.py | a-recknagel/AoC20 | 0 | 45131 | example_data = """\
1721
979
366
299
675
1456\
"""
data = """\
1914
1931
1892
1584
1546
1988
1494
1709
1624
1755
1849
1430
1890
1675
1604
1580
1500
1277
1729
1456
2002
1075
1512
895
1843
1921
1904
1989
1407
1552
1714
757
1733
1459
1777
1440
1649
1409
1662
1968
1775
1998
1754
1938
1964
1415
1990
1997
1870
1664
1145
178... | 1.632813 | 2 |
src/flax_extra/training/__init__.py | manifest/flax-extra | 0 | 45132 | r"""Training API."""
from flax_extra.training._loop import TrainLoop, TrainTask
__all__ = [
"TrainLoop",
"TrainTask",
]
| 1.148438 | 1 |
users/management/commands/export_user.py | iloveitaly/crypto-index-fund-bot | 37 | 45133 | import json
from django.core.management.base import BaseCommand, CommandError
from users.models import User
class Command(BaseCommand):
help = "Exports a user information as a set of environment variables"
def add_arguments(self, parser):
parser.add_argument("user_id", type=int)
def handle(sel... | 2.3125 | 2 |
api-examples/dh_py_access/lib/dataset.py | evan1997123/PlanetOSDatathon | 87 | 45134 | # -*- coding: utf-8 -*-
import requests
import pandas as pd
from netCDF4 import Dataset
# from lib.parse_urls import parse_urls
from . parse_urls import parse_urls
class dataset:
def __init__(self,datasetkey,datahub):
self.datasetkey = datasetkey
self.datahub=datahub
def variables(self):
... | 2.703125 | 3 |
contact_calc/stratify_hbonds.py | jpaggi/getcontacts | 0 | 45135 | <reponame>jpaggi/getcontacts
############################################################################
# Copyright 2018 <NAME> & Stanford University #
# #
# Licensed under the Apache License, Version 2.0 (the "License")... | 1.46875 | 1 |
workshops/test/test_person.py | r-gaia-cs/swc-amy | 0 | 45136 | <reponame>r-gaia-cs/swc-amy<gh_stars>0
from django.core.urlresolvers import reverse
from ..models import Person
from .base import TestBase
class TestPerson(TestBase):
'''Test cases for persons.'''
def setUp(self):
super().setUp()
self._setUpUsersAndLogin()
def test_display_person_correct... | 2.203125 | 2 |
project_name/urls.py | hotbaby/django-project-skeleton | 1 | 45137 | """{{ project_name }} URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
"""
# Django imports
from django.conf.urls import include, url
urlpatterns = [
# Examples:
# url(r'^blog/', include('blog.urls', na... | 1.914063 | 2 |
moviebot/nlu/annotation/values.py | benebjoern/XAI_MovieBot | 2 | 45138 | <filename>moviebot/nlu/annotation/values.py
"""This file contains the list of possible slot values other than the values
fetched from the database.
This approach will help the dialogue state tracker to update state for specific
type of slot values easily"""
__author__ = '<NAME>'
from enum import Enum
class Values(E... | 2.921875 | 3 |
app.py | AbovePlanet302/logviewer | 0 | 45139 | <reponame>AbovePlanet302/logviewer
import os
from sanic import Sanic, response
from motor.motor_asyncio import AsyncIOMotorClient
from renderer import LogEntry
app = Sanic(__name__)
@app.listener('before_server_start')
async def init(app, loop):
app.db = AsyncIOMotorClient(os.getenv('MONGO_URI')).modmail_bot
... | 2.1875 | 2 |
tests/test_tours.py | DavidNKraemer/ams553-final-project | 0 | 45140 | from src import tours
import numpy as np
tolerance = 1e-4
def test_tour_traversal():
square = np.array([[0, 0], [0, 1], [1, 1], [1, 0.]])
tour = [0, 1, 2, 3]
assert abs(tours.tour_traversal(tour, square) - 4.) < tolerance
| 2.578125 | 3 |
tests/app/storage/test_dynamo_api.py | uk-gov-mirror/ONSdigital.eq-survey-runner | 27 | 45141 | <filename>tests/app/storage/test_dynamo_api.py
from botocore.exceptions import ClientError
from flask import current_app
from app.storage import dynamo_api
from tests.app.app_context_test_case import AppContextTestCase
KEY = {'user_id': 'someuser'}
class TestDynamoApi(AppContextTestCase):
def test_get_update(... | 2.234375 | 2 |
doobi/recc/serializers.py | bryanopew/doobi | 0 | 45142 | <reponame>bryanopew/doobi<gh_stars>0
from . models import Cal_result, Foods, Profile, Recc_result
from rest_framework import serializers
class ProfileForReccSerializer(serializers.ModelSerializer):
class Meta:
model = Profile
fields = "__all__"
class CalResultSerializer(serializers.ModelSerializer... | 2.171875 | 2 |
Problema 2/Problema2.py | ItaloCcosccoAlvis/ADA-UNSA---Lab2 | 0 | 45143 | # Problema 2
# Generar una arreglo invertido de n números y después buscar un elemento
def generateList(size):
return list(range(size,0,-1))
def searchInvertArray(array, element):
for i in range(0,len(array)):
if array[i] == element:
return True
return False
# Casos de pru... | 3.921875 | 4 |
train.py | Akanni96/TRUNET | 4 | 45144 | from netCDF4 import Dataset, num2date
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true'
import argparse
import ast
import gc
import logging
import math
import sys
import time
import numpy as np
import pandas as pd
import psutil
import tensorflow as t... | 2.25 | 2 |
CAAPR/CAAPR_AstroMagic/PTS/pts/modeling/misc/playground.py | wdobbels/CAAPR | 7 | 45145 | <filename>CAAPR/CAAPR_AstroMagic/PTS/pts/modeling/misc/playground.py
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# ... | 1.828125 | 2 |
src/compute_paper_sketches.py | Synerise/kdd-cup-2021 | 13 | 45146 | <reponame>Synerise/kdd-cup-2021
import argparse
import random
import os
import math
import numpy as np
from tqdm import tqdm
from coders import get_vcoder
from root import ROOT
def get_parser():
parser = argparse.ArgumentParser()
parser.add_argument("--working-dir", type=str, default = 'data', help='Working d... | 2.1875 | 2 |
Contrib-Inspur/openbmc/poky/bitbake/lib/toaster/tests/functional/test_functional_basic.py | opencomputeproject/Rack-Manager | 5 | 45147 | #! /usr/bin/env python
#
# BitBake Toaster functional tests implementation
#
# Copyright (C) 2017 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0-only
#
import time
import re
from tests.functional.functional_helpers import SeleniumFunctionalTestCase
from orm.models import Project
class FuntionalTestBasic(Selen... | 2.4375 | 2 |
main-test.py | bpoje/checkmk-python-rest-api | 0 | 45148 | <reponame>bpoje/checkmk-python-rest-api
#!/bin/python3
from Checkmk import *
import re as re
import time
#Init checkmk rest api
def init_checkmk(site_name, cmk_rest_url, cafile, username, secret_token_filename):
# Read secret token from disk
secret_token = open(secret_token_filename,'r').readline().strip('\n'... | 2.359375 | 2 |
reportportal_client/items/rp_test_items/rp_child_test_item.py | buchi-busireddy/client-Python | 0 | 45149 | """
This module contains functional for Child RP test items management.
Copyright (c) 2018 http://reportportal.io .
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.84375 | 2 |
bs_3 Navigating the tree Going back and forth.py | ronaldoapsilva/Beatiful_Soup | 0 | 45150 | #https://www.crummy.com/software/BeautifulSoup/bs4/doc/#strings-and-stripped-strings
html_doc = """<html><head><title>The Dormouse's story</title></head>
<body>
<p class="title"><b>The Dormouse's story</b></p>
<p class="story">Once upon a time there were three little sisters; and their names were
<a href="http://exam... | 3.6875 | 4 |
src/utils_evaluation.py | stefanialvs/PyForecast | 0 | 45151 | import numpy as np
from numpy.random import seed
seed(1)
import pandas as pd
from math import sqrt
from sklearn.decomposition import PCA
######################################################################
# METRICS
######################################################################
def mse(y, y_hat):
"""
... | 3.859375 | 4 |
face_recog.py | a4aakash/Computer-Vision | 2 | 45152 | <reponame>a4aakash/Computer-Vision<filename>face_recog.py<gh_stars>1-10
import face_recognition
import cv2
import numpy as np
video_capture = cv2.VideoCapture(0)
# Load sample
image1 = face_recognition.load_image_file("Your Image Here with extension")
encoding1 = face_recognition.face_encodings(image1)[0]
known_fac... | 3.015625 | 3 |
tests/regressiontests/initial_sql_regress/tests.py | alex/django-old | 2 | 45153 | <reponame>alex/django-old
from django.test import TestCase
from models import Simple
class InitialSQLTests(TestCase):
def test_initial_sql(self):
self.assertEqual(Simple.objects.count(), 7)
| 2.078125 | 2 |
src/rmi/bibliotheque.py | e-yuzo/distributed-systems-for-fun | 0 | 45154 | from __future__ import print_function
import Pyro4
@Pyro4.expose
class Bibliotheque(object):
books = []
def __init__(self):
self.books = []
def add(self, book):
self.books.append(book)
print("added")
def rm(self, book):
for b in self.books:
if b.title... | 2.984375 | 3 |
statarb/src/python/bin/db_check.py | mikimaus78/ml_monorepo | 51 | 45155 | #!/usr/bin/env python
import util
import newdb
from collections import Counter
from collections import deque
#Check if two rows have equal values in the keys attributes
def __compare(row1,row2,keys):
equal=True
for key in keys:
if row1[key]!=row2[key]:
equal=False
break
ret... | 2.953125 | 3 |
onepanman_api/migrations/0014_auto_20200319_1740.py | Capstone-onepanman/api-server | 0 | 45156 | # Generated by Django 2.2.10 on 2020-03-19 08:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('onepanman_api', '0013_auto_20200319_1714'),
]
operations = [
migrations.AlterField(
model_name='problem',
name='rul... | 1.515625 | 2 |
ejer/Dia_5.py | zara-ms/python_class-2 | 0 | 45157 | <gh_stars>0
### EGQuery
from Bio import Entrez
Entrez.email = "<EMAIL>"
### termino = "(Aedes[Title] OR Aedes[All Fields])AND((RNA-Seq[Title] OR transcriptomic[Title]) OR (transcriptome[Title] OR sequencing[Title]))"
### handle = Entrez.egquery(term=termino)
### record = Entrez.read(handle)
### handle.close()
... | 2.390625 | 2 |
src/Themes/TransformationTheme.py | LukasTinnes/VenturePainter | 1 | 45158 | <reponame>LukasTinnes/VenturePainter<filename>src/Themes/TransformationTheme.py
from .Theme import Theme
from src.Graph import Graph
class TransformationTheme(Theme):
def __init__(self):
super().__init__()
self.size_max = 0
self.size_min = 0
self.width_min = 0
self.width_... | 2.625 | 3 |
cinderlib/tests/unit/objects/test_snapshot.py | Akrog/cinderlib | 15 | 45159 | <filename>cinderlib/tests/unit/objects/test_snapshot.py
# Copyright (c) 2018, Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://... | 2.0625 | 2 |
sync/settings.py.template.py | Smithsonian/Osprey | 2 | 45160 | #ID of the project
project_id = ""
#List of paths where the folders to check are
project_paths = []
#Destination of the sync, trailing slash
destination_path = ""
##################################
#Postgres database and rw user
##################################
db_host = ""
db_db = ""
db_user = ""
... | 1.539063 | 2 |
deepART/nlp/text_preproc/__init__.py | nicholaslaw/deepART | 1 | 45161 | from .preprocessors import *
from .corpus_handler import *
from .bow_vectorizer import * | 0.871094 | 1 |
Python/Algorithms/64.py | DimitrisJim/leetcode_solutions | 2 | 45162 | class Solution:
def summaryRanges(self, nums):
if not nums:
return nums
results = []
start = end = nums[0]
for i in nums:
if i != end:
rng = f"{start}->{end-1}" if start != (end - 1) else f"{start}"
results.append(rng)
... | 3.078125 | 3 |
Python Files/preprocessing.py | errohankumar/thesis | 0 | 45163 | import os
import pandas as pd
from datetime import datetime
from preprocessing_service import PreProcessingService
class PreProcessing(PreProcessingService):
"""
A class used to automatically scrape CSV files from ENTSOE Transparecny Platform
...
Attributes
----------
_preProcessing : str
... | 3.484375 | 3 |
app/models/shop/footprint.py | Hugking/lin-cms-flask | 0 | 45164 | <reponame>Hugking/lin-cms-flask
from lin.exception import NotFound, ParameterException
from lin.interface import InfoCrud as Base
from sqlalchemy import Column, String, Integer, Text,ForeignKey, DateTime
class Footprint(Base):
id = Column(Integer, primary_key=True, autoincrement=True)
member_id = Column(Intege... | 2.078125 | 2 |
src/integrated_models/commons/vehicle_schedule.py | railtoolkit/OpenLinTim | 0 | 45165 | import logging
from typing import List
from typing import Dict
import line_data
import ean_data
from core.model.ptn import Stop
from core.util.constants import SECONDS_PER_MINUTE
from parameters import VSParameters
logger = logging.getLogger(__name__)
class VehicleSchedule:
def __init__(self, line_pool: line_da... | 2.546875 | 3 |
input_data.py | Alebat/C3D-tensorflow | 0 | 45166 | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 2.609375 | 3 |
ref/commandlinearguments/demo.py | skrymets/python-core-and-advanced | 2 | 45167 | <filename>ref/commandlinearguments/demo.py
import sys
lst=sys.argv
for i in lst:print(i)
print(len(lst))
print(lst[0]) | 2.59375 | 3 |
LeetCode/algorithms/n-queens-ii/solution.py | cuihaoleo/exercises | 1 | 45168 | <reponame>cuihaoleo/exercises
class Solution:
def totalNQueens(self, n: int) -> int:
def dfs(row):
if row == 0:
return 1
count = 0
for col in range(n):
if col not in col_blacklist and \
row - col not in major_blacklist a... | 3.0625 | 3 |
neural_pi/estimator/optimization.py | tarik/pi-snm-qde | 8 | 45169 | import torch
__all__ = [
'Adam',
'SGD',
'ExponentialDecay'
]
Adam = torch.optim.Adam
SGD = torch.optim.SGD
class ExponentialDecay(torch.optim.lr_scheduler.LambdaLR):
"""
See: https://www.tensorflow.org/api_docs/python/tf/train/exponential_decay.
`lr = initial_lr * decay_rate ^ (step / deca... | 2.609375 | 3 |
wharf_management/wharf_management/doctype/security_check/security_check.py | staumoepeau/pms | 1 | 45170 | <filename>wharf_management/wharf_management/doctype/security_check/security_check.py
# -*- coding: utf-8 -*-
# Copyright (c) 2017, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe impor... | 2.109375 | 2 |
python/tvm/tensor_graph/testing/datasets/mnist.py | QinHan-Erin/AMOS | 22 | 45171 | import torch
import torchvision
from torchvision import transforms
def load_mnist_dataset(train_batch_size, test_batch_size=1):
train_set = torchvision.datasets.MNIST(".", train=True, transform=transforms.Compose([transforms.ToTensor()]), download=True)
test_set = torchvision.datasets.MNIST(".", train=False, ... | 2.796875 | 3 |
src/python/WMCore/WMBS/MySQL/Locations/GetSiteInfo.py | khurtado/WMCore | 21 | 45172 | #!/usr/bin/env python
"""
_GetSiteInfo_
MySQL implementation of Locations.GetSiteInfo
"""
from WMCore.Database.DBFormatter import DBFormatter
class GetSiteInfo(DBFormatter):
"""
Grab all the relevant information for a given site.
Usually useful only in the submitter
"""
sql = """SELECT wl.site_n... | 2.59375 | 3 |
LSD/RMQ/__init__.py | Fabianexe/superbubble | 1 | 45173 | <gh_stars>1-10
"""
Thise source code is from
https://codereview.stackexchange.com/questions/154047/dynamic-programming-based-range-minimum-query
And stands so under Creative Commons Licensing
"""
from itertools import product
class RangeQuery(object):
"""Data structure providing efficient range queries."""
... | 3.1875 | 3 |
setup.py | JanviRaina/openodia | 0 | 45174 | """Setup script for openodia
Referred: https://github.com/realpython/reader/blob/master/setup.py
https://realpython.com/pypi-publish-python-package/
"""
import os.path
from setuptools import find_packages, setup
# The directory containing this file
HERE = os.path.abspath(os.path.dirname(__file__))
# Th... | 1.78125 | 2 |
MLE.py | tutan0558/Stevens-FE800-Group16-18Spring | 0 | 45175 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 21 18:22:32 2018
@author: 79127
"""
import numpy as np
from scipy.optimize import minimize
import math
import pandas as pd
minimize?
def LL(params, data):
'''
params is a ndarray, [mean, variance, skew, kurt]
'''
mean = params[0]
sig... | 2.953125 | 3 |
tests/cli_helper.py | neusse/ksconf | 51 | 45176 | from __future__ import absolute_import, print_function, unicode_literals
import os
import shutil
import stat
import sys
import tempfile
from io import StringIO, open
from subprocess import list2cmdline
from textwrap import dedent
import ksconf.ext.six as six
from ksconf.__main__ import cli
from ksconf.conf.parser im... | 2.1875 | 2 |
setup.py | Nathaniel-Rodriguez/reservoirlib | 4 | 45177 | from setuptools import setup
setup(name='reservoirlib',
version='0.1',
description='Python 3 library that provides utilities for creating and'
' training reservoir computers.',
author='<NAME>',
packages=['reservoirlib'],
url='https://github.com/Nathaniel-Rodriguez/reserv... | 1.171875 | 1 |
botstory/chat_test.py | botstory/bot-story | 5 | 45178 | <gh_stars>1-10
import aiohttp
import logging
import pytest
from botstory import Story
import botstory.integrations.fb.messenger
from botstory.middlewares import location
from botstory.utils import answer, SimpleTrigger
logger = logging.getLogger(__name__)
@pytest.fixture()
def mock_interface(mocker):
mocker.pat... | 2.078125 | 2 |
Python/Deep Learning/Krish Naik/How to Select how many hidden layer and neurons in a neural network.py | omkarsutar1255/Python-Data | 0 | 45179 | # todo: How to Select how many hidden layer and neurons in a neural network
# Importing the libraries
import pandas as pd
from keras.models import Sequential
from keras.layers import Dense, Activation
# Importing the dataset
dataset = pd.read_csv('Churn_Modelling.csv')
X = dataset.iloc[:, 3:13].values
y = dataset.ilo... | 3.5625 | 4 |
proxy.py | thinkmassive/mattermost-webhook-slack-proxy | 2 | 45180 | <reponame>thinkmassive/mattermost-webhook-slack-proxy
from mitmproxy import http
import json
def request(flow):
if "content-type" not in flow.request.headers:
return
if "application/json" in flow.request.headers["content-type"]:
slack_json = json.loads(flow.request.text)
if "blocks" in ... | 2.359375 | 2 |
tests/resources/test_processor.py | jspeerless/citrine-python | 23 | 45181 | <gh_stars>10-100
import uuid
from citrine.resources.processor import ProcessorCollection
def test_processor_build():
# Given
collection = ProcessorCollection(uuid.uuid4(), None)
processor_id = uuid.uuid4()
processor_data = {
'id': str(processor_id),
'config': {
'type': 'En... | 2.515625 | 3 |
tofu/geom/_comp.py | Louwrensth/tofu | 0 | 45182 | """
This module is the computational part of the geometrical module of ToFu
"""
# Built-in
import sys
import warnings
# Common
import numpy as np
import scipy.interpolate as scpinterp
import scipy.integrate as scpintg
if sys.version[0]=='3':
from inspect import signature as insp
elif sys.version[0]=='2':
from... | 2.71875 | 3 |
j4j_handler/api_token_handler/j4j_api_token.py | FZJ-JSC/jupyter-jsc-jupyterhub-collection | 0 | 45183 | '''
Created on May 10, 2019
@author: kreuzer
'''
import json
import uuid
import base64
import time
import requests
import os
from contextlib import closing
from jupyterhub.orm import APIToken, User
from jupyterhub.apihandlers.base import APIHandler
class J4J_APITokenHandler(APIHandler):
async def get(self, user... | 2.1875 | 2 |
apps/categorys/models.py | ErikJiang/accountbook_server | 16 | 45184 | from django.db import models
# from django.contrib.auth.models import User
from apps.users.models import CustomUser
# 引入Enum类型
from enum import Enum
from enumfields import EnumIntegerField
class BillType(Enum):
OUTGO = 0 # 账目类型.支出
INCOME = 1 # 账目类型.收入
class Categorys(models.Model):
"""
账目明细分类表
... | 2 | 2 |
src/random_subset.py | KaiFabi/NeuroEvolution | 0 | 45185 | """Random subset dataset.
"""
import random
import numpy as np
import torch
from torch.utils.data import Dataset
from PIL import Image
class RandomSubset(Dataset):
"""Class allows to iterate every epoch through a different random subset of the original
dataset.
The intention behind this class is to spe... | 3.640625 | 4 |
A3C/agent.py | gungui98/deeprl-a3c-ai2thor | 1 | 45186 | <filename>A3C/agent.py
import numpy as np
from keras.optimizers import RMSprop
class Agent:
""" Agent Generic Class
"""
def __init__(self, inp_dim, out_dim, lr, tau = 0.001):
self.inp_dim = inp_dim
self.out_dim = out_dim
self.tau = tau
self.rms_optimizer = RMSprop(lr=lr, ep... | 2.875 | 3 |
genestack_client/scripts/genestack_user_setup.py | genestack/python-client | 2 | 45187 | <reponame>genestack/python-client
#!python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import input
from... | 2.359375 | 2 |
_task.py | zemogle/twittervotes | 0 | 45188 | from tempfile import mkstemp
import os
import tinys3
def create_temp_file(data):
fd, temp_path = mkstemp()
file = open(temp_path, 'r')
file.write(data)
file.close()
os.close(fd)
return data
def push_to_s3(filepath):
s3 = tinys3.Connection(os.environ['AWS_ACCESS_KEY_ID'],os.environ['AWS_SE... | 2.578125 | 3 |
build_scripts/install_deps.py | kamranrad1993/ngfx | 12 | 45189 | from common import *
os.chdir(EXTERNAL_DIR)
PKGS = env('PKGS', 'all')
ninja_template = read_file(f'{SCRIPT_DIR}/install_deps_{OS_LOWER_CASE}.ninja.in')
write_file(f'install_deps_{OS_LOWER_CASE}.ninja', ninja_template.format(**ENV_PARAMS))
for key, val in ENV_PARAMS.items():
print(f'{key} = {val}')
shel... | 2.203125 | 2 |
ooobuild/lo/inspection/x_property_handler.py | Amourspirit/ooo_uno_tmpl | 0 | 45190 | # coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | 1.414063 | 1 |
en16931/tests/test_tax.py | invinet/python-en16931 | 9 | 45191 | <gh_stars>1-10
import pytest
from collections import Hashable
from en16931.tax import Tax
class TestTaxes:
def test_initialization(self):
t = Tax(0.21, "S", "IVA")
assert t
def test_hashable(self):
t = Tax(0.21, "S", "IVA")
assert isinstance(t, Hashable)
def test_percen... | 2.484375 | 2 |
tools/data/textrecog/lsvt_converter.py | TeyrCrimson/mmocr | 1 | 45192 | <filename>tools/data/textrecog/lsvt_converter.py
# Copyright (c) OpenMMLab. All rights reserved.
import argparse
import json
import math
import os.path as osp
from functools import partial
import mmcv
from mmocr.utils.fileio import list_to_file
def parse_args():
parser = argparse.ArgumentParser(
descrip... | 2.3125 | 2 |
qgisserver/migrations/0012_auto_20190305_1011.py | aroiginfraplan/giscube-admin | 5 | 45193 | <gh_stars>1-10
# Generated by Django 2.1.7 on 2019-03-05 10:11
from django.db import migrations, models
import qgisserver.models
class Migration(migrations.Migration):
dependencies = [
('qgisserver', '0011_auto_20180803_0824'),
]
operations = [
migrations.AlterField(
model_n... | 1.929688 | 2 |
tests/test_error43.py | xlevus/virsh-patcher | 52 | 45194 | <filename>tests/test_error43.py
from xml.etree import ElementTree as ET
import pytest
from virshpatcher.patcher import PatchE43
from conftest import assert_nodes, assert_noop
@pytest.fixture
def klass():
return PatchE43
def test_kvm_hidden(patcher, args, tree):
patcher.patch(tree, args)
assert_nodes(
... | 2.0625 | 2 |
python/tests/structural/test_decorator.py | harkhuang/designpatterns | 0 | 45195 | <reponame>harkhuang/designpatterns<filename>python/tests/structural/test_decorator.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from patterns.structural.decorator import TextTag, BoldWrapper, ItalicWrapper
class TestTextWrapping(unittest.TestCase):
def setUp(self):
self.raw_string = Te... | 2.953125 | 3 |
src/examples/quick.py | CorvusPrudens/Enca | 0 | 45196 |
import re
instr = re.compile(r'[ \t]*[a-z]+ ([a-z0-9\[\]]+,? *)*')
data = []
with open("conditionals.enc", "r") as file:
for line in file:
data.append(line)
from random import choice
conditions = ['zero', 'carry', 'negative', 'equal', 'greater', 'less']
with open("cond.enc", 'w') as file:
for line in data:... | 2.71875 | 3 |
inference/torch_model/transformer/transformer.py | TAViT2022/TAViT | 0 | 45197 | import torch
import torch.nn as nn
from einops.layers.torch import Rearrange
class cnnTransformer(nn.Module):
def __init__(self,
name:str,
n_token:int,
n_embed:int,
n_head:int,
n_hid:int,
n_layer:int,
... | 2.484375 | 2 |
dosu/utils.py | tsandrini/DoSU | 0 | 45198 | <filename>dosu/utils.py
"""
__/\\\\\\\\\\\\______________________/\\\\\\\\\\\____/\\\________/\\\_
_\/\\\////////\\\__________________/\\\/////////\\\_\/\\\_______\/\\\_
_\/\\\______\//\\\________________\//\\\______\///__\/\\\_______\/\\\_
_\/\\\_______\/\\\_____/\\\\\______\////\\\_________\/\\\_______\/\\\_
... | 1.742188 | 2 |
mod/bad_images.py | lokal-profil/isfdb_site | 0 | 45199 | #!_PYTHONLOC
#
# (C) COPYRIGHT 2014-2021 Ahasuerus
# ALL RIGHTS RESERVED
#
# The copyright notice above does not evidence any actual or
# intended publication of such source code.
#
# Version: $Revision$
# Date: $Date$
from isfdb import *
from common import *
from isfdblib import *
from ... | 2.34375 | 2 |