max_stars_repo_path
stringlengths
3
269
max_stars_repo_name
stringlengths
4
119
max_stars_count
int64
0
191k
id
stringlengths
1
7
content
stringlengths
6
1.05M
score
float64
0.23
5.13
int_score
int64
0
5
src/api/test/test_datahub_serializer.py
RogerTangos/datahub-stub
192
27300
<filename>src/api/test/test_datahub_serializer.py<gh_stars>100-1000 from mock import patch from django.test import TestCase from ..serializer import DataHubSerializer class DataHubSerializerTests(TestCase): """Test DataHubSerializer methods""" def setUp(self): self.username = "delete_me_username" ...
2.625
3
notes/algo-ds-practice/problems/number_theory/multiplicative_mod_inverse/multiplicative_mod_inverse.py
Anmol-Singh-Jaggi/interview-notes
6
27301
<gh_stars>1-10 from algo.number_theory.extended_gcd.extended_gcd import extended_gcd from algo.number_theory.eulers_totient_function.eulers_totient import etf def mod_inverse_gcd(a, m): ''' a and m should be coprime! Complexity -> O(log(m)). ''' return extended_gcd(a, m)[0] def mod_inverse_euler...
3.421875
3
tests/unchained/conftest.py
uolot/py-yaml-fixtures
13
27302
from flask_unchained.bundles.sqlalchemy.pytest import *
0.914063
1
meadow/meadow/migrations/0007_book_is_approved.py
digital-gachilib/meadow
0
27303
# Generated by Django 3.0.5 on 2020-04-28 15:40 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("meadow", "0006_mmake_isbn_charfield"), ] operations = [ migrations.AddField(model_name="book", name="is_approved", field=models.BooleanField...
1.523438
2
fire/cli/__init__.py
xidus/FIRE
1
27304
<reponame>xidus/FIRE<filename>fire/cli/__init__.py """ Kommandoliniebrugergrænsefladen (en command-line interface, CLI) til FIREs API. """ import sys import click from fire.api import FireDb firedb = FireDb() _show_colors = True def _set_monochrome(ctx, param, value): """ Anvend værdien af --monokrom og s...
2.140625
2
background_modelling.py
blurry-mood/computer-vision-opencv
1
27305
import cv2 as cv """ Choose background substractor """ algo = 'MOG2' input = 'videos/shine.mp4' if algo == 'MOG2': backSub = cv.createBackgroundSubtractorMOG2() else: backSub = cv.createBackgroundSubtractorKNN() capture = cv.VideoCapture(input) if not capture.isOpened(): print('Unable to open: ' + inpu...
2.78125
3
visualization.py
Agnar22/MachineLearning
1
27306
<gh_stars>1-10 import config import pandas as pd import matplotlib.pyplot as plt #import lstm from keras.models import Sequential import matplotlib.dates as mdates def visualize_spread_for_countries(data: pd.DataFrame): """ :param data: a pandas dataframe of the data to visualize. :return: """ countries_to_...
2.984375
3
src/livedumper/common.py
m45t3r/livedumper
17
27307
"Common functions that may be used everywhere" from __future__ import (absolute_import, division, print_function, unicode_literals) import os import sys from distutils.util import strtobool try: input = raw_input except NameError: pass def yes_no_query(question): """Ask the user...
3.140625
3
BOJ/week02/recursion/ex10872.py
FridayAlgorithm/taesong_study
0
27308
<filename>BOJ/week02/recursion/ex10872.py N = int(input()) def factorial(N): if N == 0: return 1 return N * factorial(N-1) print(factorial(N))
3.703125
4
pytest_lambda/fixtures.py
mikelane/pytest-lambda
1
27309
import inspect from typing import Union, Callable, Any, Iterable from pytest_lambda.exceptions import DisabledFixtureError, NotImplementedFixtureError from pytest_lambda.impl import LambdaFixture __all__ = ['lambda_fixture', 'static_fixture', 'error_fixture', 'disabled_fixture', 'not_implemented_fixture'] ...
2.28125
2
NaiveBayes/NaiveBayes/arffreader/ArffProcessor.py
NickChapman/Naive-Bayes
0
27310
<filename>NaiveBayes/NaiveBayes/arffreader/ArffProcessor.py<gh_stars>0 import random, math import utils class ArffProcessor(object): """Loads and manages an ARFF file""" def __init__(self, file_path): """Loads an ARFF file, fills in missing data points @param file_path: Path to the ARFF fi...
3.15625
3
indico/web/util.py
javfg/indico
0
27311
# This file is part of Indico. # Copyright (C) 2002 - 2021 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. import hashlib import sys from datetime import datetime import sentry_sdk from authlib.oauth2 import OAut...
1.921875
2
eval_DCBC.py
dzhi1993/DCBC_evaluation
0
27312
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Created on Mon Aug 17 11:31:32 2020 Distance-Controlled Boundaries Coefficient (DCBC) evaluation for a functional parcellation of brain cortex INPUTS: sn: The return subject number hems: Hemisphere to test. 'L' - left hemisphere; 'R'...
2.25
2
pythonclient/swagger_client/models/repository.py
kongyew/qualys_cli
0
27313
# coding: utf-8 """ Container Security API # Authentication You must authenticate to the Qualys Cloud Platform using Qualys account credentials (user name and password) and get the JSON Web Token (JWT) before you can start using the Container Security APIs. Use the Qualys Authentication API to get the JWT. *...
2.21875
2
noise_layers/rotate.py
pierrefdz/HiDDeN
0
27314
import torch.nn as nn import torch.nn.functional as F from torchvision.transforms import functional import numpy as np class Rotate(nn.Module): """ Rotate the image by random angle between -degrees and degrees. """ def __init__(self, degrees, interpolation_method='nearest'): super(Rotate, self...
2.96875
3
app/utils/weak_random.py
michel-rodrigues/viggio_backend
0
27315
import random import string def random_string_digits(string_length=10): """Generate a random string of letters and digits.""" letters_and_digits = string.ascii_letters + string.digits return ''.join(random.choice(letters_and_digits) for _ in range(string_length))
3.921875
4
bibleutils/test/test_versification.py
47rooks/bible-utilities
0
27316
<filename>bibleutils/test/test_versification.py<gh_stars>0 ''' Created on Jan 22, 2017 @author: Daniel ''' import unittest from bibleutils.versification import VersificationID, BookID, Identifier, \ ReferenceFormID, parse_refs, ETCBCHVersification, Ref, convert_refs, \ expand_refs, VersificationExcep...
2.453125
2
src/main/python/grammer/Function.py
photowey/python-study
0
27317
# -*- coding:utf-8 -*- # --------------------------------------------- # @file Function.py # @description Function # @author WcJun # @date 2020/06/20 # --------------------------------------------- # 求两个数 n 加到 m 的和 def add(n, m): s = 0 while n <= m: s += n n += 1 return s # 求和 add = add...
3.53125
4
Missions_to_Mars/scrape_mars.py
VallieTracy/web-scraping-challenge
0
27318
<gh_stars>0 # Dependencies from bs4 import BeautifulSoup as bs import requests from splinter import Browser import time import pandas as pd import requests as req # Define browser path def init_browser(): executable_path = {"executable_path":r"C:/bin/chromedriver"} return Browser('chrome', **executable_path, hea...
3.03125
3
pydmtx/__init__.py
pydmtx/pydmtx
4
27319
<reponame>pydmtx/pydmtx<filename>pydmtx/__init__.py<gh_stars>1-10 from pydmtx.symbol import Symbol from pydmtx.encode import encode as encode_encode from pydmtx.reedsolomon import encode as reedsolomon_encode from pydmtx.bitstream import bitstream from pydmtx.plugins.registry import plugin_manager from pydmtx.plugins ...
2.21875
2
tools/RNN/rnn_quantizer/tensorflow/tf_nndct/utils/__init__.py
hito0512/Vitis-AI
1
27320
from nndct_shared.utils import registry
1.03125
1
benchmark/python/tpch_base.py
alefranz/spark
1
27321
# Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the MIT license. # See the LICENSE file in the project root for more information. import pyspark from pyspark.sql import SparkSession class TpchBase: def __init__(self, spark, dir): self.c...
2.328125
2
get_data.py
savage13/botw_chart
0
27322
#!/usr/bin/env python3 import sys import json import time import subprocess cats = { "any": { "id": "vdoq4xvk", "output_file": "all.json", "output_file2": "all2.json", }, "100": { "id": "xk9jv4gd", "output_file": "100.json", "output_file2": "1002.json", }, 'amq': { "id": "n2yj3r82", "output_file": "amq.j...
2.265625
2
server/schemas/kind_to_strain.py
Georgi2704/pricelist-fastapi-boilerplate
0
27323
<filename>server/schemas/kind_to_strain.py<gh_stars>0 from datetime import datetime from typing import Optional from uuid import UUID from server.schemas.base import BoilerplateBaseModel class KindToStrainBase(BoilerplateBaseModel): kind_id: UUID strain_id: UUID # Properties to receive via API on creation ...
2.265625
2
ras_realsense/realsense_camera/test/files/scripts/check_camera_service_power_set_off_and_on_with_no_subscriber.py
RAS-2018-grp-4/ras_miscellaneous-
3
27324
<reponame>RAS-2018-grp-4/ras_miscellaneous-<gh_stars>1-10 #!/usr/bin/env python """ @file check_camera_service_power_set_off_and_on_with_no_subscriber.py """ import os import sys import unittest import time import subprocess import commands import rospy import rostest from rs_general.rs_general import get_camera_params...
2.140625
2
gardenpi/utils.py
argodev/gardenpi
0
27325
<filename>gardenpi/utils.py<gh_stars>0 #!/usr/bin/python3 # -*- coding:utf-8 -*- import logging import configparser def load_config(config_file='settings.ini'): """ Loads configuration file from disk """ logging.info("Loading Configuration Information") config = configparser.ConfigParser() co...
2.921875
3
coherence/upnp/core/device.py
palfrey/Cohen3
60
27326
# Licensed under the MIT license # http://opensource.org/licenses/mit-license.php # Copyright (C) 2006 Fluendo, S.A. (www.fluendo.com). # Copyright 2006, <NAME> <<EMAIL>> # Copyright 2018, <NAME> <<EMAIL>> ''' Devices ======= This module contains two classes describing UPnP devices. :class:`Device` --------------- ...
2.0625
2
imdb_dataloader.py
garyCC227/cs9444
0
27327
""" DO NOT MODIFY Dataloder for parts 2 and 3 We will also call this file when loading test data """ import os import glob import io from torchtext import data class IMDB(data.Dataset): name = 'imdb' dirname = 'aclImdb' def __init__(self, path, text_field, label_field, **kwargs): fields = [('text...
2.890625
3
nfl/migrations/0007_player_position.py
rwflick/djangoXNFLDemo
1
27328
<gh_stars>1-10 # Generated by Django 3.0.5 on 2020-09-13 19:49 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('nfl', '0006_player'), ] operations = [ migrations.AddField( model_name='player', name='position', ...
1.90625
2
src/commercetools/services/shopping_lists.py
jeroenubbink/commercetools-python-sdk
0
27329
<reponame>jeroenubbink/commercetools-python-sdk # DO NOT EDIT! This file is automatically generated import typing from commercetools._schemas._shopping_list import ( ShoppingListDraftSchema, ShoppingListPagedQueryResponseSchema, ShoppingListSchema, ShoppingListUpdateSchema, ) from commercetools.helpers...
1.734375
2
ui/tools.py
liyao001/BioQueue
33
27330
<reponame>liyao001/BioQueue from django.http import JsonResponse, StreamingHttpResponse from worker.bases import get_config, rand_sig, get_user_folder_size from django.core.paginator import EmptyPage, PageNotAnInteger import os def build_json_protocol(protocol): import json """ response = StreamingHttpRes...
2.171875
2
data/data-pipeline/data_pipeline/etl/sources/census_decennial/etl.py
usds/justice40-tool
59
27331
<reponame>usds/justice40-tool import json import requests import numpy as np import pandas as pd from data_pipeline.etl.base import ExtractTransformLoad from data_pipeline.utils import get_module_logger from data_pipeline.score import field_names pd.options.mode.chained_assignment = "raise" logger = get_module_logg...
2.4375
2
xml_tree.py
rcflorestal/scientificComputerPython
0
27332
<gh_stars>0 import xml.etree.ElementTree as ET # data = ''' # <person> # <name>Chuck</name> # <phone type="intl"> # +1 734 303 4456 # </phone> # <email hide="yes"/> # </person> # ''' data = ''' <person> <!-- Start tag --> <name>Chuck</name> <phone...
3.5
4
bin/gftools-find-features.py
hyvyys/gftools
1
27333
#!/usr/bin/env python3 # # 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...
2.765625
3
sockeye/postprocess.py
hec44/DCGCN
75
27334
import sys map_file = sys.argv[1] raw_test_file = sys.argv[2] output_file = sys.argv[3] date_set = ('year_0_number', 'year_1_number', 'year_2_number', 'year_3_number', 'month_0_number', 'month_0_name', 'month_1_name', 'day_0_number', 'day_1_number') def replace_date(tok): if tok == 'year_0_number': tok...
3.515625
4
samples/100_nodes.py
Kuree/pyns
0
27335
<gh_stars>0 from pyns.protocols import create_basestation, create_node, ProtocolType from pyns.engine import Simulator, SimArg, TraceFormatter, TransmissionMedium from pyns.phy import PHYLayer import logging import numpy import sys import random import os import json class ConstantSimulator(Simulator): def __init...
2.28125
2
06_Banner/python/test_banner.py
MartinThoma/basic-computer-games
1
27336
import io from banner import print_banner def test_print_banner(monkeypatch) -> None: horizontal = "1" vertical = "1" centered = "1" char = "*" statement = "O" # only capital letters set_page = "2" monkeypatch.setattr( "sys.stdin", io.StringIO( f"{horizontal}\...
2.453125
2
yt_handle.py
luceatnobis/yt_handle
0
27337
<reponame>luceatnobis/yt_handle #!/usr/bin/env python3 from __future__ import print_function import os import sys import shutil import httplib2 import oauth2client try: import apiclient as googleapiclient except ImportError: import googleapiclient from oauth2client.file import Storage, Credentials from oaut...
2.4375
2
release/stubs.min/Tekla/Structures/ModelInternal_parts/AreWeUnitTesting.py
YKato521/ironpython-stubs
0
27338
class AreWeUnitTesting(object): # no doc Value = False __all__ = []
1.21875
1
1108.defanging-an-ip-address.py
windard/leeeeee
0
27339
# coding=utf-8 # # @lc app=leetcode id=1108 lang=python # # [1108] Defanging an IP Address # # https://leetcode.com/problems/defanging-an-ip-address/description/ # # algorithms # Easy (85.21%) # Likes: 66 # Dislikes: 256 # Total Accepted: 36.7K # Total Submissions: 43.1K # Testcase Example: '"1.1.1.1"' # # Given...
4
4
Plumet/scoring.py
mehmeterenballi/Plumet
0
27340
<gh_stars>0 import pygame as pg def score_blitting(win, score): screen_width, screen_height = 288, 512 score_image = [pg.image.load('%d.png' % decimal) for decimal in range(0, 10)] if 10 > score >= 0: win.blit(score_image[score], (screen_width / 2, 0)) elif 100 > score >= 10: ...
3.140625
3
flattenator/__init__.py
lsst-sqre/flattenator
0
27341
from .flattenator import Flattenator __all__ = ["Flattenator"]
1.148438
1
examples/bbox.py
mzaglia/stac.py
0
27342
<reponame>mzaglia/stac.py<filename>examples/bbox.py #!/usr/bin/env python # coding: utf-8 #%% import stac #%% s = stac.STAC('http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1/', True) #%% s.catalog #%% collection = s.collection('C4_64_16D_MED') collection #%% items = collection.get_items(filter={'bbox':'-56.86523437...
1.875
2
cliboa/common/environment.py
chiru1221/cliboa
27
27343
# # Copyright 2019 BrainPad Inc. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, me...
1.8125
2
tests/constants.py
hairygeek/yt_lib
4
27344
<reponame>hairygeek/yt_lib CJ_PATH = r'' COOKIES_PATH = r'' CHAN_ID = '' VID_ID = ''
1.078125
1
self_driving_ai/training.py
kforti/self-driving-ai
0
27345
import copy import os import time from collections import OrderedDict from sklearn.model_selection import train_test_split from torchvision import models import torch from torch.utils.tensorboard import SummaryWriter import pandas as pd from skimage.io import imread from self_driving_ai.utils import * """ Credit: h...
2.546875
3
py/lvmutil/test/test_census.py
sdss/lvmutil
0
27346
<gh_stars>0 # Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- """Test lvmutil.census. """ from __future__ import (absolute_import, division, print_function, unicode_literals) # The line above will help with 2to3 support. import unittest has_mock = True try:...
2.3125
2
catatom2osm/csvtools.py
OSM-es/CatAtom2Osm
8
27347
<gh_stars>1-10 # -*- coding: utf-8 -*- """ CSV related help functions """ from __future__ import unicode_literals oldstr = str from builtins import str import csv import io import six from catatom2osm.config import eol, encoding, delimiter def dict2csv(csv_path, a_dict, sort=None): """ Writes a dictionary to...
3.4375
3
mpesaviz/apps/transactions/models.py
savioabuga/mpesaviz
2
27348
<gh_stars>1-10 from django.db import models from model_utils import Choices from model_utils.models import TimeStampedModel from phonenumber_field.modelfields import PhoneNumberField from django_pandas.io import read_frame class Transaction(TimeStampedModel): TYPES = Choices(('sent', 'Sent Transactions'), ('recei...
2.484375
2
ros_bt_py/test/rostest/test_topic_publish_leaf.py
fzi-forschungszentrum-informatik/ros_bt_py
4
27349
#!/usr/bin/env python # -------- BEGIN LICENSE BLOCK -------- # Copyright 2022 FZI Forschungszentrum Informatik # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the ab...
1.398438
1
workbench/awt/migrations/0012_auto_20201012_1433.py
yoshson/workbench
15
27350
<gh_stars>10-100 # Generated by Django 3.1.2 on 2020-10-12 12:33 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("awt", "0011_absence_ends_on"), ] operations = [ migrations.AddField( model_name="absence", name="is...
2.015625
2
tfsnippet/examples/auto_encoders/vae.py
897615138/tfsnippet-jill
0
27351
# -*- coding: utf-8 -*- import functools import click import tensorflow as tf from tensorflow.contrib.framework import arg_scope, add_arg_scope from tfsnippet.bayes import BayesianNet from tfsnippet.distributions import Normal, Bernoulli from tfsnippet.examples.datasets import load_mnist, bernoulli_flow from tfsnippe...
2.390625
2
HW2/Q3/Q3.py
markblitz/RU_573_HW
0
27352
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import time import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter import copy # In[22]: # helps from: https://www.geeksforgeeks.org/merge-sort/ def RecursiveMergeSort(input_array, is_first = True): time_start = time.time(...
3.390625
3
pybwap/__init__.py
NQysit/pybwap
0
27353
<gh_stars>0 # -*- coding: utf-8 -*- import os from flask import Flask, render_template, send_from_directory app = Flask(__name__) app.config.from_object('config.DevelopmentConfig') from .main import main_blueprint app.register_blueprint(main_blueprint) from .ch_0x00 import ch_0x00_blueprint app.register_blueprin...
2.03125
2
Main.py
zy-zhou/MLCS
0
27354
# -*- coding: utf-8 -*- """ Created on Tue Oct 8 19:47:52 2019 @author: Zhou """ import torch from Utils import load from Data import load_data from Modules import BasicDecoder, RNNEncoder from Models import Model, MetaTranslator from Train import MetaTrainer import warnings warnings.filterwarnings("igno...
1.9375
2
designate/backend/impl_infoblox/record_factory.py
infobloxopen/designate
0
27355
<reponame>infobloxopen/designate # Copyright 2014 Infoblox # # 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 applicabl...
1.726563
2
infer.py
AnnLIU15/SegCovid
0
27356
<filename>infer.py import os import time import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from tqdm import tqdm from datasets.inferDataSet import infer_DataSet from models.model import U2NET from segConfig import getConfig def infer(model,...
2.1875
2
spgateway/helpers.py
cjltsod/django-spgateway
2
27357
<filename>spgateway/helpers.py import logging class Warnings(object): def __init__(self, logger=None): self.warnings = list() self.logger = logger or logging def warning(self, message): self.warnings.append(message) self.logger.warning(message) def __bool__(self): ...
2.328125
2
crescent/resources/s3/bucket/transition.py
mpolatcan/zepyhrus
1
27358
<filename>crescent/resources/s3/bucket/transition.py from crescent.core import Model from crescent.functions import AnyFn from .constants import AllowedValues, ModelRequiredProperties from typing import Union class Transition(Model): def __init__(self): super(Transition, self).__init__( allowe...
2.328125
2
shop/migrations/0002_add_example_data.py
Chaiok/-django_ne_copipast_shop_master2
1
27359
# Generated by Django 4.0 on 2021-12-13 17:54 from django.db import migrations _CAR_GOODS = 'Автотовары' _APPLIANCES = 'Бытовая техника' def _create_categories(apps, schema_editor) -> None: """Создает две категории""" # noinspection PyPep8Naming Category = apps.get_model('shop', 'Category') Catego...
2.046875
2
modules/account.py
keyvantaj/Quantitative
9
27360
from ibapi.client import EClient from ibapi.wrapper import EWrapper from ibapi.contract import Contract from ibapi.order import Order from ibapi.scanner import ScannerSubscription from ibapi.ticktype import TickTypeEnum from ibapi.common import * from ibapi.tag_value import TagValue from ibapi.execution import Executio...
2.34375
2
senior/StavleLLVE/train.py
LeiGitHub1024/lowlight
79
27361
import argparse import os, socket from datetime import datetime import shutil import numpy as np import torch import torch.nn as nn from torch import optim from model import UNet from warp import WarpingLayerBWFlow from torch.utils.tensorboard import SummaryWriter from dataloader import llenDataset from torch.utils....
2.109375
2
dask_image/__init__.py
akhalighi/dask-image
2
27362
<filename>dask_image/__init__.py # -*- coding: utf-8 -*- __author__ = """<NAME>""" __email__ = "<EMAIL>" from ._version import get_versions __version__ = get_versions()['version'] del get_versions
1.640625
2
OPTICS2.py
k-kapp/Clustering-Algos
0
27363
# -*- coding: utf-8 -*- """ Created on Mon Nov 30 21:25:24 2015 @author: Konrad """ import copy import numpy as np import matplotlib.pyplot as plt import scipy.special as sc_p def gen_clusters(means, num_each): tup = (); for m in means: tup = tup + (np.random.multivariate_normal(m, np....
2.578125
3
pandayoda/test/test_interaction.py
PalNilsson/panda-yoda
0
27364
# 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 # # Authors: # - <NAME> (<EMAIL>) # - <NAME> (<EMAIL>) from mpi4py import MPI from pandayoda.yodaco...
1.773438
2
tools/instrumentation_helpers/instrumentor.py
mikezucc/xchammer
0
27365
<filename>tools/instrumentation_helpers/instrumentor.py import os import time import re import socket import json import platform import multiprocessing import getpass # Set this to the value of the statsd backend # Consider: # - allowing the user to specify this as a config # - adding the ability to load hooks as an ...
2.109375
2
peer/lifecycle/db_pb2.py
jeffgarratt/fabric-prototype
6
27366
<filename>peer/lifecycle/db_pb2.py # Generated by the protocol buffer compiler. DO NOT EDIT! # source: peer/lifecycle/db.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message fro...
1.398438
1
minepdf/cidsystem.py
jonix6/minepdf
2
27367
import re from collections import OrderedDict import struct import os import decoder748 REG_EXP = re.compile(r'^\s*<([0-9a-f]+)>\s+<([0-9a-f]+)>\s+(\d+)$', re.M) class CMap: MAP_STRING = '' def __init__(self): self.codePoints = set() self.cid2unicode = {} self._feed() def _feed...
2.375
2
src/libtakiyasha/qmc/ciphers/modern.py
nukemiko/takiyasha
15
27368
<filename>src/libtakiyasha/qmc/ciphers/modern.py from __future__ import annotations import os from typing import Generator from ...common import Cipher, KeylessCipher from ...utils import bytesxor QMCv1_KEYSTREAM_1ST_SEGMENT = b'' QMCv1_KEYSTREAM_REMAINING_SEGMENT = b'' __all__ = ['DynamicMap', 'ModifiedRC4', 'Stat...
2.4375
2
src/process_user_input.py
AndreasVikke/ComputerScience-Final
1
27369
<reponame>AndreasVikke/ComputerScience-Final<filename>src/process_user_input.py """ Processes user input from slack :license: MIT """ import json from typing import Dict from src.modules.user_input_global import UserInputGlobal from src.modules.user_input_handle_block_action import UserInputHandleBlockAction f...
2.546875
3
cflearn/api/ml/interface.py
carefree0910/carefree-learn
400
27370
import os import json import shutil import numpy as np from typing import Any from typing import Dict from typing import List from typing import Type from typing import Tuple from typing import Union from typing import Callable from typing import Optional from typing import NamedTuple from tqdm.autonotebook import tq...
1.640625
2
netta/a.py
zhangdafu12/web
0
27371
<filename>netta/a.py # -*- encoding:utf8 -*- # author: Shulei # e-mail: <EMAIL> # time: 2019/4/2 10:00 import time # 一个描述器就是一个实现了三个核心的属性访问操作(get、set、delete)的类,分别为__get__(), __set__(),__delete__() # 这些方法接受一个实例作为输入,之后相应的操作实例底层的字典, 为了使用一个描述器,需要将这个描述器的实例作为类属性放到一个类的定义中Dadej # Descriptors are class attributes (like proper...
4.3125
4
ensembler/visualisation/plotConveyorBelt.py
philthiel/Ensembler
39
27372
<filename>ensembler/visualisation/plotConveyorBelt.py import matplotlib.patches as patches import matplotlib.patheffects as path_effects import matplotlib.pyplot as plt import numpy as np def calc_lam(CapLam, i=0, numsys=8, w=0.1): ome = (CapLam + i * np.pi * 2.0 / numsys) % (2. * np.pi) if ome > np.pi: ...
2.265625
2
data_structures/binary_tree/__init__.py
Mhassanbughio/Python-1
2
27373
class Rectangle: def __init__(self, length, breadth, unit_cost=0): self.length = length self.breadth = breadth self.unit_cost = unit_cost def get_area(self): return self.length * self.breadth def calculate_cost(self): area = self.get_area() return area * self.unit_cost...
3.953125
4
mll/discrete_agent_play.py
asappresearch/compositional-inductive-bias
2
27374
""" one agent chooses an action, says it. other agent does it. both get a point if right this file was forked from mll/discrete_bottleneck_discrete_input.py """ import torch import torch.nn.functional as F from torch import nn, optim # from envs.world3c import World from ulfs import alive_sieve, rl_common from ulfs.s...
3.046875
3
maggy/searchspace.py
amacati/maggy
81
27375
# # Copyright 2020 Logical Clocks AB # # 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 ag...
3.265625
3
examples/fiducials.py
alisterburt/yet-another-imod-wrapper
0
27376
<reponame>alisterburt/yet-another-imod-wrapper from pathlib import Path import numpy as np from yet_another_imod_wrapper.fiducials import run_fiducial_based_alignment TEST_DATA_DIR = Path(__file__).parent.parent / 'tilt_series' run_fiducial_based_alignment( tilt_series_file=TEST_DATA_DIR / 'my_prefix_TS_01.mrc'...
1.664063
2
Testing/daemon_Fake_Dev.py
nandor1992/FogOfThings
1
27377
<filename>Testing/daemon_Fake_Dev.py #!/usr/bin/env python import couchdb import pika import ast import time import threading import ctypes import datetime import sys from daemon import Daemon import ConfigParser import logging t=time t.clock() PIDFILE="/home/pi/FogOfThings/Device/pid/fake_dev.pid" Config=ConfigParser....
2.0625
2
src/mavelp/kernel_methods.py
nanoMFG/VELP
0
27378
import numpy as np from sklearn.kernel_ridge import KernelRidge from sklearn.model_selection import GridSearchCV from sklearn.gaussian_process import GaussianProcessRegressor import sklearn.gaussian_process.kernels as Kernels from scipy.optimize import minimize from numpy.linalg import norm import tensorflow as tf fr...
2.4375
2
menpo/io/input/landmark_image.py
yuxiang-zhou/menpo
0
27379
from functools import partial from .landmark import asf_importer, pts_importer asf_image_importer = partial(asf_importer, image_origin=True) asf_image_importer.__doc__ = asf_importer.__doc__ pts_image_importer = partial(pts_importer, image_origin=True) pts_image_importer.__doc__ = pts_importer.__doc__
1.40625
1
corpus2alpino/targets/filesystem.py
UUDigitalHumanitieslab/folia2alpino
2
27380
<reponame>UUDigitalHumanitieslab/folia2alpino #!/usr/bin/env python3 from corpus2alpino.abstracts import Target from corpus2alpino.models import Document from os import path, makedirs from pathlib import Path from typing import cast, Any class FilesystemTarget(Target): """ Output chunks to a file using newli...
2.828125
3
Substring with Concatenation of All Words.py
sugia/leetcode
0
27381
<gh_stars>0 ''' You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and without any intervening characters. Example 1: Input: s = "barfoothefoobarman", words = ["foo","bar"...
3.578125
4
renomearArquivo.py
MarianaFRocha/Manipulacao-de-Arquivos
0
27382
import os # exemplo alterado de EX_10.5.py para 10_5.py for nome in os.listdir('./Minicurso/Minicurso API'): # alterar conforme sua necessidade de geração de nomes e layout de arquivos os.rename("./Minicurso/Minicurso API/"+nome, "./Minicurso/Minicurso API/"+nome+"_Minicurso_API.png") print("arquivo ...
2.4375
2
setup.py
JoffreyN/HTMLReport
4
27383
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys if sys.version_info < (3, 5): raise RuntimeError("The minimum support Python 3.5") from setuptools import find_packages from setuptools import setup from HTMLReport import __version__, __author__ try: from pypandoc import convert r...
1.851563
2
batch.py
SergioLaRosa/downloaderdude
0
27384
<filename>batch.py # URLs processed simultaneously class Batch(): def __init__(self): self._batch = 0 def set_batch(self, n_batch): try: self._batch = n_batch except BaseException: print("[ERROR] Can't set task batch number.") def get_batch(self): ...
3.015625
3
workflow/scripts/download_flyxcdb_data.py
tomasMasson/wiring-molecules
0
27385
<filename>workflow/scripts/download_flyxcdb_data.py #!/usr/bin/env python3 "Download Drosophila melanogaster extracellular domain batabase (FlyXCDB) table, published in the Journal of Molecular Biology" import click import requests import pandas as pd from bs4 import BeautifulSoup def scrape_url(url): """ Sc...
3.484375
3
common/updatefiles.py
cheersalam/webrtc
0
27386
<reponame>cheersalam/webrtc<filename>common/updatefiles.py playerFilesWin = { "lib/avcodec-56.dll" : { "flag_deps" : True, "should_be_removed" : True }, "lib/avformat-56.dll" : { "flag_deps" : True, "should_be_removed" : True }, "lib/avutil-54.dll" : { "flag_deps" : True, "should_be_removed" : True ...
1.585938
2
models/base_model.py
siyuhuang/PoseStylizer
75
27387
import os import torch import torch.nn as nn import numpy as np import pickle class BaseModel(nn.Module): def __init__(self): super(BaseModel, self).__init__() def name(self): return 'BaseModel' def initialize(self, opt): self.opt = opt self.gpu_ids = opt.gpu_ids ...
2.453125
2
backend/tuber/migrations/versions/4ae40638e863_adding_hotel_block_to_requests.py
bitbyt3r/2ber
6
27388
<reponame>bitbyt3r/2ber """Adding hotel block to requests Revision ID: <KEY> Revises: 1708acb6e515 Create Date: 2021-11-15 20:42:51.723559 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '1708acb6e515' branch_labels = None depends_on = N...
1.546875
2
xoinvader/collision.py
pankshok/xoinvader
13
27389
<reponame>pankshok/xoinvader """Collision detection system and component module.""" import functools import logging import re import weakref from xoinvader import app from xoinvader.utils import Point LOG = logging.getLogger(__name__) COLLISIONS = {} """Global mapping TypePair <=> [callable].""" class Collision...
2.359375
2
test/testing/test_pandas_assert.py
S-aiueo32/gokart
255
27390
<reponame>S-aiueo32/gokart import unittest import pandas as pd import gokart class TestPandasAssert(unittest.TestCase): def test_assert_frame_contents_equal(self): expected = pd.DataFrame(data=dict(f1=[1, 2, 3], f3=[111, 222, 333], f2=[4, 5, 6]), index=[0, 1, 2]) resulted = pd.DataFrame(data=dic...
2.75
3
binsdpy/similarity/group_b.py
mikulatomas/binsdpy
0
27391
<reponame>mikulatomas/binsdpy import math from binsdpy.utils import operational_taxonomic_units, BinaryFeatureVector def russell_rao( x: BinaryFeatureVector, y: BinaryFeatureVector, mask: BinaryFeatureVector = None ) -> float: """Russel-Rao similarity <NAME>., & <NAME>. (1940). On habitat and associ...
2.8125
3
design/gpgpu/configs/gpu_protocol/VI_hammer_fusion.py
chisuhua/gem5
0
27392
<gh_stars>0 # Copyright (c) 2006-2007 The Regents of The University of Michigan # Copyright (c) 2009 Advanced Micro Devices, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions ...
1.3125
1
testing/test_awswrangler/test_athena.py
stijndehaes/aws-data-wrangler
0
27393
<gh_stars>0 import logging import pytest import boto3 from awswrangler import Session from awswrangler.exceptions import QueryCancelled, QueryFailed logging.basicConfig( level=logging.INFO, format="[%(asctime)s][%(levelname)s][%(name)s][%(funcName)s] %(message)s") logging.getLogger("awswrangler").setLevel(lo...
1.945313
2
hello_world.py
hmallen/mrhawaii
0
27394
<reponame>hmallen/mrhawaii<filename>hello_world.py # Hello world program to demonstrate running PYthon files print('Hello, world!') print('I live on a volcano!')
2.640625
3
lib/JumpScale/lib/ms1/__init__.py
rudecs/jumpscale_core7
0
27395
from JumpScale import j def cb(): from .ms1 import MS1Factory return MS1Factory() j.base.loader.makeAvailable(j, 'tools') j.tools._register('ms1', cb)
1.523438
2
erpnext/utilities/__init__.py
nagendrarawat/erpnext_custom
2
27396
## temp utility from __future__ import print_function import frappe from erpnext.utilities.activation import get_level from frappe.utils import cstr def update_doctypes(): for d in frappe.db.sql("""select df.parent, df.fieldname from tabDocField df, tabDocType dt where df.fieldname like "%description%" and df.par...
1.671875
2
test/workers/test_websocket_worker.py
theoptips/PySyft
1
27397
<reponame>theoptips/PySyft import io from os.path import exists, join import time from socket import gethostname from OpenSSL import crypto, SSL import pytest import torch from syft.workers import WebsocketClientWorker from syft.workers import WebsocketServerWorker @pytest.mark.parametrize("secure", [True, False]) d...
2.1875
2
PiCN/Simulations/BalancedForwardingStrategySimulation.py
DimaMansour/PiCN
0
27398
"""Simulate a Map Reduce Scenario where timeout prevention is required. In this simulation we are using an Optimizer created for map reduce scenarios. This improves the distribution of the computation no matter how the interest is formated. Scenario consists of two NFN nodes and a Client. Goal of the simulation is to ...
2.5625
3
Tools/MagicPanels/panelMoveXp.py
dprojects/Woodworking
6
27399
<gh_stars>1-10 import MagicPanels MagicPanels.panelMove("Xp")
1.085938
1