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/python/kaolin/metrics/__init__.py | mlej8/kaolin | 3,747 | 44700 | from . import test_trianglemesh
from . import test_voxelgrid | 0.972656 | 1 |
main/forms.py | anupam-tiwari/Def-Hacks-2020 | 0 | 44701 | <reponame>anupam-tiwari/Def-Hacks-2020
from django import forms
from .models import *
class XrayForm(forms.ModelForm):
class Meta:
model = Xray
fields = ['scan'] | 1.539063 | 2 |
33.search-in-rotated-sorted-array.py | windard/leeeeee | 0 | 44702 | <reponame>windard/leeeeee
# coding=utf-8
#
# @lc app=leetcode id=33 lang=python
#
# [33] Search in Rotated Sorted Array
#
# https://leetcode.com/problems/search-in-rotated-sorted-array/description/
#
# algorithms
# Medium (32.65%)
# Likes: 2445
# Dislikes: 314
# Total Accepted: 421.1K
# Total Submissions: 1.3M
# ... | 3.75 | 4 |
covfuzze/covfuzze.py | guifengwei/CovFuzze | 5 | 44703 | <gh_stars>1-10
#!/usr/bin/env python
#a program to plot gene coverage in multiple samples with peak regions
#<NAME>, 2018
import numpy as np
import pysam
import pandas as pd
import matplotlib
import re
import os
import seaborn as sns
from matplotlib import pyplot as plt
plt.switch_backend('agg')
from matplotlib import... | 2.5625 | 3 |
Day01-15/code/Day15/excel1.py | EngrSaad2/Python-100-Days | 6 | 44704 | <reponame>EngrSaad2/Python-100-Days<gh_stars>1-10
"""
创建Excel文件
Version: 0.1
Author: 骆昊
Date: 2018-03-26
"""
from openpyxl import Workbook
from openpyxl.worksheet.table import Table, TableStyleInfo
workbook = Workbook()
sheet = workbook.active
data = [
[1001, '白元芳', '男', '13123456789'],
[1002, '白洁', '女', '132... | 3.078125 | 3 |
twitter_ads/__init__.py | enterstudio/twitter-python-ads-sdk | 0 | 44705 | <filename>twitter_ads/__init__.py<gh_stars>0
# Copyright (C) 2015 Twitter, Inc.
VERSION = (1, 2, 0)
from twitter_ads.utils import get_version
__version__ = get_version()
| 1.273438 | 1 |
demo/food20/mobilenet_v2.py | wei2374/model_compression | 0 | 44706 | import tensorflow as tf
from tensorflow.keras.applications import MobileNetV2
from tensorflow.keras.layers import Dense, GlobalAveragePooling2D, Add,\
GlobalMaxPooling2D
from tensorflow.keras.models import Model
from tensorflow.keras.optimizers import Adam
def MobileNetV2_avg_max(input_shape, num_classes):
bas... | 2.765625 | 3 |
stacker/setup.py | Ethiopia-COVID19/infrastructure-terrafrom | 3 | 44707 | <reponame>Ethiopia-COVID19/infrastructure-terrafrom
import os
import glob
from setuptools import setup, find_packages
src_dir = os.path.dirname(__file__)
install_requires = [
'stacker',
'stacker_blueprints',
]
tests_require = (
'nose>=1.0',
'mock==1.0.1',
'coverage~=4.3.4',
'flake8'
)
if __... | 1.554688 | 2 |
www/generators/tree_at_bristol.py | mattvenn/cursivedata | 1 | 44708 | <filename>www/generators/tree_at_bristol.py
"""
bugs:
"""
from django.utils.datetime_safe import datetime
from pysvg.builders import *
import pysvg.structure
import math
import random
import logging
log = logging.getLogger('generator')
grid = 21
#measured these
ball_space = 24.5
ball_xoffset = 180 - ball_space
ball_yo... | 2.40625 | 2 |
hydra_plugins/classy_vision_path/classy_vision_path.py | jdsgomes/ClassyVision-1 | 0 | 44709 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from hydra.core.config_search_path import ConfigSearchPath
from hydra.plugins.search_path_plugin import SearchPathPlu... | 1.898438 | 2 |
aries_cloudagent/revocation/models/tests/test_revocation_registry.py | msembinelli/aries-cloudagent-python | 1 | 44710 | import json
import pytest
from asynctest import TestCase as AsyncTestCase, mock as async_mock
from copy import deepcopy
from pathlib import Path
from shutil import rmtree
import base58
from ....config.injection_context import InjectionContext
from ....storage.base import BaseStorage
from ....storage.basic import Ba... | 1.828125 | 2 |
runtests.py | movermeyer/django-aggregate-if | 78 | 44711 | #!/usr/bin/env python
import os
import sys
from optparse import OptionParser
def parse_args():
parser = OptionParser()
parser.add_option('-s', '--settings', help='Define settings.')
parser.add_option('-t', '--unittest', help='Define which test to run. Default all.')
options, args = parser.parse_args(... | 2.296875 | 2 |
Files/Print_text.py | Adian-kids/AWD-Framework-First | 4 | 44712 | import os
def Usage():
print("Commands : ") #输出帮助信息
print("+----------------------------------------------------+")
print("|Num|Command | Describe |")
print("+----------------------------------------------------+")
print("|0. | help | ... | 2.828125 | 3 |
AtlasOEM.py | pratikgharte/Python_GUI_EC_PH | 2 | 44713 | import smbus
class AtlasOEM(object):
DEFAULT_BUS = 1
def __init__(self, address, name = "", bus=None):
self._address = address
self.bus = smbus.SMBus(bus or self.DEFAULT_BUS)
self._name = name
def read_byte(self, reg):
return self.bus.read_byte_data(self._addre... | 3.03125 | 3 |
telemelody/evaluation/cal_similarity.py | BILLXZY1215/muzic | 0 | 44714 | <reponame>BILLXZY1215/muzic
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
import numpy as np
import os
import sys
import miditoolkit
ALIGN = '[align]'
SEP = '[sep]'
Duration_vocab = dict([(129+i, x/100)
for i, x in enumerate(list(ran... | 2.46875 | 2 |
src/cms/contexts/templatetags/unicms_contexts.py | UniversitaDellaCalabria/uniCMS | 6 | 44715 | <gh_stars>1-10
import logging
import urllib
from django import template
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from cms.contexts.models import WebPath, WebSite
from cms.contexts.utils import handle_faulty_templates
logger = logging.getLogger(__name__)
register = templ... | 2.09375 | 2 |
ML1-Supervised-Learning/ML1.2-Regression/rg7_regularization_ridge.py | ridhanf/machine-learning-datacamp | 0 | 44716 | <reponame>ridhanf/machine-learning-datacamp<gh_stars>0
# Import necessary modules
from sklearn.linear_model import Ridge
from sklearn.model_selection import cross_val_score
# Setup the array of alphas and lists to store scores
alpha_space = np.logspace(-4, 0, 50)
ridge_scores = []
ridge_scores_std = []
# Create a rid... | 3.390625 | 3 |
RUN.py | MAXIORBOY/ReflexGame | 0 | 44717 | <reponame>MAXIORBOY/ReflexGame<filename>RUN.py
from Menu import *
from Settings import Settings
class MasterWindow:
def __init__(self):
self.status = True
self.settings = Settings('settings.hdf5')
self.sounds = Sounds()
def turn_off_master(self):
self.status = False
def r... | 2.703125 | 3 |
data/worker.py | suibex/fleonSide | 1 | 44718 | import threading
import os
import obd
from random import random
from pathlib import Path
conn = obd.OBD()
connect = obd.Async(fast=False)
speed=""
fueli=""
tem =""
def get_temp(t):
if not t.is_null():
tem=str(t.value)
if t.is_null():
tem=str(0)
def get_fuel(f):
if n... | 2.75 | 3 |
api/admin.py | titans55/pizza-ordering-service | 1 | 44719 | from django.contrib import admin
from django import forms
from . import models
class PizzaFlavorAdminForm(forms.ModelForm):
class Meta:
model = models.PizzaFlavor
fields = "__all__"
class PizzaFlavorAdmin(admin.ModelAdmin):
form = PizzaFlavorAdminForm
list_display = [
"id",
... | 2.140625 | 2 |
_ch05/logistic_regression.py | wyj1026/ml-in-action | 0 | 44720 | <gh_stars>0
from numpy import *
def load_data():
data_matrix = []
label_matrix = []
with open('./Ch05/testSet.txt', 'r') as f:
for line in f.readlines():
line_array = line.strip().split()
data_matrix.append([1.0, float(line_array[0]), float(line_array[1])])
labe... | 2.59375 | 3 |
src/python/tags.py | alexjgriffith/alpha-score | 0 | 44721 | #!/usr/bin/env python2.7
#
# This file is part of peakAnalysis, http://github.com/alexjgriffith/peaks/,
# and is Copyright (C) University of Ottawa, 2014. It is Licensed under
# the three-clause BSD License; see doc/LICENSE.txt.
# Contact: <EMAIL>
#
# Created : AUG262014
# File : buildPeaksClass
# Author : <NAME>... | 2.546875 | 3 |
securityheaders/checkers/hsts/test_maxagezero.py | th3cyb3rc0p/securityheaders | 151 | 44722 | <reponame>th3cyb3rc0p/securityheaders
import unittest
from securityheaders.checkers.hsts import HSTSMaxAgeZeroChecker
class HSTSMaxAgeZeroCheckerTest(unittest.TestCase):
def setUp(self):
self.x = HSTSMaxAgeZeroChecker()
def test_checkNoHSTS(self):
nox = dict()
nox['test'] = 'value'
... | 2.765625 | 3 |
GUI.py | wtarimo/CFCScorePredictor | 0 | 44723 | """
<NAME>
COSI 157 - Final Project: CFC Score Predictor
This module manages instances of games
11/11/2012
"""
from Game import *
def userInputBox(win):
"""Creates and diplays graphical fields for user signing and registration"""
Text(Point(55,50), "Full Name:").draw(win)
rName = Entry... | 2.4375 | 2 |
common/enums/jobtype.py | panoramichq/data-collection-fb | 0 | 44724 | <reponame>panoramichq/data-collection-fb<filename>common/enums/jobtype.py
from typing import Optional
from common.enums.entity import Entity
from common.enums.reporttype import ReportType
class JobType:
PAID_DATA = 'paid-data'
ORGANIC_DATA = 'organic-data'
GLOBAL = 'global'
UNKNOWN = 'unknown'
OTH... | 2.21875 | 2 |
tutorials/ORACLE/tutorial_toy.py | AQ18/skimpy | 13 | 44725 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... | 1.84375 | 2 |
examples/scan_directory.py | jasondarnell/opswat | 0 | 44726 |
from opswat import MetaDefenderApi
if __name__ == "__main__":
md = MetaDefenderApi(ip="10.26.50.15", port=8008)
#dir = "files"
dir = "C:\\Users\\10694\\dev"
results = md.scan_directory(dir)
print(results) | 1.679688 | 2 |
main.py | PeterHall16/Writer | 0 | 44727 | <filename>main.py
import os
# Import Colorama library (https://github.com/tartley/colorama)
from colorama import init
init()
from colorama import Fore, Back, Style
print(Style.RESET_ALL)
url = str(input("Enter url: "))
display = str(input("Display file? "))
file = open(url, "r")
if (display == "yes"):
print(file.rea... | 3.515625 | 4 |
prototypes/test-examples/pytest/test_parameterize_bootstrap.py | mikej888/recipy-test | 0 | 44728 | import os
import pytest
@pytest.fixture(scope="module")
def some_context():
return [1,2,3,4,5]
def get_scripts():
with open(config_file) as f:
scripts = [line.strip('\n') for line in f.readlines()]
return scripts
config_file = os.environ["RECIPY_TEST_CASES_CONFIG"]
def case_name(value):
retu... | 2.21875 | 2 |
doctor_jsonschema_md.py | rdpickard/doctor_jsonschema_md | 6 | 44729 | <filename>doctor_jsonschema_md.py
import json
import os
import logging
import time
import argparse
def _mds(s, iscode=False):
"""
Convert a string to a 'markdown' string by escaping control and syntax highlighting characters
:param s: The string to escape
:param iscode: The string appears in a (tick)... | 3.40625 | 3 |
src/restfx/middleware/middlewares/timetick.py | mgbin088/restfx | 1 | 44730 | <reponame>mgbin088/restfx<filename>src/restfx/middleware/middlewares/timetick.py
import time
from restfx import __meta__
from restfx.middleware import MiddlewareBase
class TimetickMiddleware(MiddlewareBase):
def __init__(self):
self.route_time = __meta__.name + '-0-route-duration'
self.i... | 2.28125 | 2 |
erri/python/trials_preparation/trial2.py | TGITS/programming-workouts | 0 | 44731 | def somme(liste_nombres):
pass
def moyenne(liste_nombres):
pass
| 1.109375 | 1 |
paper_submission/debug/chrom_expression_by_tissue.py | jfear/larval_gonad | 1 | 44732 | import builtins
from larval_gonad.mock import MockSnake
from larval_gonad.config import read_config
builtins.snakemake = MockSnake(
input="../../output/paper_submission/fig1_data_avg_tpm_per_chrom.feather",
params=dict(colors=read_config("../../config/colors.yaml")),
)
| 1.546875 | 2 |
theonionbox/tob/server.py | rainlance/theonionbox | 5 | 44733 | from wsgiserver import WSGIServer
import sys
class Server(WSGIServer):
def error_log(self, msg="", level=20, traceback=False):
# Override this in subclasses as desired
import logging
lgr = logging.getLogger('theonionbox')
e = sys.exc_info()[1]
if e.args[1].find('UNKNOWN_CA... | 2.5625 | 3 |
trunk/bin/comparecatalogs.py | drmegannewsome/lcogtsnpipe | 0 | 44734 | #!/usr/bin/env python
import lsc
import os
import argparse
default_catdir = os.path.join(os.getenv('LCOSNDIR', lsc.util.workdirectory), 'standard', 'cat')
parser = argparse.ArgumentParser()
parser.add_argument('-F', '--force', action='store_true', help="try to download catalog even if we've tried before")
parser.add... | 2.765625 | 3 |
tests/unit/test_uri.py | digital-land/pipeline | 3 | 44735 | <reponame>digital-land/pipeline<filename>tests/unit/test_uri.py<gh_stars>1-10
from digital_land.log import IssueLog
from digital_land.datatype.uri import URIDataType
def test_uri_normalise():
uri = URIDataType()
assert uri.normalise("https://example.com/foo") == "https://example.com/foo"
assert (
... | 2.53125 | 3 |
pyhsgw/hs_set_value.py | zopyx/pyHSgw | 0 | 44736 | #!/usr/bin/python
import hsgw
from sys import argv, exit
if len(argv) != 4:
print argv[0], "<key> <addr> <value>"
(key, addr, value) = argv[1:]
print "key =", key
print "addr =", addr
print "value =", value
if not hsgw.initConnection(key = key):
print "Could not initialize connection."
exit(1)
print "S... | 2.328125 | 2 |
log_to_blockchain.py | sandialabs/idash2018task1 | 1 | 44737 | <reponame>sandialabs/idash2018task1
#TODO: thread to balance optimize disk i/o vs network, try to saturate
#TODO: look into the rawtransaction way of doing multiple things at once
#TODO: look into optimizing/issuing network directly, instead of through RPC
#import subprocess
import binascii
import math
import json
impo... | 1.828125 | 2 |
python/testData/requirement/generation/newFileGeneration/main.py | Sajaki/intellij-community | 2 | 44738 | <reponame>Sajaki/intellij-community<gh_stars>1-10
from django import apps
import requests | 0.957031 | 1 |
fpl/migrations/0017_auto_20180816_2035.py | sornars/leaguetracker | 0 | 44739 | # Generated by Django 2.1 on 2018-08-16 20:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fpl', '0016_auto_20180816_2020'),
]
operations = [
migrations.AlterField(
model_name='classicleague',
name='fpl_league... | 1.492188 | 1 |
user/tests/test_family_data_api.py | judeakinwale/SMS-backup | 0 | 44740 | from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.request import Request
from rest_framework.test import APIClient, APIRequestFactory
from user import models, serializers
FAMILY_DATA_URL = reverse('user... | 2.6875 | 3 |
mlflow_ext/mlflow_wrapper.py | vashineyu/mlflow_extension | 0 | 44741 | <reponame>vashineyu/mlflow_extension
"""mlflow_wrapper.py
Decorators for class/functions
"""
from .tracker import TrackMetric, TrackParam
__all__ = [
"metric",
"param",
]
def metric(*args, **kwargs):
def function_wrapper(function):
return TrackMetric(function, *args, **kwargs)
return functio... | 2.3125 | 2 |
vaccine_feed_ingest/runners/az/pinal_ph_vaccinelocations_gov/normalize.py | jeremyschlatter/vaccine-feed-ingest | 27 | 44742 | #!/usr/bin/env python
import datetime
import json
import pathlib
import re
import sys
from typing import List, Optional
from vaccine_feed_ingest_schema import location as schema
from vaccine_feed_ingest.utils.log import getLogger
logger = getLogger(__file__)
RUNNER_ID = "az_pinal_ph_vaccinelocations_gov"
def _g... | 2.859375 | 3 |
zdiscord/service/integration/chat/discord/DiscordCommandMiddleware.py | xxdunedainxx/zdiscord | 0 | 44743 | # contains connectors between discord api logic && command logic
from zdiscord.service.messaging.CommandFactory import CommandFactory
from zdiscord.service.ServiceFactory import ServiceFactory
from zdiscord.service.integration.chat.discord.DiscordEvents import DiscordEvent
from zdiscord.service.messaging.Events import ... | 2.125 | 2 |
crawl_cvs-project/crawl_cvs/url_builder.py | MacHu-GWU/learn_scrapy-project | 0 | 44744 | <reponame>MacHu-GWU/learn_scrapy-project
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import crawlib
class CvsUrlBuilder(crawlib.BaseUrlBuilder):
domain = "https://www.cvs.com/"
urlbuilder = CvsUrlBuilder()
| 1.851563 | 2 |
app/models/oj.py | Kyooooma/view-oj-backend | 6 | 44745 | from sqlalchemy import Boolean, Column, Integer, String
from app.models.base import Base
class OJ(Base):
__tablename__ = 'oj'
fields = ['id', 'name', 'status', 'need_password']
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String(100), unique=True)
url = Column(String... | 2.8125 | 3 |
nnga/architectures/classification/mlp.py | rafaelsdellama/nnga | 1 | 44746 | <gh_stars>1-10
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense, Dropout, Input
from nnga.architectures.base_neural_network import BaseNeuralNetwork
from nnga.architectures import (
INICIALIZERS,
REGULARIZERS,
)
class MLP(BaseNeuralNetwork):
""" This class implements th... | 2.65625 | 3 |
Expressions/Operations/Pow.py | nerdsupremacist/LlamaLang | 5 | 44747 | from Expressions.Number import Number
class Pow(Number):
def __init__(self, left, right):
self.left = left
self.right = right
def eval(self):
if self.left.type() == Number and self.right.type() == Number:
return self.left.eval() ** self.right.eval()
else:
... | 3.84375 | 4 |
makehuman-master/makehuman/lib/debugdump.py | Radiian-Arts-Main/Radiian-Arts-BioSource | 1 | 44748 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Authors:** <NAME>
**Copyright(c):** MakeHuman Team 2001-2019
**Licensi... | 2.109375 | 2 |
0656 Gene Mutation Groups.py | ansabgillani/binarysearchcomproblems | 1 | 44749 | <filename>0656 Gene Mutation Groups.py
class Solution:
def solve(self, genes):
ans = 0
seen = set()
genes = set(genes)
for gene in genes:
if gene in seen:
continue
ans += 1
dfs = [gene]
seen.add(gene)
whil... | 3.296875 | 3 |
platform/core/tests/base/clients.py | hackerwins/polyaxon | 0 | 44750 | <gh_stars>0
import datetime
import json
import uuid
from collections import Mapping
from urllib.parse import urlparse
from hestia.auth import AuthenticationTypes
from hestia.ephemeral_services import EphemeralServices
from hestia.internal_services import InternalServices
from django.test import Client
from django.te... | 2.15625 | 2 |
main.py | ypy516478793/maml_exp | 0 | 44751 | """
Usage Instructions:
10-shot sinusoid:
python main.py --datasource=sinusoid --logdir=logs/sine/ --metatrain_iterations=70000 --norm=None --update_batch_size=10
10-shot sinusoid baselines:
python main.py --datasource=sinusoid --logdir=logs/sine/ --pretrain_iterations=70000 --metatrain_iterati... | 1.84375 | 2 |
chapter_06/03_line_numbers.py | SergeHall/Tony-Gaddis-Python-4th | 2 | 44752 | <reponame>SergeHall/Tony-Gaddis-Python-4th
# 3. Номера строк. Напишите программу, которая запрашивает у пользователя
# имя файла. Программа должна вывести на экран содержимое файла, при этом
# каждая строка должна предваряться ее номером и двоеточием. Нумерация строк
# должна начинаться с 1. number_list.txt
def ma... | 4 | 4 |
merlion/models/anomaly/forecast_based/arima.py | ankitakashyap05/Merlion | 2,215 | 44753 | <reponame>ankitakashyap05/Merlion
#
# Copyright (c) 2021 salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#
"""
Classic ARIMA (AutoRegressive Integrated Moving Average) forec... | 1.820313 | 2 |
Server/utils/blueprints/Logging.py | thearyadev/Security-System | 1 | 44754 | from _testcapi import instancemethod
from .ParentView import View
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ..Server import Server
class Logging(View):
def __init__(self, server: 'Server'):
super().__init__(name=self.__class__.__name__, server=server)
| 2.09375 | 2 |
setup.py | bischtob/opterax | 1 | 44755 | <gh_stars>1-10
import os
from setuptools import find_namespace_packages
from setuptools import setup
_CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
def _get_version():
with open(os.path.join(_CURRENT_DIR, 'opterax', '__init__.py')) as fp:
for line in fp:
if line.startswith('__version__') and '... | 2.046875 | 2 |
datacollection/routing.py | playfulMIT/kimchi | 0 | 44756 | <reponame>playfulMIT/kimchi<gh_stars>0
from django.urls import path
from . import consumers
websocket_urlpatterns = [path("ws/", consumers.DataCollectionConsumer)]
| 1.484375 | 1 |
tests/conftest.py | GoodMonsters/Building-Data-Science-Applications-with-FastAPI | 107 | 44757 | from typing import Callable, AsyncGenerator, Generator
import asyncio
import httpx
import pytest
from asgi_lifespan import LifespanManager
from fastapi import FastAPI
from fastapi.testclient import TestClient
TestClientGenerator = Callable[[FastAPI], AsyncGenerator[httpx.AsyncClient, None]]
@pytest.fixture(scope="s... | 1.96875 | 2 |
Code/set.py | escofresco/makeschool_cs13_core_ds | 0 | 44758 | <gh_stars>0
"""This module is a custom implement of the set data type.
Implements:
Set data type class."""
from binarytree import BinarySearchTree
from copy import deepcopy
class Set:
"""Implements a set using BinarySearchTree"""
__slots__ = ("data",)
def __init__(self, it=()):
self.data = B... | 3.765625 | 4 |
xos/grpc/tests/api_user_crud.py | pan2za/xos | 0 | 44759 | import sys
sys.path.append("..")
import grpc_client
from testconfig import *
print "api_user_crud"
#c=grpc_client.InsecureClient("localhost")
c=grpc_client.SecureClient("xos-core.cord.lab", username=USERNAME, password=PASSWORD)
u=grpc_client.User()
import random, string
u.email=''.join(random.choice(string.ascii_upp... | 2.328125 | 2 |
codes/attacks.py | epfml/byzantine-robust-decentralized-optimizer | 2 | 44760 | import numpy as np
import torch
from scipy.stats import norm
from codes.worker import ByzantineWorker
from codes.aggregator import DecentralizedAggregator
class DecentralizedByzantineWorker(ByzantineWorker):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# The target of at... | 2.3125 | 2 |
lotoparser/lib/zipper.py | forkd/jam | 0 | 44761 | #!/usr/bin/env python
#coding: utf8
"""Zipper
A class that can zip and unzip files.
"""
__author__ = "<NAME>"
__license__ = "GPLv3+"
import os
import zipfile
try:
import zlib
has_zlib = True
except:
has_zlib = False
class Zipper(object):
"""This is the main class.
Can zip and unzi... | 3.828125 | 4 |
evalution/composes/composition/composition_model.py | esantus/evalution2 | 1 | 44762 | '''
Created on Oct 5, 2012
@author: <NAME>, <NAME>
'''
import time
import math
from warnings import warn
from composes.semantic_space.space import Space
from composes.matrix.dense_matrix import DenseMatrix
from composes.utils.gen_utils import assert_is_instance
from composes.utils.matrix_utils import resolve_type_conf... | 2.46875 | 2 |
Exercicios-Python/exercicios-curso-em-video/d103.py | PedroGoes16/Estudos | 0 | 44763 | def ficha():
print(30*'-')
n = str(input('Nome do Jogador: '))
if n == '':
n = '<desconhecido>'
g = str(input('Números de Gols: '))
if g.isnumeric():
g = int(g)
else:
g = 0
print(f'O jogador {n} fez {g} gol(s) no campeonato.')
ficha() | 3.734375 | 4 |
codegen.py | js-on/CVE-2021-42574 | 7 | 44764 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Author: <NAME> <<EMAIL>>
# PGP: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x00bebdd0437ad513a4a0e13d93435cab4ca92fb9
# Date: 05.11.2021
import argparse
import os
# Unicode placeholders and their replacements
uc_table = {
b"LRE": chr(0x202a)... | 2.28125 | 2 |
test/plugin_support_test.py | spbrogan/rvc2mqtt | 6 | 44765 | """
Unit tests for the plugin_support module
This is just a hack to invoke it..not a unit test
Copyright 2022 <NAME>
SPDX-License-Identifier: Apache-2.0
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 Licens... | 2.46875 | 2 |
scenarios/demo.py | wobal/Kissenium | 4 | 44766 | # coding: utf-8
"""
Copyright 2017 Adiuvo
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | 2.71875 | 3 |
github/data_types/pull_request_review.py | codex-bot/GitHub | 11 | 44767 | from data_types.user import User
class PullRequestReview:
"""
GitHub Pull Request Review
https://developer.github.com/v3/pulls/reviews/
Attributes:
id: Review id
body: Review body text
html_url: Public URL for issue on github.com
state: approved|commented|changes_requ... | 2.953125 | 3 |
pyaisnmea/messages/t14.py | tww-software/py_ais_nmea | 1 | 44768 | <filename>pyaisnmea/messages/t14.py
"""
Type 14 messages are broadcast safety messages.
"""
import pyaisnmea.binary as binary
import pyaisnmea.messages.aismessage
class Type14SafetyBroadcastMessage(pyaisnmea.messages.aismessage.AISMessage):
"""
Safety Broadcast Message
"""
def __init__(self, msgbina... | 2.4375 | 2 |
tests/testutil.py | delocalizer/qasim | 0 | 44769 | """Utilities for tests"""
import copy
import re
BAD_ID = "line %s: id '%s' doesn't match '%s'"
BAD_SEQLEN = "line %s: %s is not the same length as the first read (%s)"
BAD_BASES = "line %s: %s is not in allowed set of bases %s"
BAD_PLUS = "line %s: expected '+', got %s"
BAD_QUALS = "line %s: %s is not the same lengt... | 2.59375 | 3 |
spinoff/actor/events.py | eallik/spinoff | 6 | 44770 | <gh_stars>1-10
from __future__ import print_function
import sys
import traceback
from collections import namedtuple
from gevent.event import AsyncResult
from spinoff.util.logging import err, log, fail
def fields(*args):
return namedtuple('_', args)
class Event(object):
def __repr__(self):
return '... | 2.25 | 2 |
turboactivate/__init__.py | develersrl/python-turboactivate | 4 | 44771 | <filename>turboactivate/__init__.py<gh_stars>1-10
# -*- coding: utf-8 -*-
#
# Copyright 2013-2018 Develer S.r.l. (https://www.develer.com/)
#
# Author: <NAME> <<EMAIL>>
# Author: <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documenta... | 1.695313 | 2 |
code/from_scratch/train_tokenizer.py | flower-go/DiplomaThesis | 0 | 44772 | <gh_stars>0
from tokenizers import BertWordPieceTokenizer
def train(data):
tokenizer = BertWordPieceTokenizer()
tokenizer.train(files=data, vocab_size=52_000, min_frequency=2)
return tokenizer
if __name__ == "__main__":
import argparse
import sys
import os
command_line = " ".join(sys.ar... | 2.765625 | 3 |
nexoclom/solarsystem/planet_geometry.py | mburger-stsci/NExoCloM | 0 | 44773 | <reponame>mburger-stsci/NExoCloM
''' Determine some basic geometry info from the SPICE kernels
For planets:
* r in AU
* drdt in km/s
* TAA in radians
* Sub-solar longitude and latitude in radians -- not implemented
* Sub-earth longitude and latitude in radians -- not implemented
'''
import numpy as np
impo... | 2.46875 | 2 |
podcast-ml/service/src/app/podcastml/utils/__init__.py | cuappdev/archives | 0 | 44774 | <gh_stars>0
"""Init."""
from app import db
| 0.988281 | 1 |
upvote/gae/modules/upvote_app/api/handlers/base_test.py | cclauss/upvote | 0 | 44775 | <reponame>cclauss/upvote
# Copyright 2017 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 requir... | 1.9375 | 2 |
src/arguments.py | volkancirik/refer360 | 7 | 44776 | <reponame>volkancirik/refer360
"""
Arguments for train/test
"""
import argparse
def get_train_rl():
parser = argparse.ArgumentParser(
description='advantage-actor-critic RL training for localizing Waldo!')
parser.add_argument('--multi-gpu',
action='store_true', help='Use multiple gpu')... | 2.375 | 2 |
core/urls.py | kevincornish/Genesis | 0 | 44777 | <reponame>kevincornish/Genesis
from django.conf.urls import url, include
from django.contrib import admin
from core import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^profile/$', views.profile, name='profile'),
... | 1.828125 | 2 |
crunch.py | pholtz/cyclo-analyzer | 0 | 44778 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import datetime
import pathlib
import gpxpy
import pandas as pd
import statistics
import seaborn
import matplotlib.pyplot as plt
from activity import Activity, create_activity, parse_activities_csv
def select_activity(activities, iso_date=None):
"""Given a l... | 3.390625 | 3 |
questions/q87_inversion_array/code.py | aadhityasw/Competitive-Programs | 0 | 44779 | <filename>questions/q87_inversion_array/code.py<gh_stars>0
def merge_sort_and_count(arr, start, end) :
count = 0
if start >= end :
return 0
# Splitting Process
mid = (start + end) // 2
count += merge_sort_and_count(arr, start, mid)
count += merge_sort_and_count(arr, mid+1, end)
... | 3.390625 | 3 |
typography.py | jwinnie/py2html | 0 | 44780 | <gh_stars>0
def title1(content):
return "<h1 class='display-1'>{}</h1>".format(content)
def title2(content):
return "<h2 class='display-2'>{}</h2>".format(content)
def title3(content):
return "<h3 class='display-3'>{}</h3>".format(content)
def title4(content):
return "<h4 class='d... | 2.71875 | 3 |
app/album/__init__.py | chaosbus/MemorySeepage | 0 | 44781 | from flask import Blueprint
bp_album = Blueprint('album', __name__)
from . import views
| 1.320313 | 1 |
web/api.py | energize-andover/Dashboard | 0 | 44782 | import json
from base64 import b64encode, b64decode
from flask import abort, request, redirect
from simplecrypt import encrypt, decrypt
from secrets import ENCRYPTION_SECRET
def route_apis(app):
@app.route('/api/encrypt', methods=['GET', 'POST'])
def encrypt_layout():
if request.method == "POST":
... | 2.71875 | 3 |
src/approot/__init__.py | omkumar01/major-project | 0 | 44783 | from approot.celery import app as celery_app | 1.039063 | 1 |
BeerChallenge_Scordino_Marco.py | Py101/py101-assignments-marcosco | 0 | 44784 | from functools import reduce
def fact(n):
fact_lamba = lambda x, y: x * y
return reduce(fact_lamba, range(1,n+1))
| 3.171875 | 3 |
infi/unittest/filter_syntax.py | Infinidat/infi.unittest | 0 | 44785 | import re
_ARGS = r"\[[^]]+\]"
_IDENTITIFER = r"[a-zA-Z_][_0-9a-zA-Z]*"
_MODULE_PATH = r"[\.a-zA-Z_][\._0-9a-zA-Z]*"
def _REMEMBER(x, name):
return "(?P<{0}>{1})".format(name, x)
def _OPTIONAL(*x):
return "(?:{0})?".format(''.join(x))
FILTER_STRING_RE = ''.join((
'^',
_REMEMBER(_MODULE_PATH, "modu... | 2.546875 | 3 |
gillcup/futures.py | encukou/gillcup | 4 | 44786 | <filename>gillcup/futures.py
from gillcup.util.signature import fix_public_signature
class Future:
"""Wraps a future; calbacks on the wrapper are scheduled on a given Clock
To be instantiated using
:meth:`Clock.wait_for() <gillcup.clocks.Clock.wait_for()>`.
See :class:`asyncio.Future` for API docume... | 2.390625 | 2 |
greenflow/greenflow/dataframe_flow/__init__.py | t-triobox/gQuant | 0 | 44787 | <filename>greenflow/greenflow/dataframe_flow/__init__.py
from .node import * # noqa: F401,F403
from .taskSpecSchema import * # noqa: F401,F403
from .taskGraph import * # noqa: F401,F403
from .portsSpecSchema import * # noqa: F401,F403
from .metaSpec import * # noqa: F401,F403
import sys
try:
# For python 3.8 a... | 1.648438 | 2 |
awacs/redshift.py | calebmarcus/awacs | 0 | 44788 | <gh_stars>0
# Copyright (c) 2012-2013, <NAME> <<EMAIL>>
# All rights reserved.
#
# See LICENSE file for full license.
from aws import Action as BaseAction
from aws import BaseARN
service_name = 'Amazon Redshift'
prefix = 'redshift'
class Action(BaseAction):
def __init__(self, action=None):
sup = super(A... | 2.234375 | 2 |
transform_train.py | ShaoaAllen/CogQA | 0 | 44789 | <gh_stars>0
#Albert GCN Transform train
import argparse
import dill as pickle
from torchtext.datasets import TranslationDataset
from torchtext.data import Field, Dataset, BucketIterator
import transpytorch.transformer.Constants as Constants
import os
import re
import json
from tqdm import tqdm, trange
import pdb
impor... | 1.742188 | 2 |
PYTHON/02POO/04Ordenacao/ContaTempo.py | felipefazani/Aprendendo | 0 | 44790 | import time
import Ordem
class ContaTempo():
def compara(self, tamanho_da_lista):
'''Compara o tempo exercido para ordenar uma lista com o tamanho passado'''
l = Ordem.Lista()
lista1 = l.crialista(tamanho_da_lista)
lista2 = lista1[:]
o = Ordem.Ordenacao()
antes = time.time... | 3.453125 | 3 |
qunetsim/utils/constants.py | rheaparekh/QuNetSim | 0 | 44791 | class Constants:
# DATA TYPES
GENERATE_EPR_IF_NONE = 'generate_epr_if_none'
AWAIT_ACK = 'await_ack'
SEQUENCE_NUMBER = 'sequence_number'
PAYLOAD = 'payload'
PAYLOAD_TYPE = 'payload_type'
SENDER = 'sender'
RECEIVER = 'receiver'
PROTOCOL = 'protocol'
KEY = 'key'
# WAIT TIME
... | 1.867188 | 2 |
Math/B01_Algebra_basics/Programs/S02/Slope_of_perpendicular_lines_image.py | Polirecyliente/SGConocimiento | 0 | 44792 | #T# the following code shows how to draw the slope of the perpendicular line to a given line
#T# to draw the slope of the perpendicular line to a given line, the pyplot module of the matplotlib package is used
import matplotlib.pyplot as plt
#T# to transform the markers of a plot, import the MarkerStyle constructor
f... | 4.28125 | 4 |
tests/test_mullled.py | jfy133/nf-core-tools | 1 | 44793 | """Test the mulled BioContainers image name generation."""
import pytest
from nf_core.modules import MulledImageNameGenerator
@pytest.mark.parametrize(
"specs, expected",
[
(["foo==0.1.2", "bar==1.1"], [("foo", "0.1.2"), ("bar", "1.1")]),
(["foo=0.1.2", "bar=1.1"], [("foo", "0.1.2"), ("bar",... | 2.421875 | 2 |
tests/python_on_whales/components/test_system.py | wannaphong/python-on-whales | 0 | 44794 | <filename>tests/python_on_whales/components/test_system.py
import json
from datetime import date
from pathlib import Path
import pytest
from python_on_whales import docker
from python_on_whales.components.system.models import DockerEvent, SystemInfo
from python_on_whales.exceptions import DockerException
fro... | 2.21875 | 2 |
test/test_metaverify.py | bibsian/lter | 5 | 44795 | <reponame>bibsian/lter
#! /usr/bin/env python
import pytest
from pandas import read_csv, read_sql
import sys, os
from poplerGUI import class_inputhandler as ini
from poplerGUI.logiclayer.datalayer import config as orm
rootpath = os.path.dirname(os.path.dirname( __file__ ))
end = os.path.sep
sys.path.append(os.p... | 2.71875 | 3 |
src/users/urls.py | MichaelNest/My-First-Show-Project | 0 | 44796 | <reponame>MichaelNest/My-First-Show-Project
from django.urls import path
from .views import Signup
app_name = 'users'
urlpatterns = [
path('signup/', Signup.as_view(), name='signup')
] | 1.757813 | 2 |
daiquiri/metadata/management/commands/update_access_level.py | agy-why/daiquiri | 14 | 44797 | <filename>daiquiri/metadata/management/commands/update_access_level.py<gh_stars>10-100
from django.core.management.base import BaseCommand,CommandError
from django.utils.translation import ugettext_lazy as _
from daiquiri.core.constants import ACCESS_LEVEL_CHOICES
from daiquiri.metadata.models import Schema
class Co... | 2 | 2 |
protostar/commands/remove/removal_exceptions.py | software-mansion/protostar | 11 | 44798 | <reponame>software-mansion/protostar
from protostar.protostar_exception import ProtostarException
class InvalidLocalRepository(ProtostarException):
pass
class PackageNotFound(ProtostarException):
pass
| 1.460938 | 1 |
irf/exposure_map.py | fact-project/irf | 0 | 44799 | import astropy.units as u
from astropy.coordinates import Angle, SkyCoord
from astropy import wcs
from regions import CircleSkyRegion
import numpy as np
from scipy.stats import expon
def estimate_exposure_time(timestamps):
'''
Takes numpy datetime64[ns] timestamps and returns an estimates of the exposure time... | 2.1875 | 2 |