content
stringlengths
7
928k
avg_line_length
float64
3.5
33.8k
max_line_length
int64
6
139k
alphanum_fraction
float64
0.08
0.96
licenses
list
repository_name
stringlengths
7
104
path
stringlengths
4
230
size
int64
7
928k
lang
stringclasses
1 value
import titration.utils.analysis as analysis import titration.utils.constants as constants import titration.utils.devices.serial_mock as serial_mock import titration.utils.interfaces as interfaces class Syringe_Pump: def __init__(self): self.serial = serial_mock.Serial( port=constants.ARDUINO_P...
39.689076
112
0.597925
[ "MIT" ]
KonradMcClure/AlkalinityTitrator
titration/utils/devices/syringe_pump_mock.py
4,723
Python
from typing import TYPE_CHECKING from loopchain.jsonrpc.exception import GenericJsonRpcServerError from loopchain.blockchain.blocks import BlockBuilder, BlockVerifier as BaseBlockVerifier from loopchain.blockchain.blocks.v0_1a import BlockHeader from loopchain.blockchain.exception import ScoreInvokeError, ScoreInvokeR...
46.494949
98
0.625244
[ "Apache-2.0" ]
JINWOO-J/loopchain
loopchain/blockchain/blocks/v0_1a/block_verifier.py
4,603
Python
# Copyright (c) 2019-2020, Manfred Moitzi # License: MIT-License from typing import TYPE_CHECKING, Iterable, cast, Union, List, Set from contextlib import contextmanager import logging from ezdxf.lldxf import validator, const from ezdxf.lldxf.attributes import ( DXFAttr, DXFAttributes, DefSubclass, RETURN_DEFAULT, ...
34.432927
80
0.609616
[ "MIT" ]
dmtvanzanten/ezdxf
src/ezdxf/entities/dxfgroups.py
11,294
Python
import numpy as np import pandas as pd from pylab import rcParams from sklearn.metrics import mean_absolute_error, mean_squared_error # Additional custom functions from cases.industrial.processing import multi_automl_fit_forecast, plot_results from fedot.core.constants import BEST_QUALITY_PRESET_NAME from fedot.core.d...
43.333333
85
0.608077
[ "BSD-3-Clause" ]
vishalbelsare/FEDOT
cases/industrial/multivariate_forecasting.py
2,600
Python
from werkzeug.wrappers import Response from .application import Rocinante from .request import Request from .response import JSONResponse from .router import Router from .handler import RequestHandler from .url import Url from . import status
24.4
38
0.831967
[ "Apache-2.0" ]
a30285/Rocinante
rocinante/__init__.py
244
Python
""" Source code for PyGMT modules. """ # pylint: disable=import-outside-toplevel from pygmt.src.basemap import basemap from pygmt.src.blockm import blockmean, blockmedian from pygmt.src.coast import coast from pygmt.src.colorbar import colorbar from pygmt.src.config import config from pygmt.src.contour import contour ...
35.135135
80
0.824615
[ "BSD-3-Clause" ]
alperen-kilic/pygmt
pygmt/src/__init__.py
1,300
Python
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import, unicode_literals from parser_base import RegexParser import model class RegexSemantics(object): def __init__(self): super(RegexSemantics, self).__init__() self._count = 0 def START(self, ast): re...
24.219512
82
0.637462
[ "BSD-2-Clause" ]
alyosha1879/grako
examples/regex/regex_parser.py
993
Python
# coding: utf-8 """ FlashArray REST API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 2.7 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re import six import typing from ....
39.647059
524
0.618323
[ "BSD-2-Clause" ]
Flav-STOR-WL/py-pure-client
pypureclient/flasharray/FA_2_7/models/volume_snapshot_get_response.py
5,392
Python
"""A fingerprint + random forest model. Try to generate independent and identically distributed figerprint as decoy. """ import os import sys import json import argparse import numpy as np from pathlib import Path from tqdm import tqdm import scipy.sparse as sp from scipy.spatial import distance from multiprocessing i...
30.754839
106
0.646528
[ "MIT" ]
hnlab/can-ai-do
pdbbind/props_random_forest.py
4,767
Python
from datanator_query_python.util import mongo_util from pymongo.collation import Collation, CollationStrength class QueryXmdb: def __init__(self, username=None, password=None, server=None, authSource='admin', database='datanator', max_entries=float('inf'), verbose=True, collection_str='ecmdb', ...
38.780822
140
0.579301
[ "MIT" ]
KarrLab/datanator_query_python
datanator_query_python/query/query_xmdb.py
2,831
Python
# Copyright (c) Facebook, Inc. and its affiliates. import copy import logging import numpy as np from typing import List, Optional, Union import torch from detectron2.config import configurable from . import detection_utils as utils from . import transforms as T """ This file contains the default mapping that's appl...
43.154255
100
0.644768
[ "Apache-2.0" ]
Jerrypiglet/detectron2
detectron2/data/dataset_mapper.py
8,113
Python
from bs4 import BeautifulSoup from urllib.request import urlopen def main(): url = "http://www.networksciencelab.com" with urlopen(url) as doc: soup = BeautifulSoup(doc) links = [(link.string, link['href']) for link in soup.find_all('a') if link.has_attr('href') ] # print(l...
24.08
45
0.58804
[ "MIT" ]
zzragida/study-datascience
data-science-essentials-in-python/broken-link-detector.py
602
Python
#!/usr/bin/env python3.8 # Copyright 2018 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import contextlib import errno import json import os import shutil import sys import tarfile import tempfile from fu...
36.091127
85
0.634485
[ "BSD-2-Clause" ]
allansrc/fuchsia
scripts/sdk/merger/merge.py
15,050
Python
def sort(arr): for i in range(1, len(arr)): key = arr[i] j = i-1 while j >=0 and key < arr[j] : arr[j+1] = arr[j] j -= 1 arr[j+1] = key return arr arr = list(map(int,input("Enter Numbers: ").split())) print(sort(arr))
24.5
53
0.442177
[ "MIT" ]
Aashutosh-922/Data-Structures-And-Algorithms
sorting/python/insertion-sort.py
294
Python
import boto from boto.dynamodb2.fields import HashKey from boto.dynamodb2.table import Table conn = boto.dynamodb.connect_to_region('us-west-2') connection=boto.dynamodb2.connect_to_region('us-west-2') users = Table.create('users', schema=[ HashKey('username'), # defaults to STRING data_type ], throughput={ ...
28.571429
56
0.72
[ "Apache-2.0" ]
samvarankashyap/amazondynamodb
samplescripts/create_table.py
400
Python
""" Airflow API (Stable) # Overview To facilitate management, Apache Airflow supports a range of REST API endpoints across its objects. This section provides an overview of the API design, methods, and supported use cases. Most of the endpoints accept `JSON` as input and return `JSON` responses. This means t...
230.589744
8,173
0.759813
[ "Apache-2.0" ]
sptsakcg/airflow-client-python
airflow_client/test/test_dag_collection_all_of.py
8,993
Python
print("=="*20) print(f' Banco dev') print("=="*20) sac = float(input('Qual o valor voce quer sacar?R$ ')) total = sac ced = 50 totced = 0 while True: if total >=ced: total -= ced totced += 1 else: print(f'Total de {totced} cedulas de R${ced}') if ced == 50: ...
21.304348
55
0.436735
[ "MIT" ]
lucasohara98/Python_CursoemVideo
PythonExecicios/ex071.py
490
Python
# -*- coding: utf-8 -*- from __future__ import division, unicode_literals from __future__ import absolute_import from uuid import uuid1 from datetime import datetime import pytest import pytz from pycoin.key.BIP32Node import BIP32Node from transactions import Transactions from transactions.services.daemonservice im...
37.608696
76
0.69328
[ "Apache-2.0" ]
ascribe/pyspool
tests/test_spoolex.py
13,840
Python
#!/usr/bin/python3 import time from flask import url_for from urllib.request import urlopen from . util import set_original_response, set_modified_response, live_server_setup sleep_time_for_fetch_thread = 3 # Basic test to check inscriptus is not adding return line chars, basically works etc def test_inscriptus(): ...
33.170543
111
0.685441
[ "Apache-2.0" ]
shaikhspeare/changedetection.io
changedetectionio/tests/test_backend.py
4,279
Python
# -*- coding: utf-8 -*- """ kay.ext.gaema.urls :Copyright: (c) 2009 Takashi Matsuo <tmatsuo@candit.jp> All rights reserved. :license: BSD, see LICENSE for more details. """ from kay.routing import ( ViewGroup, Rule ) view_groups = [ ViewGroup( Rule('/login/<service>', endpoint='login', ...
28.931034
71
0.649583
[ "Apache-2.0", "BSD-3-Clause" ]
IanLewis/kay
kay/ext/gaema/urls.py
839
Python
from django.db import models class Rice(models.Model): state_name=models.CharField("state_name",max_length=255) distict_name=models.CharField("distict_name",max_length=255) crop_year=models.IntegerField("crop_year") season=models.CharField("season",max_length=255) crop=models.CharField("crop",max_l...
43.153846
64
0.770053
[ "MIT" ]
blitz-cmd/Rice-Crop-Yield-Prediction
Rice_Crop_Yield_Prediction/models.py
561
Python
""" Asyncio using Asyncio.Task to execute three math function in parallel """ import asyncio @asyncio.coroutine def factorial(number): f = 1 for i in range(2, number+1): print("Asyncio.Task: Compute factorial(%s)" % (i)) yield from asyncio.sleep(1) f *= i print("Asyncio.Task - facto...
29.45
70
0.60017
[ "MIT" ]
jsdnhk/python-parallel-programming-cookbook-code
Chapter 4/asyncio_Task.py
1,178
Python
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import unittest from dataclasses import dataclass from textwrap import dedent from typing import Dict from pants.engine.fs import FileContent from pants.option.config import Config, TomlS...
32.158537
103
0.506763
[ "Apache-2.0" ]
wonlay/pants
src/python/pants/option/config_test.py
7,911
Python
import contextlib import logging from cStringIO import StringIO from teuthology import misc from teuthology.job_status import set_status from teuthology.orchestra import run log = logging.getLogger(__name__) @contextlib.contextmanager def syslog(ctx, config): """ start syslog / stop syslog on exit. ""...
33.789157
94
0.415404
[ "MIT" ]
dzedro/teuthology
teuthology/task/internal/syslog.py
5,609
Python
#https://www.codechef.com/problems/DECINC n = int(input()) if(n%4==0): print(n+1) else: print(n-1)
17.666667
41
0.613208
[ "Unlicense" ]
27Anurag/Competitive-programing-hacktoberfest-2021
CodeChef/DECINC_Decrement OR Increment.py
106
Python
r"""Distributed TensorFlow with Monitored Training Session. This implements the 1a image recognition benchmark task, see https://mlbench.readthedocs.io/en/latest/benchmark-tasks.html#a-image-classification-resnet-cifar-10 for more details Adapted from official tutorial:: https://www.tensorflow.org/deploy/distrib...
35.200743
161
0.598479
[ "Apache-2.0" ]
mlbench/mlbench-benchmarks
tensorflow/imagerecognition/openmpi-cifar10-resnet20-all-reduce/main.py
9,469
Python
from pathlib import Path, PurePath class Directory: def __init__(self, path_in_image, path_out_image, path_out_file): self.__path_in_image = path_in_image self.__path_out_image = path_out_image self.__path_out_file = path_out_file self.__allowed_image_extension = ['.jpg', '.jpeg',...
30.767442
72
0.663643
[ "MIT" ]
paaarx/tax_receipt
tax_receipt/directory.py
1,323
Python
# =============================================================================== # Copyright 2014 Jake Ross # # 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/licens...
37.322581
81
0.543647
[ "Apache-2.0" ]
ASUPychron/pychron
pychron/pipeline/tagging/base_tags.py
1,157
Python
import time import types import unittest from unittest.mock import ( call, _Call, create_autospec, MagicMock, Mock, ANY, _CallList, patch, PropertyMock ) from datetime import datetime class SomeClass(object): def one(self, a, b): pass def two(self): pass def three(self, a=None): ...
29.372756
80
0.559354
[ "Apache-2.0" ]
4nkitd/pyAutomation
Mark_attandance_py_selenium/py/App/Python/Lib/unittest/test/testmock/testhelpers.py
27,816
Python
# Generated by Django 3.2.4 on 2021-08-06 15:38 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('blog', '0002_alter_tag_tag_name'), ] operations = [ migrations.RemoveField( model_name='comment', name='subject', ),...
18.166667
47
0.590214
[ "MIT" ]
Gandabh/E-commerce-Site
blog/migrations/0003_remove_comment_subject.py
327
Python
# 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, software # distribu...
38.766234
79
0.605109
[ "Apache-2.0" ]
0tt3r/OpenFermion
src/openfermion/ops/_binary_code.py
11,940
Python
from concurrent.futures import ThreadPoolExecutor, CancelledError from aiomysql import create_pool from asyncio import ensure_future, gather, sleep from pymysql.err import OperationalError from logging import getLogger from sanic import Sanic from sanic.request import Request from sanic.response import json from sanic....
33.461538
126
0.669294
[ "MIT" ]
bubblegumsoldier/kiwi
kiwi-content/kiwi/app.py
6,090
Python
import click import subprocess import os @click.group() def cli(): ... @cli.command() def deploy(): click.echo("Running chalice deploy") output = subprocess.check_output(f"source {os.environ['VIRTUAL_ENV']}/bin/activate && chalice deploy",shell=True) click.echo(output) click.echo(os.environ["VIRT...
18.5
117
0.693694
[ "Apache-2.0" ]
foretheta/whatsup
scripts/whatsup.py
333
Python
# tested from boa.builtins import take def Main(amount): str1 = 'helloworld1234567' str2 = take(str1, amount) return str2
10.769231
30
0.664286
[ "MIT" ]
CityOfZion/neo-boa
boa_test/example/TakeTest.py
140
Python
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
32.442748
105
0.675647
[ "Apache-2.0" ]
Gavin-Hoang/mindspore
tests/ut/python/dataset/test_dataset_numpy_slices.py
8,500
Python
""" Bu kod MQTT den alir FireBase e atar """ import firebase_admin from firebase_admin import credentials from firebase_admin import firestore import paho.mqtt.client as mqtt from time import sleep import json import sys Fb_Coll = "color" def main(): x = open("../ip.json") data_ = json.load(x) ...
24.344828
77
0.580737
[ "MIT" ]
KJPOUNDY132/mqtt_to_firebase
MyAwsomeMainCode/send_.py
1,412
Python
# # SPDX-FileCopyrightText: Copyright (c) 1993-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # 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 License at...
37.690909
187
0.713459
[ "Apache-2.0" ]
GreyZzzzzzXh/TensorRT
samples/python/uff_ssd/utils/engine.py
4,146
Python
class CouponNotFoundException(Exception): pass
25
41
0.82
[ "MIT" ]
daniellima/desafio-lojaintegrada
src/app/coupon/coupon_not_found_exception.py
50
Python
from .imports import * def rainbow_to_vector(r, timeformat='h'): """ Convert Rainbow object to np.arrays Parameters ---------- r : Rainbow object chromatic Rainbow object to convert into array format timeformat : str (optional, default='hours') The time ...
32.910448
112
0.578005
[ "MIT" ]
catrionamurray/chromatic_fitting
src/utils.py
4,410
Python
""" This test will initialize the display using displayio and draw a solid red background """ import board import displayio from adafruit_st7735r import ST7735R spi = board.SPI() tft_cs = board.D5 tft_dc = board.D6 displayio.release_displays() display_bus = displayio.FourWire(spi, command=tft_dc, chip_...
24.294118
90
0.690073
[ "MIT" ]
jadudm/feather-isa
infra/libs-400rc2-20190512/examples/st7735r_128x160_simpletest.py
826
Python
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test wallet import RPCs. Test rescan behavior of importaddress, importpubkey, importprivkey, and impor...
47.631579
116
0.654365
[ "MIT" ]
BlueScionic/vivarium
test/functional/import-rescan.py
9,050
Python
shisu_risto = [1, 0, 2] kazu_risto = [1, 4, 6] tou_risto = [] for ai in range(len(shisu_risto)): tou_risto.append(kazu_risto[shisu_risto[ai]]) print(tou_risto)
16.7
49
0.682635
[ "MIT" ]
ALFA-group/neural-program-comprehension
stimuli/Python/one_file_per_item/jap/33_# math_for 15.py
167
Python
# # ------------------------------------------------------------------------- # Copyright (c) 2018 Intel Corporation Intellectual Property # # 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...
38.4
94
0.639323
[ "Apache-2.0" ]
onap/optf-has
conductor/conductor/tests/unit/api/controller/test_root.py
1,536
Python
from apollo.viewsets import UserViewSet from applications.assets.viewsets import EquipmentViewSet, ServiceViewSet from applications.business.viewsets import BusinessViewSet, BusinessMembershipViewSet from applications.charge_list.viewsets import ChargeListViewSet, ActivityChargeViewSet, \ ActivityChargeActivityCoun...
75.162162
120
0.848256
[ "MIT" ]
awwong1/apollo
apollo/router.py
2,781
Python
from whey.mixin import BuilderMixin class GettextMixin: def build_messages(self: BuilderMixin): from babel.messages.mofile import write_mo from babel.messages.pofile import read_po locales = self.pkgdir / "locales" if self.verbose: print(" Building messages") for po in locales.glob("*/LC_MESSAGES/pm2h...
27.205882
76
0.718919
[ "MPL-2.0" ]
bedwardly-down/pm2hw
build_hooks.py
925
Python
# coding: utf-8 """ """ from copy import deepcopy import datetime import io import json import math import os import zipfile import flask import flask_login import itsdangerous import werkzeug.utils from flask_babel import _ from . import frontend from .. import logic from .. import models from .. import db from .....
47.410323
405
0.664943
[ "MIT" ]
sciapp/sampledb
sampledb/frontend/objects.py
110,241
Python
from decimal import Decimal, ROUND_DOWN from time import time def elapsed(t0=0.0): """get elapsed time from the give time Returns: now: the absolute time now dt_str: elapsed time in string """ now = time() dt = now - t0 dt_sec = Decimal(str(dt)).quantize(Decimal('.0001'), ...
23.85
77
0.603774
[ "Apache-2.0" ]
mhdella/andes
andes/utils/time.py
477
Python
_base_ = './fcn_r50-d8_512x1024_40k_cityscapes.py' model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
43.666667
79
0.778626
[ "Apache-2.0" ]
1171000410/mmsegmentation
configs/fcn/fcn_r101-d8_512x1024_40k_cityscapes.py
131
Python
# Copyright 2019 Splunk, Inc. # # Use of this source code is governed by a BSD-2-clause-style # license that can be found in the LICENSE-BSD2 file or at # https://opensource.org/licenses/BSD-2-Clause from jinja2 import Environment from .sendmessage import * from .splunkutils import * from .timeutils import * import ...
54.245902
332
0.686008
[ "BSD-2-Clause", "CC0-1.0" ]
iainrose/splunk-connect-for-syslog
tests/test_aruba.py
3,309
Python
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'hackcrisis.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise Imp...
28.636364
74
0.684127
[ "MIT" ]
jakubzadrozny/hackcrisis
manage.py
630
Python
# This script fetches Atelier 801 translation file and adds the required IDs into our own translation files import sys from urllib.request import urlopen import zlib from string import Template import json if len(sys.argv) < 2: print("Please pass in lang code for first arguement") exit() lang = sys.argv[1] url = 'h...
20.015873
107
0.607851
[ "MIT" ]
fewfre/TransformiceSkillTreeBuilder
i18n/_tfm_trans_to_skilldata.py
2,522
Python
#!/usr/bin/env python __author__ = ('Duy Tin Truong (duytin.truong@unitn.it), ' 'Aitor Blanco Miguez (aitor.blancomiguez@unitn.it)') __version__ = '3.0' __date__ = '21 Feb 2020' import argparse as ap import dendropy from io import StringIO import re from collections import defaultdict import matplotli...
37.527607
103
0.542586
[ "MIT" ]
Adrian-Howard/MetaPhlAn
metaphlan/utils/plot_tree_graphlan.py
6,117
Python
from django.db import models from django.urls import reverse import uuid # Required for unique book instances class Genre(models.Model): """ Model representing a book genre (e.g. Science Fiction, Non Fiction). """ name = models.CharField(max_length=200, help_text="Enter a book genre (e.g. Sc...
32.084746
132
0.651083
[ "MIT" ]
zhekazuev/mozilla-django-learning
src/locallibrary/catalog/models.py
3,786
Python
# -------------- import pandas as pd import numpy as np from sklearn.cross_validation import train_test_split # code starts here df = pd.read_csv(path) df.head() X = df[['ages','num_reviews','piece_count','play_star_rating','review_difficulty','star_rating','theme_name','val_star_rating','country']] y = df['list_price'...
21.704225
138
0.720311
[ "MIT" ]
iamacityzen/ga-learner-dsmp-repo
Making-first-prediction-using-linear-regression/code.py
1,541
Python
from dgl.data import CoraGraphDataset, CiteseerGraphDataset, PubmedGraphDataset def load(name): if name == 'cora': dataset = CoraGraphDataset() elif name == 'citeseer': dataset = CiteseerGraphDataset() elif name == 'pubmed': dataset = PubmedGraphDataset() graph = dataset[0] ...
28.315789
79
0.667286
[ "Apache-2.0" ]
905355494/dgl
examples/pytorch/grace/dataset.py
538
Python
from enum import IntEnum from typing import Dict, Union, Callable, Any from cereal import log, car import cereal.messaging as messaging from common.realtime import DT_CTRL from selfdrive.config import Conversions as CV from selfdrive.locationd.calibrationd import MIN_SPEED_FILTER AlertSize = log.ControlsState.AlertSi...
33.876368
116
0.674547
[ "MIT" ]
agegold/neokii_KR-1
selfdrive/controls/lib/events.py
34,085
Python
import numpy as np import h5py import argparse import imageio import tqdm import os from glob import glob def main(args): """Main function to parse in Nuclei Dataset from Kaggle and store as HDF5 Parameters ---------- args: ArgumentParser() input_dir: str directory of ...
23.879121
90
0.588127
[ "Apache-2.0" ]
marshuang80/CellSegmentation
process_data/nuclei_create_hdf5.py
2,173
Python
#11_Duplicate in an array N+1 integer """ Given an array of n elements that contains elements from 0 to n-1, with any of these numbers appearing any number of times. Find these repeating numbers in O(n) and using only constant memory space. Example: Input : n = 7 and array[] = {1, 2, 3, 6, 3, 6, 1} Output...
26.641509
199
0.640227
[ "MIT" ]
iamParvezKhan25/Data-Structure-Algorithm
11_Duplicate in an array N+1 integer.py
1,414
Python
# Copyright (c) OpenMMLab. All rights reserved. import torch from torch.nn.parallel.distributed import (DistributedDataParallel, _find_tensors) from mmcv import print_log from mmcv.utils import TORCH_VERSION, digit_version from .scatter_gather import scatter_kwargs class MM...
42.568345
78
0.603008
[ "Apache-2.0" ]
BIGWangYuDong/mmcv
mmcv/parallel/distributed.py
5,917
Python
import datetime import json import logging import re import time from google.appengine.ext import db # from google.appengine.ext.db import djangoforms from google.appengine.api import mail from google.appengine.api import memcache from google.appengine.api import urlfetch from google.appengine.api import taskqueue fro...
40.36664
649
0.693194
[ "Apache-2.0" ]
cwilso/chromium-dashboard
models.py
51,306
Python
# -*- coding: utf-8 -*- import time from pymongo import MongoClient from config import MONGO_CONFIG def get_current_time(format_str: str = '%Y-%m-%d %H:%M:%S'): """ 获取当前时间,默认为 2020-01-01 00:00:00 格式 :param format_str: 格式 :return: """ return time.strftime(format_str, time.localtime()) class ...
25.551402
69
0.49305
[ "MIT" ]
matiastang/selenium-learning
src/sogou_wechat/mongoDB.py
2,862
Python
# -*- coding: utf-8 -*- # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code from ccxt.base.exchange import Exchange from ccxt.base.errors import ExchangeError from ccxt.base.errors import AuthenticationError from cc...
39.967262
220
0.454315
[ "MIT" ]
AsquaredXIV/ccxt
python/ccxt/bitso.py
40,287
Python
# list all object store access policies res = client.get_object_store_access_policies() print(res) if type(res) == pypureclient.responses.ValidResponse: print(list(res.items)) # Valid fields: continuation_token, filter, ids, limit, names, offset, sort # See section "Common Fields" for examples
37.375
75
0.77592
[ "BSD-2-Clause" ]
Flav-STOR-WL/py-pure-client
docs/source/examples/FB2.0/get_object_store_access_policies.py
299
Python
import logging import urllib.parse from typing import Any, Dict, Optional, Type, Union from globus_sdk import config, exc, utils from globus_sdk.authorizers import GlobusAuthorizer from globus_sdk.paging import PaginatorTable from globus_sdk.response import GlobusHTTPResponse from globus_sdk.scopes import ScopeBuilder...
36.133779
87
0.623195
[ "ECL-2.0", "Apache-2.0" ]
rudyardrichter/globus-sdk-python
src/globus_sdk/client.py
10,804
Python
#!/Users/drpaneas/Virtualenvs/linuxed/bin/python2.7 # $Id: rst2pseudoxml.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ A minimal front end to the Docutils Publisher, producing pseudo-XML. """ try: import loca...
26.416667
73
0.744479
[ "MIT" ]
drpaneas/linuxed.gr
bin/rst2pseudoxml.py
634
Python
from django.urls import re_path from ..views import OptionsExportView, OptionsView urlpatterns = [ re_path(r'^$', OptionsView.as_view(), name='options'), re_path(r'^export/(?P<format>[a-z]+)/$', OptionsExportView.as_view(), name='options_export'), ]
28.888889
97
0.703846
[ "Apache-2.0" ]
GeoinformationSystems/rdmo
rdmo/options/urls/__init__.py
260
Python
"""Identifiers for objects in Robustness Gym.""" from __future__ import annotations import ast import json from typing import Any, Callable, List, Union # from robustnessgym.core.tools import persistent_hash class Identifier: """Class for creating identifiers for objects in Robustness Gym.""" def __init__(...
30.25
84
0.559229
[ "Apache-2.0" ]
ANarayan/robustness-gym
robustnessgym/core/identifier.py
4,719
Python
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RAbind(RPackage): """ Combine Multidimensional Arrays. Combine multidimensional a...
35.333333
95
0.742925
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
FJ-NaokiMatsumura/spack
var/spack/repos/builtin/packages/r-abind/package.py
848
Python
import numpy as np import torch def get_sinusoid_encoding_table(n_position, d_hid, padding_idx=None): ''' Sinusoid position encoding table ''' def cal_angle(position, hid_idx): return position / np.power(10000, 2 * (hid_idx // 2) / d_hid) def get_posi_angle_vec(position): return [cal_ang...
33.391304
89
0.684896
[ "MIT" ]
MrSchnappi/RL-for-Question-Generation
src/onqg/utils/sinusoid.py
768
Python
from unittest import TestCase class TestNumbers2Words(TestCase): from numbers2words import numbers2words # 1-10 def test_one(self): self.assertEqual(numbers2words(1), "one") def test_two(self): self.assertEqual(numbers2words(2), "two") def test_three(self): self.assertEqual(numbers2words(3), ...
23.214286
52
0.710154
[ "MIT" ]
gnuchu/n2w
tests/test_n2w.py
1,625
Python
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
41.699588
88
0.673937
[ "Apache-2.0" ]
Anku5hk/models
official/vision/image_classification/common.py
20,266
Python
import collections import itertools from trie_class import Trie import sys import timeit def load_dataset(filename): dataset = [sorted(int(n) for n in i.strip().split()) for i in open(filename).readlines()] size = len(dataset) print('Size of the Dataset : ', size) total_len = 0 ...
25.871795
111
0.588206
[ "MIT" ]
saif-mahmud/Data-Mining-Lab
Frequent Pattern Mining/apriori.py
4,036
Python
"""Spamming Module {i}spam <no of msgs> <msg> Note:- Don't use to much""" # Copyright (C) 2019 The Raphielscape Company LLC. # # Licensed under the Raphielscape Public License, Version 1.b (the "License"); # you may not use this file except in compliance with the License. # from asyncio import wait fr...
25.527778
79
0.557127
[ "Apache-2.0" ]
xditya/PikaBotPlugins
plugins/spam.py
919
Python
# stdlib import json from typing import List from typing import NoReturn from typing import Optional # third party from fastapi import APIRouter from fastapi import Depends from fastapi import File from fastapi import Form from fastapi import UploadFile from loguru import logger from starlette import status from starl...
28.069182
88
0.725745
[ "Apache-2.0" ]
BearerPipelineTest/PySyft
packages/grid/backend/grid/api/users/routes.py
4,463
Python
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
33.630769
84
0.674291
[ "Apache-2.0" ]
2d4d/yara_scanner
docs/source/conf.py
2,190
Python
import json import os import numpy as np import tensorflow.compat.v1 as tf import argparse from tqdm import tqdm import model from encode_bpe import BPEEncoder_ja if int(tf.__version__[0]) > 1: from model import HParams as HParams else: from tensorflow.contrib.training import HParams parser = argparse.Argumen...
26.949367
84
0.648661
[ "MIT" ]
july-language/gpt2-japanese
gpt2-transform.py
2,129
Python
from pathlib import Path from datetime import datetime, timedelta from src.settings import envs from airflow import DAG from airflow.models import Variable from airflow.operators.python_operator import PythonOperator from airflow.utils.dates import days_ago from airflow.hooks.postgres_hook import PostgresHook import lo...
36.052632
114
0.685766
[ "Apache-2.0" ]
Mahe1980/btb
src/airflow_dags/dags/btb/house_keeping.py
2,740
Python
from abc import ABC from asyncio import Lock as AsyncLock from collections import ChainMap, OrderedDict from dataclasses import dataclass, field from datetime import timedelta from functools import partial, wraps from hashlib import sha256 import inspect from pathlib import Path import pickle from sqlite3 import connec...
33.545455
114
0.564393
[ "MIT" ]
cevans87/atools
atools/_memoize_decorator.py
25,461
Python
import os import math import logging from pyaxe import config as config_util from pyaxe.axeerror import aXeError # make sure there is a logger _log = logging.getLogger(__name__) class ConfigList: """Configuration File Object""" def __init__(self, keylist, header=None): """ Initializes the Con...
29.098618
79
0.548343
[ "BSD-3-Clause" ]
sosey/pyaxe
pyaxe/axesrc/configfile.py
46,325
Python
# from imports import * # import random # class Docs(commands.Cog): # def __init__(self, bot): # self.bot = bot # self.bot.loop.create_task(self.__ainit__()) # async def __ainit__(self): # await self.bot.wait_until_ready() # self.scraper = AsyncScraper(session = self.bot.session) # async def r...
30.082192
112
0.651184
[ "MIT" ]
BenitzCoding/Utility-Bot
cogs/docs.py
2,196
Python
import typer from typing import Optional from article_ripper import get_document, html_to_md app = typer.Typer() @app.command() def fun(url: str, out: Optional[str] = None) -> None: doc = get_document(url) doc_summary = doc.summary() if out is None: print(doc_summary) else: with open(...
17.56
53
0.624146
[ "MIT" ]
nozwock/article-ripper
src/article_ripper/cli.py
439
Python
from django.conf.urls import url, include import binder.router # noqa import binder.websocket # noqa import binder.views # noqa import binder.history # noqa import binder.models # noqa import binder.plugins.token_auth.views # noqa from binder.plugins.views.multi_request import multi_request_view from .views import ani...
38.04
87
0.768665
[ "MIT" ]
BBooijLiewes/django-binder
tests/testapp/urls.py
951
Python
from .brand import BrandDataset, Brand from .vehicle_id import VehicleIDDataset from .comp_cars import CompCarsDataset # from .veri import VeriDataset from .box_cars import BoxCars116kDataset # from .vric import VRICDataset from .cars196 import Cars196Dataset
37
40
0.84556
[ "MIT" ]
piyengar/vehicle-predictor
experiments/brand/dataset/__init__.py
259
Python
"""Certbot constants.""" import os import logging from acme import challenges SETUPTOOLS_PLUGINS_ENTRY_POINT = "certbot.plugins" """Setuptools entry point group name for plugins.""" OLD_SETUPTOOLS_PLUGINS_ENTRY_POINT = "letsencrypt.plugins" """Plugins Setuptools entry point before rename.""" CLI_DEFAULTS = dict( ...
29.594828
79
0.718905
[ "Apache-2.0" ]
Randagio13/certbot
certbot/constants.py
3,433
Python
# Copyright 2021 Canonical Ltd. # See LICENSE file for licensing details. from pathlib import Path from subprocess import check_output from time import sleep import pytest import yaml from selenium import webdriver from selenium.common.exceptions import JavascriptException, WebDriverException from selenium.webdriver....
31.357576
89
0.63993
[ "Apache-2.0" ]
VariableDeclared/kubeflow-dashboard-operator
tests/integration/test_charm.py
5,177
Python
# Copyright (c) 2017 Sofia Ira Ktena <ira.ktena@imperial.ac.uk> # # 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, ...
32.241379
115
0.648217
[ "MIT" ]
HoganZhang/gcn_metric_learning
lib/abide_utils.py
11,220
Python
from typing import List import numpy as np def mask_nan(arrays: List[np.ndarray]) -> List[np.ndarray]: """ Drop indices from equal-sized arrays if the element at that index is NaN in any of the input arrays. Parameters ---------- arrays : List[np.ndarray] list of ndarrays containing ...
27.128205
79
0.581285
[ "MIT" ]
jbburt/jburt
jburt/mask.py
1,058
Python
# Copyright 2016 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
34.432432
79
0.609733
[ "Apache-2.0" ]
giangpvit/googledrivepythonsample
test/lib/oauth2client/_pure_python_crypt.py
6,370
Python
def findDecision(obj): #obj[0]: Passanger, obj[1]: Coupon, obj[2]: Education, obj[3]: Occupation, obj[4]: Restaurant20to50, obj[5]: Distance # {"feature": "Passanger", "instances": 34, "metric_value": 0.9774, "depth": 1} if obj[0]<=1: # {"feature": "Restaurant20to50", "instances": 22, "metric_value": 0.7732, "depth...
34.508197
140
0.564371
[ "MIT" ]
apcarrik/kaggle
duke-cs671-fall21-coupon-recommendation/outputs/rules/RF/6_features/numtrees_30/rule_0.py
2,105
Python
import AnalysisModule as Ass import GraphFunctions as Gfs import yfinance as yf import DatabaseStocks as Ds listOfStocksToAnalyze = Ds.get_lists() macdproposedbuylist = [] macdproposedselllist = [] proposedbuylist = [] proposedselllist = [] for stock in listOfStocksToAnalyze: # print(stock) StockData = yf.Ti...
31.75
78
0.724409
[ "MIT" ]
VaseSimion/Finance
workfile.py
1,651
Python
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from yolov2_ros.srv import * import rospy from copy import deepcopy from core import YOLO from vision_msgs.msg import Detection2DArray, Detection2D, BoundingBox2D, ObjectHypothe...
37.853448
175
0.59918
[ "BSD-3-Clause" ]
diggerdata/yolov2_ros
scripts/yolo_server.py
4,391
Python
from . import IGGrid def get(): return IGGrid.IGGrid()
10.166667
26
0.655738
[ "MIT" ]
bertrandboudaud/imagegraph
nodes/IGGrid/__init__.py
61
Python
from django.urls import path, include from . import views app_name = 'test_app' urlpatterns = [ path('', views.index, name='index'), ]
17.5
40
0.685714
[ "MIT" ]
nosu23/docker-gunicorn-django-example
gunicorn/src/test_app/urls.py
140
Python
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Copyright (c) 2017 The Raven Core developers # Copyright (c) 2018 The Rito Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test compact bl...
47.108253
137
0.668912
[ "MIT" ]
RitoProject/Ravencoin
test/functional/p2p_compactblocks.py
43,952
Python
import logging import io from homeassistant.core import callback from homeassistant.components.ais_dom import ais_global from homeassistant.const import EVENT_HOMEASSISTANT_START from homeassistant.components.camera import Camera from homeassistant.helpers.event import async_track_state_change from datetime import time...
27.168421
87
0.655172
[ "Apache-2.0" ]
DRubioBizcaino/AIS-home-assistant
homeassistant/components/ais_qrcode/camera.py
2,581
Python
from datetime import date, timedelta from app import create_app, new_functions as nf from app.constants import weekend_answer from app.models import User from tg_bot import bot def schedule_sender(): send_cnt, err_cnt = 0, 0 for user in User.query.filter_by(is_subscribed=True).all(): answer = user.c...
29.514286
64
0.573088
[ "Apache-2.0" ]
EeOneDown/spbu4u
tg_schedule_sender.py
1,051
Python
from collections import defaultdict dd = defaultdict(list) n, m = map(int, input().split()) groupA = [] for i in range(n): a_element = input() dd[a_element].append(str(i+1)) for _ in range(m): b_element = input() if b_element not in dd: print(-1) else: print(" ".join(dd[b_element...
18
38
0.601852
[ "MIT" ]
rawat9/HackerRank
Python/Collections/DefaultDict Tutorial/solution.py
324
Python
#!/usr/bin/env python from setuptools import setup with open('README.md') as f: long_description = f.read() setup(name="pipelinewise-target-s3-csv", version="1.4.0", description="Singer.io target for writing CSV files and upload to S3 - PipelineWise compatible", long_description=long_descriptio...
28.769231
102
0.583779
[ "Apache-2.0" ]
EasyPost/pipelinewise-target-s3-csv
setup.py
1,122
Python
from datetime import datetime import logging import os import subprocess import sys from argparse import Namespace logging.getLogger("transformers").setLevel(logging.WARNING) import click import torch from luke.utils.model_utils import ModelArchive from zero.utils.experiment_logger import commet_logger_args, CometL...
35.307692
106
0.663762
[ "MIT" ]
nguyenvanhoang7398/nndl2-project
zero/cli.py
4,131
Python
count=0 n=4 for i in range(1,n+1): for j in range(1,n+1): if i==j: continue for k in range(1,n+1): if i==k or j==k: continue count += 1 print(f"第{count}种方案:甲担任{i}号课代表,乙担任{j}号课代表,丙担任{k}号课代表") print(f"一共{count}种方案")
22.923077
66
0.466443
[ "MIT" ]
royqh1979/programming_with_python
Chap02Loops/5-4.无重复组合.py
364
Python