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 aiohttp, asyncio
from bs4 import BeautifulSoup
import json
import time
VC_SEARCH = "https://vc.ru/search/v2/content/new"
async def parse_urls(key_word):
async with aiohttp.ClientSession() as session:
async with session.get(VC_SEARCH, params={
"query": key_word,
"target_type... | 31.52 | 113 | 0.636421 | [
"MIT"
] | OverFitted/hacksai2021spb | Parsers/vcru.py | 1,580 | Python |
#!/usr/bin/env runaiida
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
__copyright__ = (u"Copyright (c), 2016, Forschungszentrum Jülich GmbH, "
"IAS-1/PGI-1, Germany. All rights reserved.")
__license__ = "MIT license, see LICENSE.txt file"
__versio... | 30.25974 | 97 | 0.650644 | [
"MIT"
] | anoopkcn/aiida-fleur | examples/old_workflowtests/test_run_scf2.py | 2,331 | Python |
"""
Copyright (c) 2008-2020, Jesus Cea Avion <jcea@jcea.es>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of... | 36.979798 | 79 | 0.642721 | [
"BSD-3-Clause"
] | OnApp/cdn-bsddb3-python | Lib3/bsddb/test/test_db.py | 7,322 | Python |
from dataclasses import dataclass, field
from datetime import datetime # for typehinting
from typing import TYPE_CHECKING, Generator, List, Literal, Optional
import aiohttp
import dateparser
from .exceptions import UnsupportedRegionError
from .pricing import PriceQuery, query_price
COUNT = 30 # Items per page of ... | 32.816176 | 115 | 0.636791 | [
"MIT"
] | MattBSG/Switch-REST | nsecpy/listing.py | 4,463 | Python |
from collections import defaultdict
from typing import Dict, Tuple, Iterator, Callable, Any, Optional
from dataclasses import dataclass
"""
Provides the `TaggedProfiler` class related to record profiling.
TODO: Better description needed.
"""
@dataclass
class TaggedProfilerRecordStatus:
offset: int
tag: str
... | 37.697368 | 126 | 0.614311 | [
"Apache-2.0"
] | wstlabs/caixa | caixa/profile/tagged.py | 2,865 | Python |
import torch;
import numpy as np;
from torch import nn;
from torch import optim;
import torch.functional as func;
from torchvision import datasets, transforms, models;
import time;
from os import path;
import argparse;
import utils
import json;
def main(test_image_path, checkpoint_path, top_k, category_names, gpu):
... | 41.188679 | 170 | 0.696748 | [
"MIT"
] | ravishchawla/Udacity-Data-Scientist-nd | image_classifier/predict.py | 2,183 | Python |
import collections
class CaseInsensitiveDict(collections.MutableMapping):
"""
A case-insensitive ``dict``-like object.
Implements all methods and operations of
``collections.MutableMapping`` as well as dict's ``copy``. Also
provides ``lower_items``.
All keys are expected to be strings. The s... | 31.155844 | 75 | 0.620675 | [
"BSD-2-Clause"
] | jespino/anillo | anillo/utils/structures.py | 2,399 | Python |
# -*- coding: utf-8 -*-
# This is a simple mailbox polling script for the Sahana Messaging Module
# If there is a need to collect from non-compliant mailers then suggest using the robust Fetchmail to collect & store in a more compliant mailer!
# This script doesn't handle MIME attachments
import sys, socket, email, ... | 37.333333 | 145 | 0.589973 | [
"MIT"
] | dotskapes/dotSkapes | cron/email_receive.py | 5,826 | Python |
"""
Module to wrap an integer in bitwise flag/field accessors.
"""
from collections import OrderedDict
from pcapng.ngsix import namedtuple, Iterable
class FlagBase(object):
"""\
Base class for flag types to be used in a Flags object.
Handles the bitwise math so subclasses don't have to worry about it.
... | 30.746341 | 185 | 0.5802 | [
"Apache-2.0"
] | Boolean263/python-pcapng | pcapng/flags.py | 6,303 | Python |
import os
CUR_DIR = os.path.dirname(os.path.realpath(__file__))
PARENT_DIR = os.path.abspath(os.path.join(CUR_DIR, os.pardir))
DATA_DIR = os.path.join(PARENT_DIR, "input")
IMAGE_DIR = os.path.join(DATA_DIR, "image")
def predict_label(json_data, filename):
print(json_data)
drivename, fname = filename.split("/")
fna... | 32.826923 | 112 | 0.718219 | [
"Apache-2.0"
] | hasanari/sane | app/predict_label.py | 1,707 | Python |
from ows_refactored.common.ows_reslim_cfg import reslim_landsat
bands_ls5_st = {
"ST_B6": ["st"],
"ST_QA": ["st_qa"],
"QA_PIXEL": ["pq"]
}
bands_ls7_st = {
"ST_B6": ["st"],
"ST_QA": ["st_qa"],
"QA_PIXEL": ["pq"]
}
bands_ls8_st = {
"ST_B10": ["st"],
"ST_QA": ["st_qa"],
"QA_PIXEL": ["... | 40.075188 | 390 | 0.621764 | [
"Apache-2.0"
] | FlexiGroBots-H2020/config | services/ows_refactored/surface_temperature/ows_lsc2_st_cfg.py | 10,666 | Python |
"""
Unit tests for nltk.tokenize.
See also nltk/test/tokenize.doctest
"""
import pytest
from nltk.tokenize import (
punkt,
word_tokenize,
TweetTokenizer,
StanfordSegmenter,
TreebankWordTokenizer,
SyllableTokenizer,
LegalitySyllableTokenizer,
)
def setup_module(module):
import pytest
... | 31.773784 | 348 | 0.467363 | [
"Apache-2.0"
] | Geolem/nltk | nltk/test/unit/test_tokenize.py | 17,387 | Python |
from kafka import KafkaConsumer
KAFKA_SERVER_URL = 'localhost:9092'
LOGIN = "bob"
PWD = "bob-secret"
TOPIC = "test-topic"
GROUP_ID = 'bob-group'
consumer = KafkaConsumer(TOPIC, group_id=GROUP_ID, bootstrap_servers=KAFKA_SERVER_URL,
security_protocol="SASL_PLAINTEXT",
... | 28.866667 | 100 | 0.69746 | [
"Apache-2.0"
] | pengfei99/KafkaPyClient | kafka-python/ConsumerAuth.py | 433 | Python |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch
from detr.models.backbone import Backbone, Joiner
from detr.models.detr import DETR, PostProcess
from detr.models.position_encoding import PositionEmbeddingSine
from detr.models.segmentation import DETRsegm, PostProcessPanoptic
from de... | 37.218935 | 117 | 0.71097 | [
"Apache-2.0"
] | justinkay/detr | detr/hubconf.py | 6,290 | Python |
"""
'storage-add ' sub command
"""
#To prevent Py2 to interpreting print(val) as a tuple.
from __future__ import print_function
import os
import tempfile
import sys
import json
import utils
from storage_yaml import to_storage_yaml
# noqa # pylint: disable=too-many-branches
def set_args(name, subparsers):
""" a... | 29.315985 | 96 | 0.547172 | [
"Apache-2.0"
] | Joibel/kadalu | cli/kubectl_kadalu/storage_add.py | 7,886 | Python |
from sun.geometry import Location, SunPath
from date_time import Date
loc = Location(
name='Ghent',
region='Belgium',
latitude=51.07,
longitude=3.69,
timezone='Europe/Brussels',
altitude=9.0
)
date = Date(year=2019, month=7, day=29)
sp = SunPath(loc, date)
sp.print_table()
| 19.933333 | 42 | 0.682274 | [
"MIT"
] | TomLXXVI/pypv | pypv/scripts/sun_path.py | 299 | Python |
# Copyright 2018-2020 Xanadu Quantum Technologies Inc.
# 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.822235 | 122 | 0.603598 | [
"Apache-2.0"
] | DanielPolatajko/pennylane | pennylane/operation.py | 61,709 | Python |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import phylogeny
def main(argv):
lines = files.read_lines(argv[0])
taxa = lines[0].split()
table = lines[1:]
print '\n'.join('{%s, %s} {%s, %s}' % (a1, a2, b1, b2) for ((a1, a2), (b1, b2)) in phyl... | 21.105263 | 119 | 0.610973 | [
"MIT"
] | cowboysmall-comp/rosalind | src/stronghold/rosalind_qrt.py | 401 | Python |
from __future__ import absolute_import, print_function
from django.conf import settings
CLIENT_ID = getattr(settings, "GITHUB_APP_ID", None)
CLIENT_SECRET = getattr(settings, "GITHUB_API_SECRET", None)
REQUIRE_VERIFIED_EMAIL = getattr(settings, "GITHUB_REQUIRE_VERIFIED_EMAIL", False)
ERR_NO_ORG_ACCESS = "You do no... | 37.289474 | 141 | 0.791814 | [
"BSD-3-Clause"
] | vaniot-s/sentry | src/sentry/auth/providers/github/constants.py | 1,417 | Python |
from OpenGL.GL import *
from .. GLGraphicsItem import GLGraphicsItem
from .. MeshData import MeshData
from pyqtgraph.Qt import QtGui
import pyqtgraph as pg
from .. import shaders
import numpy as np
__all__ = ['GLMeshItem']
class GLMeshItem(GLGraphicsItem):
"""
**Bases:** :class:`GLGraphicsItem <pyqtgraph.op... | 28.78481 | 87 | 0.559367 | [
"MIT"
] | robertsj/poropy | pyqtgraph/opengl/items/GLMeshItem.py | 2,274 | Python |
import os, sys
try:
import MacOS
except:
MacOS = None
from pygame.pkgdata import getResource
from pygame import sdlmain_osx
__all__ = ['Video_AutoInit']
def Video_AutoInit():
"""This is a function that's called from the c extension code
just before the display module is initialized"""
if Mac... | 30.03125 | 115 | 0.676379 | [
"MIT"
] | AdamaTraore75020/PYBomber | venv/Lib/site-packages/pygame/macosx.py | 961 | Python |
import sys
from pathlib import Path, PurePath
sys.path.append("./models/research/object_detection/")
sys.path.append("./models/research/")
import os
import cv2
import numpy as np
import tensorflow as tf
from utils import label_map_util
from utils import visualization_utils as vis_util
from image_to_video_co... | 47.212766 | 131 | 0.609283 | [
"Unlicense"
] | s-nandi/carla-car-detection | detection.py | 8,876 | Python |
#!/usr/bin/env python
#
# mri_convert_ppc64 ds ChRIS plugin app
#
# (c) 2016-2019 Fetal-Neonatal Neuroimaging & Developmental Science Center
# Boston Children's Hospital
#
# http://childrenshospital.org/FNNDSC/
# dev@babyM... | 39.677273 | 108 | 0.414251 | [
"MIT"
] | quinnyyy/pl-mri_convert_ppc64 | mri_convert_ppc64/mri_convert_ppc64.py | 8,729 | Python |
from typing import Tuple, FrozenSet
from collections import Iterable
from mathsat import msat_term, msat_env
from mathsat import msat_make_constant, msat_declare_function
from mathsat import msat_get_integer_type, msat_get_rational_type, msat_get_bool_type
from mathsat import msat_make_and, msat_make_not, msat_mak... | 35.9375 | 89 | 0.628406 | [
"MIT"
] | EnricoMagnago/F3 | benchmarks/f3_wrong_hints_permutations/scaling_ltl_infinite_state/12-extending_bound_39.py | 8,625 | Python |
import json
import os.path
tags = {
'1.0': '1__0__3',
'1.1': '1__1__4',
}
schema_url = 'https://standard.open-contracting.org/schema/{}/release-schema.json'
def path(filename):
return os.path.join('tests', 'fixtures', filename)
def read(filename, mode='rt', encoding=None, **kwargs):
with open(path... | 20.478261 | 82 | 0.647558 | [
"BSD-3-Clause"
] | open-contracting/ocds-merge | tests/__init__.py | 471 | Python |
import numpy as np
from gym import utils
from gym_env_mujoco150 import mujoco_env
import mujoco_py
class Walker2dEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
mujoco_env.MujocoEnv.__init__(self, "walker2d_150.xml", 4)
utils.EzPickle.__init__(self)
def _step(self, a):
... | 34.837209 | 94 | 0.615487 | [
"MIT"
] | pfnet/gym-env-mujoco150 | gym_env_mujoco150/walker2d.py | 1,498 | Python |
# MIT License
# Copyright (c) 2018 the NJUNMT-pytorch authors.
# 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, m... | 34.516827 | 120 | 0.566683 | [
"MIT"
] | skysky77/MGNMT | src/tasks/lm.py | 28,718 | Python |
import click
from . import __version__
from .cli_commands import create_cluster, upload, upload_and_update
from .configure import configure
def print_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.echo('Version {}'.format(__version__))
ctx.exit()
@click.group()
... | 21.923077 | 70 | 0.738596 | [
"BSD-3-Clause"
] | ShopRunner/apparate | stork/cli.py | 570 | Python |
"""Class definition of the ZoneSpeaker."""
import bisect
import functools
from typing import Any, Callable, List, Tuple
import simulation_groundtruth.srv as groundtruth_srv
from simulation_evaluation.msg import Speaker as SpeakerMsg
from simulation_groundtruth.msg import LabeledPolygon as LabeledPolygonMsg
from simul... | 38.588679 | 92 | 0.612263 | [
"MIT"
] | KITcar-Team/kitcar-gazebo-simulation | simulation/src/simulation_evaluation/src/speaker/speakers/zone.py | 10,226 | Python |
import argparse
import xml.etree.cElementTree as etree
import os
from os import listdir
from os.path import isfile, join
import random
def processMedlineFolder(medlineFolder,outFolder):
"""Basic function that iterates through abstracts in a medline file, do a basic word count and save to a file
Args:
medlineFolde... | 31.273973 | 150 | 0.711345 | [
"MIT"
] | NCBI-Hackathons/Autoupdating_PubMed_Corpus_for_NLP | server/tools/CountWordsError/0.1/CountWordsError.py | 2,283 | Python |
from app01.apis.geng import bp as geng_bp
from app01.apis.end1.view_end1 import bp as end1_bp
routers = [
geng_bp,
end1_bp,
]
| 16.875 | 51 | 0.725926 | [
"MIT"
] | pscly/myend | app01/route.py | 135 | Python |
import json
import yaml
"""
SMock -- Serverboards Mock library -- Mock comfortably.
This library helps to mock function and method calls, getting the data
from an external yaml file.
"""
class MockWrapper:
"""
Wraps all the data returned by the mocked function to behave like a
dictionary, like an object... | 25.497942 | 102 | 0.576017 | [
"Apache-2.0"
] | serverboards/serverboards-plugin-google-drive | smock.py | 6,196 | Python |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 14 13:27:33 2020
@author: Jin Dou
"""
import torch
def buildDataLoader(*tensors,TorchDataSetType,oSamplerType=None,**Args):
if(Args.get('DatasetArgs') != None):
DataSetArgs = Args['DatasetArgs']
dataset = TorchDataSetType(*tensors,**DataSe... | 35.052632 | 105 | 0.53003 | [
"MIT"
] | powerfulbean/StellarBrainwav | StimRespFlow/DataProcessing/DeepLearning/Factory.py | 3,996 | Python |
"""
scaffoldgraph tests.core.test_fragment
"""
import pytest
from rdkit import Chem
from scaffoldgraph.core.fragment import *
@pytest.fixture(name='mol')
def test_molecule():
smiles = 'CCN1CCc2c(C1)sc(NC(=O)Nc3ccc(Cl)cc3)c2C#N'
return Chem.MolFromSmiles(smiles)
def canon(smiles):
"""Canonicalize SMILE... | 31.446154 | 104 | 0.719667 | [
"MIT"
] | trumanw/ScaffoldGraph | tests/core/test_fragment.py | 2,044 | 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
# d... | 52.20156 | 79 | 0.670254 | [
"Apache-2.0"
] | Boye-Z/cinder | cinder/tests/unit/volume/drivers/test_kioxia.py | 40,143 | Python |
# Generated by Django 3.1 on 2020-09-28 07:06
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('base', '0065_bugtracker'),
]
operations = [
migrations.RenameField(
model_name='bugtracker',
... | 30.742857 | 184 | 0.578996 | [
"MIT"
] | gade-raghav/project-enhancements | base/migrations/0066_auto_20200928_0706.py | 1,076 | Python |
"""Top-level package for pomdp-belief-tracking."""
__author__ = """sammie katt"""
__email__ = "sammie.katt@gmail.com"
__version__ = "0.1.0"
from pomdp_belief_tracking import pf
| 22.375 | 50 | 0.731844 | [
"MIT"
] | kevslinger/pomdp-belief-tracking | pomdp_belief_tracking/__init__.py | 179 | Python |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | 38.086705 | 96 | 0.670815 | [
"Apache-2.0"
] | ejfitzgerald/agents-aea | packages/fetchai/skills/generic_seller/behaviours.py | 6,589 | Python |
"""Convert MUSDB18 dataset to .wav format.
Output .wav files contain 5 channels
- `0` - The mixture,
- `1` - The drums,
- `2` - The bass,
- `3` - The rest of the accompaniment,
- `4` - The vocals.
"""
import argparse
import os
import subprocess
import tempfile
import librosa
import numpy as np
import soundfile as sf
... | 35.202899 | 78 | 0.558666 | [
"MIT"
] | mori97/U-Net_MUSDB18 | src/convert_to_wav.py | 2,429 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# RobotPy WPILib documentation build configuration file, created by
# sphinx-quickstart on Sun Nov 2 21:31:04 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in th... | 28.079602 | 98 | 0.644401 | [
"Apache-2.0"
] | KenwoodFox/robotpy-docs | conf.py | 5,644 | Python |
# Space: O(n)
# Time: O(n!)
class CombinationIterator:
def __init__(self, characters: str, combinationLength: int):
self.data = characters
self.res = self.combine(self.data, combinationLength)
self.counter = 0
self.res_count = len(self.res)
def next(self) -> str:
if ... | 23.619048 | 64 | 0.529234 | [
"MIT"
] | lht19900714/Leetcode_Python | Algorithms/1286_Iterator_for_Combination/Python/Iterator_for_Combination_Solution_1.py | 992 | Python |
# Copyright (c) 2018 by contributors. 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... | 37.285714 | 92 | 0.708265 | [
"Apache-2.0"
] | ccgcyber/xlearn | python-package/setup.py | 1,827 | Python |
# Copyright (c) 2015 Brian Haskin Jr.
#
# 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, merge, publish, di... | 33.213058 | 87 | 0.58148 | [
"MIT"
] | TFiFiE/AEI | pyrimaa/tests/test_aei.py | 9,665 | Python |
#!/usr/bin/env python
import numpy as np
import datetime as dt
import sys, os, pickle, time
from keras.models import Model, save_model, load_model
from keras.regularizers import l2
from keras.optimizers import SGD, Adam
import keras.backend as K
import tensorflow as tf
import pandas as pd
import innvestigate
import in... | 31.8 | 157 | 0.737421 | [
"MIT"
] | ahijevyc/NSC_objects | neural_network_lrp.py | 2,544 | Python |
#!/usr/bin/env python3
import torch
import torch.optim as optim
import os, sys
import warnings
import numpy as np
current_path = os.path.dirname(os.path.realpath(__file__))
PROJECT_HOME = os.path.abspath(os.path.join(current_path, os.pardir, os.pardir, os.pardir, os.pardir))
if PROJECT_HOME not in sys.path:
sys.p... | 38.650633 | 135 | 0.658807 | [
"MIT"
] | linklab/link_rl | codes/f_main/trade_main/upbit_trade_main.py | 15,267 | Python |
import os
import warnings
warnings.filterwarnings("ignore")
shared_params = ('python CPT_STMeta_Simplify_Obj.py '
'--Dataset ChargeStation '
'--CT 6 '
'--PT 7 '
'--TT 4 '
'--GLL 1 '
'--LSTMUnits 64 '
... | 33.447368 | 107 | 0.415421 | [
"MIT"
] | GRE-EXAMINATION/UCTB | Experiments/StabilityTest/Master_CS_0.py | 1,321 | Python |
# pylint: disable=redefined-outer-name
import asyncio
import time
import pytest
DEFAULT_MAX_LATENCY = 10 * 1000
@pytest.mark.asyncio
async def test_slow_server(host):
if not pytest.enable_microbatch:
pytest.skip()
A, B = 0.2, 1
data = '{"a": %s, "b": %s}' % (A, B)
time_start = time.time()... | 23.837838 | 60 | 0.544785 | [
"Apache-2.0"
] | 418sec/BentoML | tests/integration/api_server/test_microbatch.py | 1,764 | Python |
import os
import numpy as np
from scipy.stats import multivariate_normal
import inspect
from sklearn.metrics.pairwise import pairwise_distances
def sample(transition_matrix, means, covs, start_state, n_samples,
random_state):
n_states, n_features, _ = covs.shape
states = np.zeros(n_samples, dtype='... | 33.897959 | 80 | 0.606562 | [
"BSD-3-Clause"
] | VGligorijevic/deepblast | deepblast/utils.py | 3,322 | Python |
from transformers import RobertaConfig
from modeling.hf_head.modeling_roberta_parsing import RobertaForGraphPrediction
from modeling.sequence_labeling import SequenceLabeling
if __name__ == '__main__':
config = RobertaConfig(graph_head_hidden_size_mlp_arc=100, graph_head_hidden_size_mlp_rel=100, dropout_classifi... | 31.5 | 122 | 0.77619 | [
"Apache-2.0"
] | benjamin-mlr/lightning-language-modeling | parser.py | 630 | Python |
"""
Defines useful extended internal coordinate frames
"""
import numpy as np
import McUtils.Numputils as nput
from McUtils.Coordinerds import (
ZMatrixCoordinateSystem, CartesianCoordinateSystem, CoordinateSystemConverter,
ZMatrixCoordinates, CartesianCoordinates3D, CoordinateSet, CoordinateSystemConverters... | 38.200972 | 139 | 0.530208 | [
"MIT"
] | McCoyGroup/Coordinerds | Psience/Molecools/CoordinateSystems.py | 23,570 | Python |
# mypy: allow-untyped-defs
import os.path
from unittest.mock import patch
from tools.manifest.manifest import Manifest
from tools.wpt import testfiles
def test_getrevish_kwarg():
assert testfiles.get_revish(revish="abcdef") == "abcdef"
assert testfiles.get_revish(revish="123456\n") == "123456"
def test_ge... | 33.666667 | 94 | 0.60396 | [
"BSD-3-Clause"
] | BasixKOR/wpt | tools/wpt/tests/test_testfiles.py | 2,424 | Python |
#!/usr/bin/env python
"""
_Exists_
Oracle implementation of JobGroup.Exists
"""
__all__ = []
from WMCore.WMBS.MySQL.JobGroup.Exists import Exists as ExistsJobGroupMySQL
class Exists(ExistsJobGroupMySQL):
pass
| 13.6875 | 75 | 0.757991 | [
"Apache-2.0"
] | JAmadoTest/WMCore | src/python/WMCore/WMBS/Oracle/JobGroup/Exists.py | 219 | Python |
from unittest import TestCase
from src.adders import HalfAdder, FullAdder, FourBitFullAdder
from tests.utils import decimal_to_boolean_list
class HalfAdderTests(TestCase):
TRUTH_TABLE = (
# A B S Cout
((False, False), (False, False)),
((False, True), (True, False)),
... | 35.121951 | 118 | 0.557292 | [
"MIT"
] | fgarci03/pylectronics | tests/test_adders.py | 2,880 | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from scrapy.spiders import Spider
from scrapy.spiders import Request
import json
from hexun.items import HexunItem
from utils.urlUtils import UrlUtils
from utils.dateTimeUtils import DateTimeUtils
class PPSpider(Spider):
name = 'pp'
urlTemplate = 'http://webftcn.herme... | 35.093023 | 113 | 0.644135 | [
"MIT"
] | judypol/pytonStudy | hexun/hexun/spiders/ppSpider.py | 1,509 | Python |
# Standard Library
import copy
import json
import re
from .log_helper import default_logger as logger
def format_cfg(cfg):
"""Format experiment config for friendly display"""
# json_str = json.dumps(cfg, indent=2, ensure_ascii=False)
# return json_str
def list2str(cfg):
for key, value in cfg... | 30.901961 | 112 | 0.510152 | [
"Apache-2.0"
] | ModelTC/EOD | up/utils/general/cfg_helper.py | 3,152 | Python |
# Copyright 2020 StreamSets Inc.
#
# 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 writi... | 33.884615 | 109 | 0.72115 | [
"Apache-2.0"
] | anubandhan/datacollector-tests | pipeline/test_metrics.py | 2,643 | Python |
#!/usr/bin/env python
#
# This program shows how to use MPI_Alltoall. Each processor
# send/rec a different random number to/from other processors.
#
# numpy is required
import numpy
from numpy import *
# mpi4py module
from mpi4py import MPI
import sys
def myquit(mes):
MPI.Finalize()
print(mes)
... | 20.453125 | 63 | 0.675325 | [
"Unlicense"
] | timkphd/examples | array/bot/others/P_ex07.py | 1,309 | Python |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2016 Twitter. 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... | 37.759197 | 100 | 0.692471 | [
"Apache-2.0"
] | kalimfaria/heron | heron/instance/src/python/utils/topology/topology_context_impl.py | 11,290 | Python |
'''
Created on Sep 18, 2017
@author: jschm
'''
from cs115 import map
def powerset(lst):
"""returns the power set of the list - the set of all subsets of the list"""
if lst == []:
return [[]]
#power set is a list of lists
#this way is more efficent for getting the combinations of the characters ... | 31.635714 | 131 | 0.604651 | [
"MIT"
] | jschmidtnj/CS115 | use_it_or_lose_it.py | 4,429 | Python |
# Copyright 2022 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 37.223602 | 80 | 0.724345 | [
"Apache-2.0"
] | KenniVelez/magenta | magenta/common/sequence_example_lib.py | 5,993 | Python |
from dataclasses import dataclass
from bindings.csw.query_type import QueryType
__NAMESPACE__ = "http://www.opengis.net/cat/csw/2.0.2"
@dataclass
class Query(QueryType):
class Meta:
namespace = "http://www.opengis.net/cat/csw/2.0.2"
| 22.545455 | 58 | 0.729839 | [
"Apache-2.0"
] | NIVANorge/s-enda-playground | catalog/bindings/csw/query.py | 248 | Python |
"""
gaeenv
~~~~~~~
Google App Engine Virtual Environment builder.
"""
import os
from setuptools import setup, find_packages
from gaeenv.main import gaeenv_version
def read_file(file_name):
return open(
os.path.join(
os.path.dirname(os.path.abspath(__file__)),
file_name
)
... | 25.829787 | 70 | 0.633443 | [
"Apache-2.0"
] | signalpillar/gaeenv | setup.py | 1,214 | Python |
# based on: https://github.com/ShiqiYu/libfacedetection.train/blob/74f3aa77c63234dd954d21286e9a60703b8d0868/tasks/task1/yufacedetectnet.py # noqa
import math
from enum import Enum
from typing import Callable, Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from kornia.g... | 36.995181 | 146 | 0.579887 | [
"ECL-2.0",
"Apache-2.0"
] | Abdelrhman-Hosny/kornia | kornia/contrib/face_detection.py | 15,353 | Python |
"""
Module Doc String
"""
EMOTIONS = [
"sentimental",
"afraid",
"proud",
"faithful",
"terrified",
"joyful",
"angry",
"sad",
"jealous",
"grateful",
"prepared",
"embarrassed",
"excited",
"annoyed",
"lonely",
"ashamed",
"guilty",
"surprised",
"no... | 12.77551 | 26 | 0.496805 | [
"MIT"
] | ajyl/KEMP | common.py | 626 | Python |
from django.utils import translation
from django.utils.translation.trans_real import (
to_language as django_to_language,
parse_accept_lang_header as django_parse_accept_lang_header
)
from django.test import RequestFactory, TestCase
from django.urls import reverse
from .. import language_code_to_iso_3166, pars... | 36.809524 | 108 | 0.675722 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | 10allday-Software/donate-wagtail | donate/core/tests/test_utils.py | 2,319 | Python |
# global
import ivy
import abc
import importlib
from typing import List
# local
from ivy_builder.specs.spec import Spec
from ivy_builder.specs import DatasetSpec
from ivy_builder.specs.spec import locals_to_kwargs
# ToDo: fix cyclic imports, so this method can be imported from the builder module
def load_class_from_... | 45.196429 | 114 | 0.594232 | [
"Apache-2.0"
] | ivy-dl/builder | ivy_builder/specs/network_spec.py | 2,531 | Python |
# coding: utf-8
import pprint
import re
import six
class SetBackupPolicyRequestBody:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and t... | 26.481481 | 83 | 0.562937 | [
"Apache-2.0"
] | JeffreyDin/huaweicloud-sdk-python-v3 | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | 2,860 | Python |
# -*- coding: utf-8 -*-
"""
Rewrite ot.bregman.sinkhorn in Python Optimal Transport (https://pythonot.github.io/_modules/ot/bregman.html#sinkhorn)
using pytorch operations.
Bregman projections for regularized OT (Sinkhorn distance).
"""
import torch
M_EPS = 1e-16
def sinkhorn(a, b, C, reg=1e-1, method='sinkhorn', m... | 35.175258 | 157 | 0.583118 | [
"MIT"
] | SelmanOzleyen/DRDM-Count | losses/bregman_pytorch.py | 17,062 | Python |
from typing import List
def bubblesort(nums: List[int]):
""" sort list """
for i in range(0, len(nums)):
for j in range(0, len(nums) - i - 1):
if nums[j] > nums[j + 1]:
tmp = nums[j]
nums[j] = nums[j + 1]
nums[j + 1] = tmp
return nums
| 24.384615 | 45 | 0.451104 | [
"CC0-1.0"
] | vscode-debug-specs/python | bubblesort/bubblesort_logic.py | 317 | Python |
# -*- coding: utf-8 -*-
# Copyright 2021 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
#############################################
# WARNING ... | 45.380952 | 78 | 0.196222 | [
"MIT"
] | elixir-no-nels/usegalaxy | venv/lib/python3.6/site-packages/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/route_maps/route_maps.py | 10,483 | Python |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="rocketpy",
version="0.9.9",
install_requires=["numpy>=1.0", "scipy>=1.0", "matplotlib>=3.0", "requests"],
maintainer="RocketPy Developers",
author="Giovani Hidalgo Ceotto",
author_emai... | 32.32 | 81 | 0.67203 | [
"MIT"
] | DeepWater1013/RockedPy | setup.py | 808 | Python |
# Database Lib
"""
Oracle
PostGresSQL
SQLite
SQLServer
Hive
Spark
"""
import os, datetime, pandas, time, re
from collections import namedtuple, OrderedDict
import jmespath
import sqlalchemy
from multiprocessing import Queue, Process
from xutil.helpers import (
log,
elog,
slog,
get_exception_message,
struct,... | 31.146559 | 117 | 0.609395 | [
"MIT"
] | flarco/n1slutil | xutil/database/base.py | 38,466 | Python |
# flake8: noqa
# Disable Flake8 because of all the sphinx imports
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you un... | 38.009456 | 138 | 0.678505 | [
"Apache-2.0"
] | AndersonReyes/airflow | docs/conf.py | 16,080 | Python |
from django.db import models
class Todo(models.Model):
name = models.CharField(max_length=200)
| 16.833333 | 43 | 0.752475 | [
"BSD-3-Clause"
] | jgerigmeyer/jquery-django-superformset | demo/demo/todos/models.py | 101 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 48.290249 | 210 | 0.656884 | [
"MIT"
] | 4thel00z/microsoft-crap-that-doesnt-work | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/operations/_routes_operations.py | 21,296 | Python |
import pytest
import pandas as pd
from sklearn.model_selection import train_test_split
TEST_SIZE = 0.33
RANDOM_STATE = 42
@pytest.fixture(scope="module")
def binary_dataset():
df = pd.read_csv("./resources/heart.csv")
features = df.iloc[0:, :-1]
labels = df.iloc[0:, -1].values.ravel()
X_train, X_tes... | 25.030303 | 72 | 0.691283 | [
"BSD-3-Clause"
] | mdietrichstein/skpredict | tests/svm/conftest.py | 826 | Python |
"""
Makes python 2 behave more like python 3.
Ideally we import this globally so all our python 2 interpreters will assist in spotting errors early.
"""
# future imports are harmless if they implement behaviour that already exists in the current interpreter version
from __future__ import absolute_import, division, prin... | 27.755556 | 112 | 0.670136 | [
"MIT"
] | peerke88/error-check-tool | errorCheckTool/py23.py | 1,249 | Python |
import rebound
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display, clear_output
from sherlockpipe.nbodies.PlanetInput import PlanetInput
class StabilityCalculator:
def __init__(self, star_mass):
self.star_mass = star_mass
def mass_from_radius(self, radius):
... | 39.44 | 153 | 0.649763 | [
"MIT"
] | LuisCerdenoMota/SHERLOCK | experimental/megno.py | 2,958 | Python |
# -*- coding: utf-8 -*-
from __future__ import print_function
from acq4.devices.Device import *
from acq4.util import Qt
import acq4.util.Mutex as Mutex
from collections import OrderedDict
class LightSource(Device):
"""Device tracking the state and properties of multiple illumination sources.
"""
# emitte... | 36.645161 | 114 | 0.62632 | [
"MIT"
] | RonnyBergmann/acq4 | acq4/devices/LightSource/LightSource.py | 2,272 | Python |
import asyncio
import dataclasses
import logging
import multiprocessing
from concurrent.futures.process import ProcessPoolExecutor
from enum import Enum
from typing import Dict, List, Optional, Set, Tuple, Union
from clvm.casts import int_from_bytes
from kujenga.consensus.block_body_validation import validate_block_b... | 45.399784 | 119 | 0.636396 | [
"Apache-2.0"
] | Kujenga-Network/kujenga-blockchain | kujenga/consensus/blockchain.py | 42,131 | Python |
class ListData():
def __init__(instance):
### INTERNAL PARAMETERS #############
instance.missing_data_character = " "
#####################################
instance.dataset = []
def headers(instance):
"""
Returns the first row of the instance.dataset
R... | 54.831737 | 2,984 | 0.582331 | [
"MIT"
] | clokman/KFIR | preprocessor/ListData.py | 40,084 | Python |
"""[HTTPX](https://www.python-httpx.org/) 驱动适配
```bash
nb driver install httpx
# 或者
pip install nonebot2[httpx]
```
:::tip 提示
本驱动仅支持客户端 HTTP 连接
:::
FrontMatter:
sidebar_position: 3
description: nonebot.drivers.httpx 模块
"""
from typing import Type, AsyncGenerator
from contextlib import asynccontextmanager
fr... | 24.580247 | 81 | 0.616273 | [
"MIT"
] | A-kirami/nonebot2 | nonebot/drivers/httpx.py | 2,033 | Python |
from flask import render_template, request, redirect, send_from_directory, jsonify, Blueprint
from direct_answers import choose_direct_answer
from direct_answers import search_result_features
import indieweb_utils
import search_helpers, config, search_page_feeds
import requests
import json
import math
import spacy
impo... | 30.242515 | 137 | 0.701416 | [
"MIT"
] | capjamesg/indieweb-search | main.py | 10,101 | Python |
# 03_xkcd_multithread_download.py
# In dieser Übung geht es darum den Download der Comics zu beschleunigen
# indem man mehrere Threads zum downloaden nutzt.
import os, threading, requests, bs4
os.chdir(os.path.dirname(__file__))
target_dir='.\\comics'
source_url='https://xkcd.com'
# Prüfe ob Seite erreichbar
url_con... | 34.507042 | 106 | 0.672653 | [
"MIT"
] | Apop85/Scripts | Python/Buch_ATBS/Teil_2/Kapitel_15_Aufgaben_zeitlich_Planen_und_Programme_starten/03_xkcd_multithread_download/03_xkcd_multithread_download.py | 2,456 | Python |
import os
from setuptools import setup
from ec2audit import __version__
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='ec2audit',
version=__version__,
description='Dump all EC2 information to a folder suitable for version control',
long_descripti... | 31.928571 | 86 | 0.6566 | [
"Apache-2.0"
] | cosmin/ec2audit | setup.py | 894 | Python |
# -*- coding: utf-8 -*- #
# 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... | 32.15873 | 95 | 0.748766 | [
"Apache-2.0"
] | bshaffer/google-cloud-sdk | lib/surface/kms/keys/versions/list.py | 2,026 | Python |
import networkx as nx
from operator import add
with open("input.txt","r") as f:
char_map=[list(l.strip('\n')) for l in f.readlines()]
top_labels=char_map[:2]
top_labels=list(map(add,top_labels[0],top_labels[1]))
bottom_labels=char_map[-2:]
bottom_labels=list(map(add,bottom_labels[0],bottom_labels[1]))
char_map=cha... | 37.121951 | 91 | 0.640604 | [
"MIT"
] | Seralpa/Advent-of-code-2019 | day20/day20_1.py | 3,044 | Python |
from sqlalchemy import Column, String, Integer, ForeignKey
from sqlalchemy.orm import relationship
from IocManager import IocManager
from models.dao.Entity import Entity
class ConnectionDatabase(Entity, IocManager.Base):
__tablename__ = "ConnectionDatabase"
__table_args__ = {"schema": "Connection"}
Connec... | 42.864865 | 80 | 0.639344 | [
"MIT"
] | PythonDataIntegrator/pythondataintegrator | src/api/models/dao/connection/ConnectionDatabase.py | 1,586 | Python |
# Create your views here.
from django.contrib.auth import get_user_model
from django.db import transaction
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from django.utils.translation import ... | 37.543147 | 114 | 0.741211 | [
"MIT"
] | OkunaOrg/okuna-api | openbook_follows/views.py | 7,396 | Python |
"""
本文件用以练习 manim 的各种常用对象
SVGMobject
ImageMobject
TextMobject
TexMobeject
Text
参考资料: https://www.bilibili.com/video/BV1CC4y1H7kp
XiaoCY 2020-11-27
"""
#%% 初始化
from manimlib.imports import *
"""
素材文件夹介绍
在 manim 中使用各种素材时可以使用绝对路径声明素材。
为了简单,可以创建 assets 文件夹并放置在 manim 路径下。
如此做,使用素材时可以不加路径。
... | 22.412121 | 93 | 0.593564 | [
"MIT"
] | iChunyu/LearnPython | manim/tutorial01_Mobjects.py | 5,248 | Python |
# Copyright 2017 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... | 39 | 80 | 0.712172 | [
"MIT"
] | emma-mens/elk-recognition | src/animal_detection/tf_api/core/box_predictor_test.py | 12,636 | Python |
# Copyright 2013-2021 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 __future__ import print_function
import collections
import copy
import itertools
import os
import pprint
import sys
i... | 36.265366 | 85 | 0.595264 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | AaltoSciComp/spack | lib/spack/spack/solver/asp.py | 61,361 | Python |
import logging
import sys
from notion.block import PageBlock
from notion.client import NotionClient
from requests import HTTPError, codes
from enex2notion.utils_exceptions import BadTokenException
logger = logging.getLogger(__name__)
def get_root(token, name):
if not token:
logger.warning(
... | 25.25 | 82 | 0.665651 | [
"MIT"
] | vzhd1701/enex2notion | enex2notion/cli_notion.py | 1,313 | Python |
from ds2.orderedmapping.bstmapping import BSTMapping, BSTNode
from ds2.orderedmapping.balancedbst import BalancedBST, BalancedBSTNode
from ds2.orderedmapping.wbtree import WBTree, WBTreeNode
from ds2.orderedmapping.avltree import AVLTree, AVLTreeNode
from ds2.orderedmapping.splaytree import SplayTree, SplayTreeNode
| 52.833333 | 71 | 0.873817 | [
"MIT"
] | aslisabanci/datastructures | ds2/orderedmapping/__init__.py | 317 | Python |
from flask_testing import TestCase
from flask import url_for
from core import app, db
import unittest
from core.models import FeatureRequest, Client, ProductArea
import datetime
class BaseTest(TestCase):
SQLALCHEMY_DATABASE_URI = "sqlite://"
TESTING = True
def create_app(self):
app.config["TESTIN... | 35.954907 | 88 | 0.594393 | [
"Unlicense"
] | spapas/feature-requests | test_core.py | 13,555 | Python |
from .settings import *
RESPA_CATERINGS_ENABLED = True
RESPA_COMMENTS_ENABLED = True
RESPA_PAYMENTS_ENABLED = True
# Bambora Payform provider settings
RESPA_PAYMENTS_PROVIDER_CLASS = 'payments.providers.BamboraPayformProvider'
RESPA_PAYMENTS_BAMBORA_API_URL = 'https://real-bambora-api-url/api'
RESPA_PAYMENTS_BAMBORA_... | 35.764706 | 75 | 0.845395 | [
"MIT"
] | johlindq/respa | respa/test_settings.py | 608 | Python |
# Theory: Indexes
# There are several types of collections to store data in Python.
# Positionally ordered collections of elements are usually called
# sequences, and both lists and strings belong to them. EAch
# element in a list, as well as each character in a string, has an
# index that corresponds to its position.... | 40.333333 | 66 | 0.770661 | [
"MIT"
] | chanchanchong/PYTHON-TRACK-IN-HYPERSKILL | Computer science/Programming languages/Python/Working with data/Collections/Lists/Indexes/topic.py | 484 | Python |
from __future__ import absolute_import
import requests
import json
import logging
from .base import Provider as BaseProvider
LOGGER = logging.getLogger(__name__)
def ProviderParser(subparser):
subparser.description = '''
Zeit Provider requires a token to access its API.
You can generate one for ... | 38.695364 | 156 | 0.60688 | [
"MIT"
] | alexsilva1983/lexicon | lexicon/providers/zeit.py | 5,843 | Python |
# Generated by Django 3.2.9 on 2022-01-01 10:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('notes', '0003_auto_20220101_1040'),
]
operations = [
migrations.RenameField(
model_name='notes',
old_name='category'... | 22.714286 | 47 | 0.553459 | [
"MIT"
] | ArnedyNavi/studymate | notes/migrations/0004_auto_20220101_1047.py | 636 | Python |
import tkinter as tk
from tkinter import ttk
import json
from dashboard.entities.InputField import InputField
from dashboard.entities.StatusField import StatusField
class Devices(ttk.Frame):
"""
Devices Frame for Settings
"""
def __init__(self, parent, settings):
"""
Constructs a Warni... | 33.111111 | 96 | 0.641611 | [
"MIT"
] | Hexagoons/GUI-Arduino-Weather-Station | dashboard/entities/Devices.py | 1,490 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.