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
python/one-liner/cluster_of_non_0.py
Hamng/python-sources
0
13400
<reponame>Hamng/python-sources<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Sat Feb 8 07:38:05 2020 @author: Ham Self Challenge: Count Cluster of Non-0s Given a 1-dimension array of integers, determine how many 'clusters' of non-0 in the array. A 'cluster' is a group of consecutive non-0 values. S...
3.484375
3
cardano-node-tests/cardano_node_tests/tests/test_configuration.py
MitchellTesla/Cardano-SCK
6
13401
<filename>cardano-node-tests/cardano_node_tests/tests/test_configuration.py """Tests for node configuration.""" import json import logging import time from pathlib import Path import allure import pytest from _pytest.tmpdir import TempdirFactory from cardano_clusterlib import clusterlib from cardano_node_tests.utils ...
1.867188
2
output/myresults.py
jacobseiler/rsage
1
13402
<gh_stars>1-10 #!/usr/bin/env python from __future__ import print_function import matplotlib matplotlib.use('Agg') import os import heapq import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import matplotlib.colors as colors import matplotlib.cm as cm from numpy import * from ran...
1.984375
2
tests/functional_tests/test_camera.py
accessai/access-face-vision
3
13403
from multiprocessing import Queue, Value from time import sleep from access_face_vision.source.camera import Camera from access_face_vision.utils import create_parser from access_face_vision import access_logger LOG_LEVEL = 'debug' logger, log_que, que_listener = access_logger.set_main_process_logger(LOG_LEVEL) def...
2.515625
3
utils/deserializer/__tests__/test_protobuf_deserializer.py
Mouse-BB-Team/Bot-Detection
5
13404
from utils.deserializer.protobuf_deserializer import ProtoLoader from pathlib import Path import pandas as pd import pytest PROTOFILES_DIR_PATH = Path(__file__).parent.joinpath("protofilesdir").absolute().__str__() INVALID_PATH = "some/wrong/path" @pytest.mark.parametrize('filepath', ["test_file.pb", "test_file_1.tx...
2.375
2
wisdem/assemblies/turbinese/turbine_se_seam.py
dzalkind/WISDEM
1
13405
#!/usr/bin/env python # encoding: utf-8 """ turbine.py Created by <NAME> and <NAME> on 2014-01-13. Copyright (c) NREL. All rights reserved. """ from openmdao.main.api import Assembly, Component from openmdao.main.datatypes.api import Float, Array, Enum, Bool, Int from openmdao.lib.drivers.api import FixedPointIterato...
1.726563
2
src/triage/component/results_schema/alembic/versions/5dd2ba8222b1_add_run_type.py
josephbajor/triage_NN
160
13406
"""add run_type Revision ID: 5dd2ba8222b1 Revises: 079a74c15e8b Create Date: 2021-07-22 23:53:04.043651 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '5dd2ba8222b1' down_revision = '079a74c15e8b' branch_labels = None ...
1.421875
1
projects/PanopticFCN_cityscapes/panopticfcn/__init__.py
fatihyildiz-cs/detectron2
166
13407
from .config import add_panopticfcn_config from .panoptic_seg import PanopticFCN from .build_solver import build_lr_scheduler
1.109375
1
03_lecture_Django/lecture3/hello/views.py
MoStgt/CS50
0
13408
<reponame>MoStgt/CS50 from http.client import HTTPResponse from django.shortcuts import render from django.http import HttpResponse # Create your views here. # def index(request): # return HttpResponse("Hello World!") def index(request): return render(request, "hello/index.html") def brian(request): retu...
2.34375
2
txdav/common/datastore/upgrade/test/test_migrate.py
backwardn/ccs-calendarserver
462
13409
<filename>txdav/common/datastore/upgrade/test/test_migrate.py ## # Copyright (c) 2010-2017 Apple 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.apach...
1.65625
2
generated-libraries/python/netapp/fcp/aliases_info.py
radekg/netapp-ontap-lib-get
2
13410
<reponame>radekg/netapp-ontap-lib-get<filename>generated-libraries/python/netapp/fcp/aliases_info.py from netapp.netapp_object import NetAppObject class AliasesInfo(NetAppObject): """ A list of WWPNs and their aliases generated according to the input - alias, WWPN or nothing. """ _vserver = No...
2.15625
2
imagernn/generic_batch_generator.py
OnlyBelter/learn_neuralTalk
7
13411
<filename>imagernn/generic_batch_generator.py import numpy as np import code from imagernn.utils import merge_init_structs, initw, accumNpDicts from imagernn.lstm_generator import LSTMGenerator from imagernn.rnn_generator import RNNGenerator def decodeGenerator(generator): if generator == 'lstm': return LSTMGene...
2.65625
3
ConfigUpdater.py
godfatherlmh/LoLAnalyzer
0
13412
<reponame>godfatherlmh/LoLAnalyzer # Update the working patch and champions list from __future__ import print_function import configparser import json import os import urllib.request from datetime import datetime from slugify import slugify from collections import OrderedDict from InterfaceAPI import InterfaceAPI d...
2.40625
2
app/migrations/0010_auto_20200709_1512.py
RuijiaX/w3hacks
1
13413
# Generated by Django 3.0.7 on 2020-07-09 22:12 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0009_auto_20200709_1430'), ] operations = [ migrations.AlterField( model_name='location', name='lat', ...
1.5
2
tests/test_fitting.py
adrdrew/viroconcom
0
13414
import unittest import csv import numpy as np from viroconcom.fitting import Fit def read_benchmark_dataset(path='tests/testfiles/1year_dataset_A.txt'): """ Reads a datasets provided for the environmental contour benchmark. Parameters ---------- path : string Path to dataset including the...
3.234375
3
python/scripts/wavsep/wavsep.py
rugheid/OSS-ZAP
4
13415
<filename>python/scripts/wavsep/wavsep.py<gh_stars>1-10 # Zed Attack Proxy (ZAP) and its related class files. # # ZAP is an HTTP/HTTPS proxy for assessing web application security. # # Copyright 2012 ZAP Development Team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file exc...
2.390625
2
ex115/biblioteca/interface/__init__.py
Danilo-Xaxa/python_curso_em_video
4
13416
def LeiaInt(msg1): pronto = False while True: valor1 = input(msg1) if valor1.isnumeric(): pronto = True else: print('\033[1;31mERRO! FAVOR DIGITAR UM NÚMERO INTEIRO VÁLIDO\033[m') if pronto: break return valor1 def linha(tamanho=42): ...
3.578125
4
pocketsmith/models/attachment.py
brett-comber/python-pocketsmith-api
0
13417
<filename>pocketsmith/models/attachment.py # coding: utf-8 """ PocketSmith The public PocketSmith API # noqa: E501 The version of the OpenAPI document: 2.0 Contact: <EMAIL> Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from pocketsmith.conf...
1.648438
2
pynsq/nsq/NSQReader.py
ghorges/nsq-2.0
0
13418
""" high-level NSQ reader class built on top of a Tornado IOLoop supporting both sync and async modes of operation. supports various hooks to modify behavior when heartbeats are received, temporarily disable the reader, and pre-process/validate messages. when supplied a list of nsqlookupd addresses, a reader instance...
2.484375
2
main.py
ygidtu/mountainClimber
0
13419
#!/usr/bin/env python3 # -*- coding:utf-8 -*- u""" Created at 2020.09.04 by <NAME> """ import warnings warnings.filterwarnings("ignore") import click from cli.climb import climb from cli.diff import diff @click.group() def main(): pass main.add_command(climb) main.add_command(diff) if __name__ == '__main__': ...
1.820313
2
app/fednlp/data/raw_data_loader/CNN_Dailymail/data_loader.py
ray-ruisun/FedML
0
13420
import os from data.raw_data_loader.base.base_raw_data_loader import Seq2SeqRawDataLoader class RawDataLoader(Seq2SeqRawDataLoader): def __init__(self, data_path): super().__init__(data_path) self.cnn_path = "cnn/stories" self.dailymail_path = "dailymail/stories" def load_data(self)...
2.625
3
packages/utils/propagate_license.py
justi/m2g
12
13421
<filename>packages/utils/propagate_license.py #!/usr/bin/env python # Copyright 2014 Open Connectome Project (http://openconnecto.me) # # 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 # # ...
1.773438
2
core/gf/test.py
zorrock/accelerated-text
1
13422
<filename>core/gf/test.py import pytest import server @pytest.fixture(scope="session") def authorship_grammar(): with open("test_grammars/Authorship.gf", "r") as f: abstract = {"content": f.read()} with open("test_grammars/AuthorshipEng.gf", "r") as f: inst = {"content": f.read(), "key": "Eng"...
2.359375
2
troposphere/validators/dynamodb.py
compose-x/troposphere
0
13423
<filename>troposphere/validators/dynamodb.py # Copyright (c) 2012-2022, <NAME> <<EMAIL>> # All rights reserved. # # See LICENSE file for full license. from .. import AWSHelperFn, If def attribute_type_validator(x): """ Property: AttributeDefinition.AttributeType """ valid_types = ["S", "N", "B"] ...
2.125
2
videoclip_sources/e004.py
ChrisScarred/misty2py-skills
0
13424
<filename>videoclip_sources/e004.py<gh_stars>0 import time from misty2py.robot import Misty from misty2py.utils.env_loader import EnvLoader from misty2py_skills.utils.utils import get_abs_path env_loader = EnvLoader(get_abs_path(".env")) m = Misty(env_loader.get_ip()) d = m.event("subscribe", type="BatteryCharge")...
2.1875
2
p2/Python Files/audit_street.py
priyankaswadi/Udacity-Data-Analyst-Nanodegree
0
13425
#Map incorrect and abbreviated street names with correct/better ones import xml.etree.cElementTree as ET from collections import defaultdict import re import pprint OSMFILE = "albany.osm" street_type_re = re.compile(r'\b\S+\.?$', re.IGNORECASE) # UPDATE THIS VARIABLE mapping = {"rd": "Road", "Rd": "Road", ...
3
3
modules/week2/utils.py
tobias-z/4-sem-python
0
13426
from io import TextIOWrapper import os from typing import List OUTPUT = "files/output.csv" FOLDER = "modules/week2/folders" def get_file_names(folderpath, out=OUTPUT): """takes a path to a folder and writes all filenames in the folder to a specified output file""" dir_list = os.listdir(folderpath) with o...
3.5625
4
src/api/providers.py
ismetacar/ertis-auth
17
13427
<reponame>ismetacar/ertis-auth import json from sanic import response from sanic_openapi import doc from src.plugins.authorization import authorized from src.plugins.validator import validated from src.request_models.providers import Provider from src.request_models.query_model import Query from src.resources.generic...
2
2
lista08_pesquisa/questao02.py
mayararysia/ESTD
0
13428
<reponame>mayararysia/ESTD<filename>lista08_pesquisa/questao02.py # -*- coding: utf-8 -*- #Lista de Exercícios 08 (Pesquisa) - Questão 02 #<NAME> from time import time from time import sleep from random import randint """ 2. Use as duas funções de busca binária apresentadas (iterativa e recursiva). Gere uma lista de n...
3.484375
3
ccvpn/views/__init__.py
CCrypto/ccvpn
81
13429
<filename>ccvpn/views/__init__.py import codecs import markdown import os import logging from pyramid.view import view_config from pyramid.httpexceptions import HTTPOk, HTTPNotFound from sqlalchemy import func from mako.lookup import TemplateLookup import mako.exceptions logger = logging.getLogger(__name__) from ccvpn...
2
2
rx/subjects/subject.py
MichaelSchneeberger/RxPY
0
13430
<filename>rx/subjects/subject.py import threading from typing import Any, List, Optional from rx.disposable import Disposable from rx.core.typing import Observer, Scheduler from rx.core import Observable, typing from rx.internal import DisposedException from .anonymoussubject import AnonymousSubject from .innersubscr...
2.5625
3
scripts/uda.py
nng555/fairseq
2
13431
<filename>scripts/uda.py import os import hydra import subprocess import logging from omegaconf import DictConfig from hydra import slurm_utils log = logging.getLogger(__name__) @hydra.main(config_path='/h/nng/conf/robust/config.yaml', strict=False) def launch(cfg: DictConfig): os.environ['NCCL_DEBUG'] = 'INFO' ...
1.859375
2
06_Business/application_iris/app.py
MaryMP11/The_Bridge_School_DataScience_PT
0
13432
<reponame>MaryMP11/The_Bridge_School_DataScience_PT from flask import Flask, request, jsonify, session, url_for, redirect, render_template import joblib from flower_form import FlowerForm classifier_loaded = joblib.load("application_iris/saved_models/knn_iris_dataset.pkl") encoder_loaded = joblib.load("application_ir...
2.875
3
test.py
EdwinChan/python-physical
2
13433
import math import re import unittest import urllib.error import urllib.request from .core import Quantity from .define import defined_systems si = defined_systems['si'] esu = defined_systems['esu'] emu = defined_systems['emu'] gauss = defined_systems['gauss'] class PhysicalQuantitiesTest(unittest.TestCase): def a...
3.125
3
test/test_cirrus_ngs/test_cfnCluster/test_ConnectionManager.py
ucsd-ccbb/cirrus-ngs
8
13434
import unittest import sys import os sys.path.append(os.getcwd().replace("test", "src")) import cirrus_ngs.cfnCluster.ConnectionManager as ConnectionManager import paramiko import tempfile import re ##THIS TEST WILL NOT WORK## class test_ConnectionManager(unittest.TestCase): def test_paramiko(self): key_f...
2.453125
2
src/backend/opus/opusctl/cmds/process.py
DTG-FRESCO/opus
0
13435
<reponame>DTG-FRESCO/opus # -*- coding: utf-8 -*- ''' Commands for launching processes with or without OPUS interposition. ''' from __future__ import absolute_import, division, print_function import argparse import os import psutil from .. import config, server_start, utils def get_current_shell(): ppid = os.ge...
2.109375
2
tests/unit/l2_infrastructure/test_app_collection_config_parser.py
ansible-self-service/ansible-self-service
0
13436
<reponame>ansible-self-service/ansible-self-service import pytest from ansible_self_service.l2_infrastructure.app_collection_config_parser import AppCollectionConfigValidationException, \ YamlAppCollectionConfigParser from ansible_self_service.l4_core.models import AppCategory, App VALID_CATEGORY_NAME = 'Misc' VA...
2.3125
2
api-server.py
proatria/sftpplus-api-example
0
13437
<filename>api-server.py<gh_stars>0 """ Run a simple HTTP server which provides API endpoint for SFTPPlus. Usage: server.py [options] -h --help Show this help. -p --port=8000 Listen to a specific port. [default: 8080] -a --address=127.0.0.1 Listen on specific address. [default: 0.0.0.0] -c --cert...
3.28125
3
arkfbp/flow/__init__.py
arkfbp/arkfbp-py
2
13438
<reponame>arkfbp/arkfbp-py from .base import Flow from .view_flow import ViewFlow
0.984375
1
ethereumetl/mappers/event_mapper.py
thanhnv2303/ethereum-etl
0
13439
from config.constant import ExportItemConstant, ExportItemTypeConstant, EventConstant, TransactionConstant from ethereumetl.service.eth_event_service import EthEvent class EthEventMapper(object): def eth_event_to_dict(self, eth_event: EthEvent): d1 = { ExportItemConstant.type: ExportItemTypeCo...
2.234375
2
openerp/addons/crm_partner_assign/wizard/crm_forward_to_partner.py
ntiufalara/openerp7
3
13440
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # # This program is free software: you can redistribute it and/or modify # ...
1.773438
2
losses.py
DensenDavis/yolov5_tf2
0
13441
import tensorflow as tf from tensorflow.keras.losses import binary_crossentropy,sparse_categorical_crossentropy from config import Configuration cfg = Configuration() class YOLOLoss(tf.losses.Loss): def __init__(self, anchors): super(YOLOLoss, self).__init__(reduction="none", name="YOLOLoss") self....
2.3125
2
test/stress/mmlogic.py
dzlier-gcp/open-match
0
13442
<gh_stars>0 # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
2.265625
2
benchmarks_sphere/report_konwihr_rexi_nl/compare_wt_dt_vs_accuracy_galewsky_new_rexi_cmlarge_elrexi/postprocessing_pickle.py
valentinaschueller/sweet
6
13443
#! /usr/bin/env python3 import sys import math import glob from mule_local.postprocessing.pickle_SphereDataSpectralDiff import * from mule.exec_program import * # Ugly hack! #output, retval = exec_program('ls *benchref*/*prog_h* | sort | tail -n 1 | sed "s/.*prog_h//"') #if retval != 0: # print(output) # raise Excep...
2.046875
2
src/houdini_package_runner/items/base.py
captainhammy/houdini_package_runner
3
13444
<filename>src/houdini_package_runner/items/base.py """This module contains a base runnable item.""" # ============================================================================= # IMPORTS # ============================================================================= # Future from __future__ import annotations # S...
2.671875
3
visualizer/__init__.py
AndreasMadsen/bachelor-code
1
13445
from graph.graph_server import GraphServer __all__ = ['GraphServer']
1.117188
1
djangoplicity/blog/migrations/0001_initial.py
djangoplicity/blog
0
13446
# -*- coding: utf-8 -*- # Generated by Django 1.9.13 on 2017-08-15 16:23 from __future__ import unicode_literals import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion import djangoplicity.archives.base import djangoplicity.archives.fields class Migratio...
1.898438
2
picklesize/test_picklesize.py
pydron/picklesize
0
13447
''' Created on 20.07.2015 @author: stefan ''' import unittest import pickle import picklesize import copy_reg class TestEstimator(unittest.TestCase): def setUp(self): self.target = picklesize.PickleSize() def compare(self, obj): data = pickle.dumps(obj, protocol=pickle.HIGHEST_PROTOCOL)...
2.515625
3
setup.py
extensive-nlp/ttc_nlp
0
13448
<reponame>extensive-nlp/ttc_nlp #!/usr/bin/env python3 # -*- coding: utf-8 -*- """Setup process.""" from io import open from os import path from setuptools import find_packages, setup with open( path.join(path.abspath(path.dirname(__file__)), "README.md"), encoding="utf-8" ) as f: long_description = f.read()...
1.570313
2
auxein/fitness/__init__.py
auxein/auxein
1
13449
# flake8: noqa from .core import Fitness from .kernel_based import GlobalMinimum from .observation_based import ObservationBasedFitness, MultipleLinearRegression, SimplePolynomialRegression, MultipleLinearRegression
0.988281
1
steelpy/codes/main.py
svortega/steelpy
4
13450
# Copyright (c) 2019-2020 steelpy # Python stdlib imports # package imports #from steelpy.codes.aisc.aisc360 import AISC_360_16 #from steelpy.codes.aisc.aisc335 import AISC_335_89 #from steelpy.codes.iso.ISO19902 import ISOCodeCheck from steelpy.codes.piping.pipeline import Pipeline_Assessment #from steelpy.codes.api...
2.203125
2
main.py
soyoung97/MixText
0
13451
import os os.system("pip install pytorch_transformers") import nsml print(nsml.DATASET_PATH) os.system('python ./code/train.py --n-labeled 10 --data-path '+ nsml.DATASET_PATH + '/train/ --batch-size 4 --batch-size-u 8 --epochs 20 --val-iteration 1000 --lambda-u 1 --T 0.5 --alpha 16 --mix-layers-set 7 9 12 --lrmain 0.0...
2.375
2
test.py
IldusTim/QAStudy
0
13452
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait import math from selenium.webdriver.support.ui import Select import os import time from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC link = "http://...
3.265625
3
django_backend/product/migrations/0002_product.py
itsmahadi007/E-Commerce-VueJS-Django
0
13453
<reponame>itsmahadi007/E-Commerce-VueJS-Django # Generated by Django 3.2.7 on 2021-09-01 17:46 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('product', '0001_initial'), ] operations = [ migrations.Creat...
1.734375
2
kraken/ketos.py
zjsteyn/kraken
0
13454
<reponame>zjsteyn/kraken # -*- coding: utf-8 -*- # # Copyright 2015 <NAME> # # 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 b...
2.015625
2
util/visualize_loss.py
whq-hqw/detr_change
2
13455
<filename>util/visualize_loss.py from os.path import * import glob import json import numpy as np from util.plot_utils import plot_curves, plot_multi_loss_distribution TMPJPG = expanduser("~/Pictures/") def plot_multi_logs(exp_name, keys, save_name, epoch, addition_len): root_path = expanduser("/raid/dataset/det...
2.1875
2
tower_cli/resources/job.py
kedark3/tower-cli
363
13456
<reponame>kedark3/tower-cli # Copyright 2015, Ansible, Inc. # <NAME> <<EMAIL>> # # 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 re...
1.820313
2
src/backend/expungeservice/models/charge_types/traffic_offense.py
april96415/recordexpungPDX
38
13457
<filename>src/backend/expungeservice/models/charge_types/traffic_offense.py from dataclasses import dataclass from typing import Any from expungeservice.models.charge import ChargeType from expungeservice.models.charge import ChargeUtil from expungeservice.models.expungement_result import TypeEligibility, EligibilityS...
2.5625
3
os_migrate/plugins/modules/import_workload_create_instance.py
jbadiapa/os-migrate
35
13458
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) __metaclass__ = type ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } DOCUMENTATION = ''' --- module: import_workload_create_instance short_description: Create NBD ex...
1.867188
2
PythonExercicio/ex081.py
fotavio16/PycharmProjects
0
13459
<gh_stars>0 valores = [] while True: num = int(input('Digite um valor: ')) valores.append(num) cont = str(input('Quer continuar? [S/N] ')).upper() if cont == 'N': break print(f'Você digitou {len(valores)} elememtos.') valores.sort(reverse=True) print(f'Os valores em ordem decrescente são {valo...
3.9375
4
huobi/client/margin.py
codemonkey89/huobi_Python
1
13460
<gh_stars>1-10 from huobi.utils.input_checker import * class MarginClient(object): def __init__(self, **kwargs): """ Create the request client instance. :param kwargs: The option of request connection. api_key: The public key applied from Huobi. secret_key: The pr...
2.640625
3
vine/commit.py
robinson96/GRAPE
4
13461
<reponame>robinson96/GRAPE import os import option import grapeGit as git import grapeConfig import utility class Commit(option.Option): """ Usage: grape-commit [-m <message>] [-a | <filetree>] Options: -m <message> The commit message. -a Commit modified files that have not been ...
2.546875
3
allopy/optimize/regret/abstract.py
wangcj05/allopy
1
13462
from abc import ABC from typing import List, Optional, Union import numpy as np from allopy import OptData from allopy.penalty import NoPenalty, Penalty __all__ = ["AbstractObjectiveBuilder", "AbstractConstraintBuilder"] class AbstractObjectiveBuilder(ABC): def __init__(self, data: List[OptData], cvar_data: Li...
3.03125
3
dataset-processor3.py
Pawel762/class5-homework
0
13463
import os import pandas as pd import matplotlib.pyplot as plt wine_df = pd.read_csv(filepath_or_buffer='~/class5-homework/wine.data', sep=',', header=None) wine_df.columns = ['Class','Alcohol','Malic_Acid','Ash','Alcalinity_of_Ash','Magnesium', 'Total_Phenols','Flavanoid...
2.921875
3
ares/attack/bim.py
KuanKuanQAQ/ares
206
13464
<reponame>KuanKuanQAQ/ares import tensorflow as tf import numpy as np from ares.attack.base import BatchAttack from ares.attack.utils import get_xs_ph, get_ys_ph, maybe_to_array, get_unit class BIM(BatchAttack): ''' Basic Iterative Method (BIM). A white-box iterative constraint-based method. Require a differenti...
2.84375
3
parasite/resolver.py
SGevorg/parasite
9
13465
<gh_stars>1-10 import numpy as np from functools import lru_cache from typing import Tuple class DynamicResolver: def __init__(self, matrix: np.ndarray, *, num_src_lines: int = None, num_tgt_lines: int = None, max_k: int = 3, ...
2.28125
2
utils/preprocess.py
Deep-MI/3d-neuro-seg
0
13466
import numpy as np """ Contains preprocessing code for creating additional information based on MRI volumes and true segmentation maps (asegs). Eg. weight masks for median frequency class weighing, edge weighing etc. """ def create_weight_mask(aseg): """ Main function for calculating weight mask of segmentati...
3.09375
3
test/test_oneview_hypervisor_cluster_profile_facts.py
nabhajit-ray/oneview-ansible
108
13467
#!/usr/bin/python # -*- coding: utf-8 -*- ### # Copyright (2016-2020) Hewlett Packard Enterprise Development LP # # 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/licen...
1.835938
2
utils/predictions.py
jaingaurav3/ML_sample
19
13468
import os import scipy import numpy as np import pandas as pd import torch from torch.autograd import Variable def predict_batch(net, inputs): v = Variable(inputs.cuda(), volatile=True) return net(v).data.cpu().numpy() def get_probabilities(model, loader): model.eval() return np.vstack(predict_batch...
2.3125
2
gammapy/data/tests/test_pointing.py
Rishank2610/gammapy
155
13469
<gh_stars>100-1000 # Licensed under a 3-clause BSD style license - see LICENSE.rst from numpy.testing import assert_allclose from astropy.time import Time from gammapy.data import FixedPointingInfo, PointingInfo from gammapy.utils.testing import assert_time_allclose, requires_data @requires_data() class TestFixedPoin...
1.929688
2
src/config.py
BRAVO68WEB/architus
0
13470
<gh_stars>0 from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker # from src.commands import * # import src.commands as command_modules secret_token = None db_user = None db_pass = None sessions = {} try: lines = [line.rstrip('\n') for line in open('.secret_token')] secret_token = lines...
2.78125
3
aict_tools/scripts/plot_regressor_performance.py
LukasBeiske/aict-tools
0
13471
import click import logging import matplotlib import matplotlib.pyplot as plt import joblib import fact.io from ..configuration import AICTConfig from ..plotting import ( plot_regressor_confusion, plot_bias_resolution, plot_feature_importances, ) if matplotlib.get_backend() == 'pgf': from matplotlib.b...
2.203125
2
kenlm_training/cc_net/tokenizer.py
ruinunca/data_tooling
435
13472
<reponame>ruinunca/data_tooling # 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 time from typing import Dict, Optional import sacremoses # type: ignore from cc_net import jsonql,...
2.046875
2
scripts/exercicios/ex063.py
RuanBarretodosSantos/python
0
13473
<reponame>RuanBarretodosSantos/python cont = 3 t1 = 0 t2 = 1 print('-----' * 12) print('Sequência de Fibonacci') print('-----' * 12) valor = int(input('Quantos termos você quer mostrar ? ')) print('~~~~~' * 12) print(f'{t1} ➙ {t2} ' , end='➙ ') while cont <= valor: t3 = t1 + t2 print(f' {t3}', end=' ➙ ') ...
3.671875
4
CGAT/Sra.py
861934367/cgat
0
13474
########################################################################## # # MRC FGU Computational Genomics Group # # $Id$ # # Copyright (C) 2009 <NAME> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Fre...
1.960938
2
LipidFinder/LFDataFrame.py
s-andrews/LipidFinder
0
13475
# Copyright (c) 2019 <NAME> and <NAME> # # This file is part of the LipidFinder software tool and governed by the # 'MIT License'. Please see the LICENSE file that should have been # included as part of this software. """Represent a DataFrame to be processed with LipidFinder's workflow.""" import glob import logging i...
2.75
3
tensorflow/python/ops/fused_embedding_ops.py
lixy9474/DeepRec-1
0
13476
from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import ops from tensorflow.python.ops import variables from tensorflow.python.ops import array_ops from tensorflow.python.framework import sparse_tensor from tensorflow.python.o...
1.992188
2
docs/source/conf.py
deeplook/ipycanvas
0
13477
<reponame>deeplook/ipycanvas # -*- coding: utf-8 -*- import sphinx_rtd_theme extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', # 'sphinx.ext.intersphinx', # 'sphinx.ext.autosummary', # 'sphinx.ext.viewcode', # 'jupyter_sphinx.embed_widgets', ] templates_path = ['_templates'] master...
1.632813
2
pyTuplingUtils/io.py
umd-lhcb/pyTuplingUtils
0
13478
#!/usr/bin/env python3 # # Author: <NAME> # License: BSD 2-clause # Last Change: Sun May 09, 2021 at 02:52 AM +0200 import numpy as np ARRAY_TYPE = 'np' def read_branch(ntp, tree, branch, idx=None): data = ntp[tree][branch].array(library=ARRAY_TYPE) return data if not idx else data[idx] def read_branches...
2.6875
3
clinnotes/reminders/forms.py
mattnickerson993/clinnotes2
0
13479
<filename>clinnotes/reminders/forms.py<gh_stars>0 from django import forms from .models import Reminder from clinnotes.users.models import EpisodeOfCare class ReminderForm(forms.ModelForm): class Meta: model = Reminder fields = ['category', 'title', 'details', 'episode_of_care'] def __init__...
2
2
AlgorithmB.py
tejaDhulipala/SnowflakeGen
0
13480
<filename>AlgorithmB.py<gh_stars>0 import pygame as pg from shapely.geometry import Point, Polygon from time import perf_counter # Vars A = [(100, 600), (700, 600), (400, 80)] triangles = [[(100, 600), (700, 600), (400, 80)]] SQRT_3 = 3 ** (1 / 2) WHITE = (255, 255, 255) # Graphics part pg.init() screen...
2.390625
2
validator/testcases/javascript/actions.py
AutomatedTester/amo-validator
0
13481
<gh_stars>0 from copy import deepcopy from functools import partial import sys import types # Global import of predefinedentities will cause an import loop import instanceactions from validator.constants import (BUGZILLA_BUG, DESCRIPTION_TYPES, FENNEC_GUID, FIREFOX_GUID, MAX_STR_SIZE, ...
2.046875
2
geometry_utils/tests/test_bound_box.py
NOAA-ORR-ERD/geometry_utils
0
13482
#!/usr/bin/env python """ Test code for the BBox Object """ import numpy as np import pytest from geometry_utils.bound_box import (BBox, asBBox, NullBBox, InfBBox, f...
2.578125
3
cresi/net/augmentations/functional.py
ankshah131/cresi
117
13483
import cv2 cv2.setNumThreads(0) cv2.ocl.setUseOpenCL(False) import numpy as np import math from functools import wraps def clip(img, dtype, maxval): return np.clip(img, 0, maxval).astype(dtype) def clipped(func): """ wrapper to clip results of transform to image dtype value range """ ...
2.890625
3
regtestsWin_customBuildPy.py
greenwoodms/TRANSFORM-Library
29
13484
# -*- coding: utf-8 -*- """ Created on Mon Aug 14 09:49:13 2017 @author: vmg """ import os import buildingspy.development.regressiontest as r rt = r.Tester(check_html=False)#,tool="dymola") LibPath = os.path.join("TRANSFORM") ResPath = LibPath rt.showGUI(True) rt.setLibraryRoot(LibPath, ResPath) rt.setNumberOfThread...
1.859375
2
src/deoxys/model/activations.py
huynhngoc/deoxys
1
13485
# -*- coding: utf-8 -*- __author__ = "<NAME>" __email__ = "<EMAIL>" from ..keras.layers import Activation from ..keras.activations import deserialize from ..utils import Singleton class Activations(metaclass=Singleton): """ A singleton that contains all the registered customized activations """ de...
2.78125
3
raspisump/reading.py
seanm/raspi-sump
79
13486
<gh_stars>10-100 """ Module to take a water_level reading.""" # Raspi-sump, a sump pump monitoring system. # <NAME> # http://www.linuxnorth.org/raspi-sump/ # # All configuration changes should be done in raspisump.conf # MIT License -- http://www.linuxnorth.org/raspi-sump/license.html try: import ConfigParser as ...
2.75
3
pipelines/pancreas_pipeline.py
marvinquiet/RefConstruction_supervisedCelltyping
0
13487
''' Configuration generation for running Pancreas datasets ''' import os, argparse from pipelines import method_utils, dataloading_utils from preprocess.process_train_test_data import * if __name__ == "__main__": data_dir = "~/gpu/data" ## parse arguments import argparse parser = argparse.ArgumentPa...
2.390625
2
MachineLearning/StandardScaler/standardization.py
yexianyi/AI_Practice
0
13488
import pandas as pd from sklearn.preprocessing import StandardScaler def stand_demo(): data = pd.read_csv("dating.txt") print(data) transfer = StandardScaler() data = transfer.fit_transform(data[['milage', 'Liters', 'Consumtime']]) print("Standardization result: \n", data) print("Mean of each ...
3.203125
3
tests/test_primitive_roots.py
greysonDEV/rng
0
13489
<reponame>greysonDEV/rng from prng.util.util import primitive_roots import pytest def test_primitive_roots(): prim_roots_sets = [ [3, [2]], [7, [3,5]], [13, [2,6,7,11]], [17, [3,5,6,7,10,11,12,14]], [19, [2,3,10,13,14,15]], [31, [3,11,12,13,17,21,22,24]], [53...
2.125
2
hackerrank-python/xml-1-find-the-score.py
fmelihh/competitive-programming-solutions
2
13490
<reponame>fmelihh/competitive-programming-solutions # https://www.hackerrank.com/challenges/xml-1-find-the-score/problem import sys import xml.etree.ElementTree as etree def get_attr_number(node): return etree.tostring(node).count(b'=') if __name__ == '__main__': sys.stdin.readline() xml = sys.stdin.rea...
3.796875
4
CodeChef/Contest/June Long/pricecon.py
GSri30/Competetive_programming
22
13491
test = int(input()) while test > 0 : n,k = map(int,input().split()) p = list(map(int,input().split())) original = 0 later = 0 for i in p : if i > k : later += k original += i else : later += i original += i print(orig...
2.671875
3
src/utils/Shell.py
vlab-cs-ucsb/quacky
1
13492
# -*- coding: utf-8 -*- """ Created on Mon Aug 18 22:20:01 2014 @author: baki """ import shlex from subprocess import Popen, PIPE from .Log import Log class Shell: def __init__(self, TAG=""): self.log = Log(TAG=TAG) self.current_process = None self.process_output = None def setTag(s...
2.5625
3
scrapy_autounit/middleware.py
ogiaquino/scrapy-autounit
0
13493
import os import six import copy import pickle import random import logging from scrapy.http import Request from scrapy.exceptions import NotConfigured from scrapy.commands.genspider import sanitize_module_name from scrapy.spiders import CrawlSpider from .utils import ( add_sample, response_to_dict, get_o...
2.140625
2
python_examples/create_tags/utils.py
kirank0220/api-examples
1
13494
<reponame>kirank0220/api-examples ######################################################################### # _________ ___. ______________________ ___ # \_ ___ \___.__.\_ |__ ___________ / _____/\______ \ \/ / # / \ \< | | | __ \_/ __ \_ __ \/ \ ___ | _/\ ...
2.515625
3
gpytorch/lazy/non_lazy_tensor.py
phumm/gpytorch
1
13495
<reponame>phumm/gpytorch #!/usr/bin/env python3 import torch from .lazy_tensor import LazyTensor class NonLazyTensor(LazyTensor): def _check_args(self, tsr): if not torch.is_tensor(tsr): return "NonLazyTensor must take a torch.Tensor; got {}".format(tsr.__class__.__name__) if tsr.dim...
2.421875
2
aoc_wim/aoc2019/q19.py
wimglenn/advent-of-code-wim
20
13496
<filename>aoc_wim/aoc2019/q19.py<gh_stars>10-100 """ --- Day 19: Tractor Beam --- https://adventofcode.com/2019/day/19 """ from aocd import data from aoc_wim.aoc2019 import IntComputer from aoc_wim.zgrid import ZGrid from aoc_wim.search import Bisect import functools @functools.lru_cache(maxsize=100**2) def beam(z): ...
2.765625
3
BlurDetection.py
samaritan-security/samaritan-backend
0
13497
<filename>BlurDetection.py import cv2 def variance_of_laplacian(image): return cv2.Laplacian(image, cv2.CV_64F).var() """ checks if an image is blurry returns True if blurry, False otherwise """ def detect_blurry_image(image, threshold): gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) blur = variance...
3.5625
4
python-essential-training/4_operators/main.py
alexprodan99/python-workspace
0
13498
<gh_stars>0 def main(): # Arithmetic operators a = 7 b = 2 print(f'{a} + {b} = {a+b}') print(f'{a} - {b} = {a-b}') print(f'{a} * {b} = {a*b}') print(f'{a} / {b} = {a/b}') print(f'{a} // {b} = {a//b}') print(f'{a} % {b} = {a%b}') print(f'{a} ^ {b} = {a**b}') ...
4
4
UPGen/utils.py
HenryLiangzy/COMP9517_Group
21
13499
<gh_stars>10-100 """ Helper functions and utilities """ from datetime import datetime as dt from mrcnn import visualize import numpy as np import os import cv2 TIMESTAMP_FORMAT = "%d/%m/%Y %H:%M:%S" class Logger(object): """ Log events and information to a file """ def __init__(self, savePath): ...
2.953125
3