repo_name
stringlengths
7
65
path
stringlengths
5
185
copies
stringlengths
1
4
size
stringlengths
4
6
content
stringlengths
977
990k
license
stringclasses
14 values
hash
stringlengths
32
32
line_mean
float64
7.18
99.4
line_max
int64
31
999
alpha_frac
float64
0.25
0.95
ratio
float64
1.5
7.84
autogenerated
bool
1 class
config_or_test
bool
2 classes
has_no_keywords
bool
2 classes
has_few_assignments
bool
1 class
keon/algorithms
algorithms/graph/traversal.py
1
1319
""" Different ways to traverse a graph """ # dfs and bfs are the ultimately same except that they are visiting nodes in # different order. To simulate this ordering we would use stack for dfs and # queue for bfs. # def dfs_traverse(graph, start): """ Traversal by depth first search. """ visited, stack...
mit
73c766eff9b9699a113bad6665687066
26.479167
76
0.59439
3.972892
false
false
false
false
keon/algorithms
algorithms/graph/minimum_spanning_tree.py
1
4809
""" Minimum spanning tree (MST) is going to use an undirected graph """ import sys # pylint: disable=too-few-public-methods class Edge: """ An edge of an undirected graph """ def __init__(self, source, target, weight): self.source = source self.target = target self.weight = we...
mit
be397cc4942e0dadb1033ecc9e56d5ad
30.847682
99
0.585569
3.716383
false
false
false
false
keon/algorithms
algorithms/maths/power.py
1
1046
""" Performs exponentiation, similarly to the built-in pow() or ** functions. Allows also for calculating the exponentiation modulo. """ def power(a: int, n: int, mod: int = None): """ Iterative version of binary exponentiation Calculate a ^ n if mod is specified, return the result modulo mod Time...
mit
8148d2ba4679f45f28c035947d12ac7c
20.791667
73
0.521033
3.521886
false
false
false
false
keon/algorithms
algorithms/maths/chinese_remainder_theorem.py
1
1557
""" Solves system of equations using the chinese remainder theorem if possible. """ from typing import List from algorithms.maths.gcd import gcd def solve_chinese_remainder(nums : List[int], rems : List[int]): """ Computes the smallest x that satisfies the chinese remainder theorem for a system of equation...
mit
e6565651bba4bd15572f7c996851bfcd
32.847826
85
0.597303
3.663529
false
false
false
false
bxlab/bx-python
lib/bx/align/axt.py
1
7619
""" Support for reading and writing the `AXT`_ format used for pairwise alignments. .. _AXT: http://genome.ucsc.edu/goldenPath/help/axt.html """ from bx import interval_index_file from bx.align import ( Alignment, Component, src_split, ) # Tools for dealing with pairwise alignments in AXT format class ...
mit
8bd92d6f00d3eae0789071315299f9cb
31.012605
113
0.590891
3.678899
false
false
false
false
bxlab/bx-python
lib/bx/intervals/operations/concat.py
1
2602
""" Concatenate sets of intervals. Preserves format of the first input -- it is possible to concat two files that have different column orders. Of course, the meta-data of the second will be lost (and filled with a "."). If all of the files (GenomicInteralReaders) are the same format, sameformat=True will preserve all...
mit
0c340624c6a7b168f12cdd4660941438
41.655738
78
0.581091
4.580986
false
false
false
false
bxlab/bx-python
scripts/mMK_bitset.py
1
5170
#!/usr/bin/env python from optparse import OptionParser from rpy import r import bx.align.maf import bx.bitset from bx.bitset_builders import binned_bitsets_from_file def main(): parser = OptionParser(usage="usage: %prog [options] maf_file snp_file neutral_file window_size step_size") parser.add_option("-o...
mit
72dde494e9533515a0bcd3c6f462fbae
34.170068
110
0.600193
3.057363
false
false
false
false
bxlab/bx-python
scripts/maf_to_axt.py
1
2743
#!/usr/bin/env python """ Application to convert MAF file to AXT file, projecting to any two species. Reads a MAF file from standard input and writes an AXT file to standard out; some statistics are written to standard error. The user must specify the two species of interest. usage: %prog primary_species secondary_sp...
mit
bf006bb079326b344c23bb63e27267f7
23.274336
94
0.595334
3.394802
false
false
false
false
bxlab/bx-python
scripts/maf_count.py
1
1622
#!/usr/bin/env python """ Read a MAF from standard input and print counts of alignments, bases, or columns. usage: %prog [options] -c, --cols: count alignment columns rather than number of alignments -b, --bases: count bases in first species rather than number of alignments -s, --skip=N: when counting bases,...
mit
46212d8db3b3ac751b543542ba7b574c
22.852941
84
0.548089
3.807512
false
false
false
false
bxlab/bx-python
scripts/maf_tile.py
1
4303
#!/usr/bin/env python """ 'Tile' the blocks of a maf file over each of a set of intervals. The highest scoring block that covers any part of a region will be used, and pieces not covered by any block filled with "-" or optionally "*". The list of species to tile is specified by `tree` (either a tree or just a comma se...
mit
c35310421e44735956c8c23ded6771ae
30.181159
95
0.558912
3.412371
false
false
false
false
bxlab/bx-python
lib/bx/interval_index_file_tests.py
1
1608
import random from tempfile import mktemp from . import interval_index_file from .interval_index_file import Indexes def test_offsets(): assert interval_index_file.offsets_for_max_size(512 * 1024 * 1024 - 1) == [ 512 + 64 + 8 + 1, 64 + 8 + 1, 8 + 1, 1, 0, ] def test_...
mit
9d02efd925188b0048ba80687b386f88
25.8
79
0.502488
3.534066
false
false
false
false
bxlab/bx-python
lib/bx/pwm/bed_score_aligned_string.py
1
2951
#!/usr/bin/env python2.4 """ Returns all positions of a maf with any pwm score > threshold The positions are projected onto human coordinates """ import sys from bx import intervals from bx.align import maf as align_maf from bx.pwm.pwm_score_maf import MafMotifScorer def isnan(x): return not x == x def main()...
mit
d1ac9e945bee7ce9350a667a26e42083
32.157303
101
0.517452
3.872703
false
false
false
false
bxlab/bx-python
lib/bx/pwm/position_weight_matrix.py
1
30984
#!/usr/bin/env python import math import sys from numpy import ( float32, putmask, shape, zeros, ) # This is the average of all species in the alignment outside of exons # > mean(r) # A T C G # 0.2863776 0.2878264 0.2129560 0.2128400 # > sd(r) # ...
mit
954ed2f9a6761e52b7c4c51ac5ab2a8f
32.899344
123
0.500065
3.891973
false
false
false
false
bxlab/bx-python
scripts/maf_extract_ranges_indexed.py
1
4636
#!/usr/bin/env python """ Reads a list of intervals and a maf. Produces a new maf containing the blocks or parts of blocks in the original that overlapped the intervals. It is assumed that each file `maf_fname` has a corresponding `maf_fname`.index file. NOTE: If two intervals overlap the same block it will be writt...
mit
b23785af7a06b66ac295d24c974f20c3
36.691057
181
0.580026
3.945532
false
false
false
false
bxlab/bx-python
lib/bx/intervals/operations/find_clusters.py
1
5191
""" Find clusters of intervals within a set of intervals. A cluster is a group (of size minregions) of intervals within a specific distance (of mincols) of each other. Returns Cluster objects, which have a chrom, start, end, and lines (a list of linenumbers from the original file). The original can then be ran throu...
mit
35ce38c78a2f20d34d78e2f7672d676a
36.345324
103
0.592564
4.146166
false
false
false
false
myint/rstcheck
prep_release.py
1
7175
"""Script for preparing the repo for a new release.""" import argparse import re import subprocess # noqa: S404 import sys from datetime import date if sys.version_info[0:2] <= (3, 6): raise RuntimeError("Script runs only with python 3.7 or newer.") PATCH = ("patch", "bugfix") MINOR = ("minor", "feature") MAJO...
mit
0b02681b6ee5042ecf978811c759305e
31.466063
97
0.560279
3.746736
false
false
false
false
myint/rstcheck
tests/test_runner.py
1
15529
"""Tests for ``runner`` module.""" # pylint: disable=protected-access import contextlib import multiprocessing import pathlib import sys import typing as t import pytest import pytest_mock from rstcheck import checker, config, runner, types from tests.conftest import EXAMPLES_DIR class TestRstcheckMainRunnerInit: ...
mit
5317c03ac686e4132c4958c610fdeddc
35.367681
100
0.637903
3.64445
false
true
false
false
michael-lazar/rtv
scripts/update_packages.py
1
1382
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Update the project's bundled dependencies by downloading the git repository and copying over the most recent commit. """ import os import shutil import subprocess import tempfile _filepath = os.path.dirname(os.path.relpath(__file__)) ROOT = os.path.abspath(os.path.jo...
mit
63cd97218de18c75e8cbe8ff839f0577
27.204082
79
0.638205
3.28266
false
false
false
false
michael-lazar/rtv
rtv/page.py
1
31508
# -*- coding: utf-8 -*- from __future__ import unicode_literals import re import os import sys import time import logging from functools import wraps import six from kitchen.text.display import textual_width from . import docs from .clipboard import copy as clipboard_copy from .objects import Controller, Command fro...
mit
12b7b490658bf4edabd2d4b7abc232f0
34.562077
92
0.559191
4.204991
false
false
false
false
michael-lazar/rtv
tests/test_oauth.py
1
6890
# -*- coding: utf-8 -*- from __future__ import unicode_literals import requests from rtv.oauth import OAuthHelper, OAuthHandler from rtv.exceptions import InvalidRefreshToken from rtv.packages.praw.errors import OAuthException try: from unittest import mock except ImportError: import mock def test_oauth_h...
mit
c63a561c00e88a7ec509877fb9aefb4b
34.153061
79
0.681713
3.939394
false
true
false
false
michael-lazar/rtv
rtv/config.py
1
10433
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import codecs import shutil import argparse from functools import partial import six from six.moves import configparser from . import docs, __version__ from .objects import KeyMap PACKAGE = os.path.dirname(__file__) HOME = os.path.expanduser(...
mit
effee0d3d8d1db833639cd64b5ed2e3d
33.432343
81
0.612288
3.901645
false
true
false
false
wbond/asn1crypto
dev/_task.py
7
4196
# coding: utf-8 from __future__ import unicode_literals, division, absolute_import, print_function import ast import _ast import os import sys from . import package_root, task_keyword_args from ._import import _import_from if sys.version_info < (3,): byte_cls = str else: byte_cls = bytes def _list_tasks()...
mit
dab3bb8f667726963873311cb43be3a4
24.742331
82
0.529075
3.73975
false
false
false
false
wbond/asn1crypto
asn1crypto/core.py
2
170716
# coding: utf-8 """ ASN.1 type classes for universal types. Exports the following items: - load() - Any() - Asn1Value() - BitString() - BMPString() - Boolean() - CharacterString() - Choice() - EmbeddedPdv() - Enumerated() - GeneralizedTime() - GeneralString() - GraphicString() - IA5String() - InstanceO...
mit
0daf4d2e708425b0135406da15a07a70
29.075581
119
0.516985
4.60977
false
false
false
false
wbond/asn1crypto
dev/_import.py
2
3489
# coding: utf-8 from __future__ import unicode_literals, division, absolute_import, print_function import imp import sys import os from . import build_root, package_name, package_root if sys.version_info < (3,): getcwd = os.getcwdu else: getcwd = os.getcwd def _import_from(mod, path, mod_dir=None, allow_er...
mit
a1193a484631bb22b9e30df10f0cc1ef
27.834711
82
0.579536
3.876667
false
true
false
false
nschloe/meshio
src/meshio/neuroglancer/_neuroglancer.py
1
2824
""" Neuroglancer format, used in large-scale neuropil segmentation data. Adapted from https://github.com/HumanBrainProject/neuroglancer-scripts/blob/1fcabb613a715ba17c65d52596dec3d687ca3318/src/neuroglancer_scripts/mesh.py (MIT license) """ import struct import numpy as np from .._common import warn from .._exceptio...
mit
e9563fba9266bdd41e7ac9db13a90be6
36.157895
163
0.670326
3.410628
false
false
false
false
nschloe/meshio
tests/legacy_writer.py
1
6820
import logging import numpy as np # https://vtk.org/doc/nightly/html/vtkCellType_8h_source.html vtk_to_meshio_type = { 0: "empty", 1: "vertex", # 2: 'poly_vertex', 3: "line", # 4: 'poly_line', 5: "triangle", # 6: 'triangle_strip', 7: "polygon", # 8: 'pixel', 9: "quad", 10: ...
mit
22d89300df1022725546dd1407df31b1
29.176991
88
0.600147
3.354648
false
false
false
false
graphql-python/graphene
graphene/relay/tests/test_node.py
1
5609
import re from textwrap import dedent from graphql_relay import to_global_id from ...types import ObjectType, Schema, String from ..node import Node, is_node class SharedNodeFields: shared = String() something_else = String() def resolve_something_else(*_): return "----" class MyNode(ObjectT...
mit
8d08634deb58d54566764e2d9048adf2
24.495455
88
0.570333
3.651693
false
true
false
false
nschloe/meshio
tests/test_flac3d.py
1
1540
import pathlib import numpy as np import pytest import meshio from . import helpers @pytest.mark.parametrize( "mesh", [ helpers.empty_mesh, helpers.tet_mesh, helpers.hex_mesh, helpers.tet_mesh, helpers.add_cell_sets(helpers.tet_mesh), ], ) @pytest.mark.parametriz...
mit
f16750adcbe0aa9a3cf4bc3a82c5ce35
21.985075
80
0.553896
3.123732
false
true
false
false
graphql-python/graphene
graphene/relay/tests/test_global_id.py
1
1566
from graphql_relay import to_global_id from ...types import ID, NonNull, ObjectType, String from ...types.definitions import GrapheneObjectType from ..node import GlobalID, Node class CustomNode(Node): class Meta: name = "Node" class User(ObjectType): class Meta: interfaces = [CustomNode] ...
mit
6135e90853c296419a57f7f1310c3487
26
63
0.64751
3.317797
false
true
false
false
desec-io/desec-stack
api/desecapi/views/dyndns.py
1
5265
import base64 import binascii from functools import cached_property from rest_framework import generics from rest_framework.authentication import get_authorization_header from rest_framework.exceptions import NotFound, ValidationError from rest_framework.response import Response from desecapi import metrics from dese...
mit
2482569d74b9dd82f26755c845f25c7c
29.970588
87
0.565052
4.586237
false
false
false
false
desec-io/desec-stack
api/desecapi/management/commands/sync-from-pdns.py
1
1966
from django.core.management import BaseCommand, CommandError from django.db import transaction from desecapi import pdns from desecapi.models import Domain, RRset, RR, RR_SET_TYPES_AUTOMATIC class Command(BaseCommand): help = "Import authoritative data from pdns, making the local database consistent with pdns." ...
mit
e22efd10763e830b22e59e69aacdf490
36.09434
102
0.591048
4.130252
false
false
false
false
desec-io/desec-stack
api/desecapi/models/captcha.py
1
1702
from __future__ import annotations import secrets import string import uuid from django.conf import settings from django.db import models from django.utils import timezone from django_prometheus.models import ExportModelOperationsMixin from desecapi import metrics def captcha_default_content(kind: str) -> str: ...
mit
e4abdc389f2f3fcfb3d78239a2ee0c3d
31.113208
84
0.658049
3.876993
false
false
false
false
desec-io/desec-stack
api/desecapi/management/commands/sync-to-pdns.py
1
2885
from django.core.management import BaseCommand, CommandError, call_command from django.db import transaction from desecapi import pdns from desecapi.exceptions import PDNSException from desecapi.models import Domain from desecapi.pdns_change_tracker import PDNSChangeTracker class Command(BaseCommand): help = "Sy...
mit
4fd667e4d17517c979dee603aba6d4c2
34.182927
87
0.585442
4.384498
false
false
false
false
desec-io/desec-stack
api/desecapi/views/records.py
1
5044
from django.http import Http404 from rest_framework import generics from rest_framework.exceptions import PermissionDenied from rest_framework.permissions import IsAuthenticated, SAFE_METHODS from desecapi import models, permissions from desecapi.pdns_change_tracker import PDNSChangeTracker from desecapi.serializers i...
mit
9a5843f983a719f999b3c348e8fb8e74
33.786207
119
0.64433
4.382276
false
false
false
false
desec-io/desec-stack
test/e2e2/spec/test_api_user_mgmt.py
1
1936
from conftest import DeSECAPIV1Client def test_register(api_anon: DeSECAPIV1Client): email = "e2e2@desec.test" password = "foobar12" assert api_anon.register(email, password)[1].json() == {"detail": "Welcome!"} assert "token" in api_anon.login(email, password).json() api = api_anon assert ap...
mit
52602ca0178d34d37671924acc0dece8
42.022222
105
0.653409
3.432624
false
true
false
false
desec-io/desec-stack
api/desecapi/tests/test_token_domain_policy.py
1
19694
from contextlib import nullcontext from django.db import transaction from django.db.utils import IntegrityError from rest_framework import status from rest_framework.test import APIClient from desecapi import models from desecapi.tests.base import DomainOwnerTestCase class TokenDomainPolicyClient(APIClient): de...
mit
4afeb2e8371625f9ea01df36af967a2e
39.191837
98
0.597085
4.126126
false
false
false
false
desec-io/desec-stack
api/desecapi/views/tokens.py
1
3382
import django.core.exceptions from rest_framework import viewsets from rest_framework.exceptions import ValidationError from rest_framework.permissions import IsAuthenticated, SAFE_METHODS from rest_framework.response import Response from rest_framework.reverse import reverse from rest_framework.views import APIView f...
mit
5009ecdda491fefb81405adb3d3ef774
33.510204
80
0.679184
4.52139
false
false
false
false
desec-io/desec-stack
api/desecapi/serializers/domains.py
1
6481
import dns.name import dns.zone from rest_framework import serializers from api import settings from desecapi.models import Domain, RR_SET_TYPES_AUTOMATIC from desecapi.validators import ReadOnlyOnUpdateValidator from .records import RRsetSerializer class DomainSerializer(serializers.ModelSerializer): default_e...
mit
e692409ffc78f864085194f0b1d337a0
36.680233
108
0.496683
4.779499
false
false
false
false
desec-io/desec-stack
api/desecapi/models/tokens.py
1
7834
from __future__ import annotations import ipaddress import secrets import uuid from datetime import timedelta import pgtrigger import rest_framework.authtoken.models from django.contrib.auth.hashers import make_password from django.contrib.postgres.fields import ArrayField from django.core import validators from djan...
mit
8619b23b4395f2a6becba8279e028a65
39.802083
160
0.644498
4.125329
false
false
false
false
intel/intel-iot-refkit
meta-iotqa/lib/xmlrunner/runner.py
8
3949
import sys import time from .unittest import TextTestRunner from .result import _XMLTestResult # see issue #74, the encoding name needs to be one of # http://www.iana.org/assignments/character-sets/character-sets.xhtml UTF8 = 'UTF-8' class XMLTestRunner(TextTestRunner): """ A test runner class that outputs...
mit
8f20502ba1f9fea95f248563bf301d90
33.043103
78
0.549759
4.70119
false
true
false
false
stxnext-csr/volontulo
setup.py
6
1767
# -*- coding: utf-8 -*- u""" .. module:: setup """ import os from distutils.command.install import install from setuptools import setup from subprocess import check_output REPO_ROOT = os.path.dirname(__file__) class install_with_gulp(install): u"""Class extending install command - responsible for building fron...
mit
35d19931744a877c865badebb6039033
28.45
78
0.617997
3.759574
false
false
false
false
lilydjwg/nvchecker
tests/test_regex.py
1
4336
# MIT licensed # Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al. import base64 import pytest import pytest_httpbin assert pytest_httpbin # for pyflakes pytestmark = pytest.mark.asyncio def base64_encode(s): return base64.b64encode(s.encode('utf-8')).decode('ascii') async def test_regex_httpbin_de...
mit
83b3293d8708092f12210a9fa466be31
32.353846
92
0.566882
3.243082
false
true
false
false
lilydjwg/nvchecker
nvchecker_source/htmlparser.py
1
1215
# MIT licensed # Copyright (c) 2020 Ypsilik <tt2laurent.maud@gmail.com>, et al. # Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al. from lxml import html, etree from nvchecker.api import session, GetVersionError async def get_version(name, conf, *, cache, **kwargs): key = tuple(sorted(conf.items())) ...
mit
8a21cf3c4144a78071cf18cf4923d4ef
28.634146
87
0.674074
3.257373
false
false
false
false
stxnext-csr/volontulo
apps/volontulo/tests/views/offers/test_offer_join.py
2
6957
# -*- coding: utf-8 -*- u""" .. module:: test_offer_join """ from django.contrib.auth.models import User from django.test import Client from django.test import TestCase from apps.volontulo.models import Offer from apps.volontulo.models import Organization from apps.volontulo.models import UserProfile class TestOff...
mit
05ecb093bb61641c3d6029865da87aef
32.229665
79
0.555508
4.107037
false
true
false
false
ni/nixnet-python
nixnet/_frames.py
2
5893
from __future__ import absolute_import from __future__ import division from __future__ import print_function import struct from nixnet import _cconsts from nixnet import _errors from nixnet import constants from nixnet import types nxFrameFixed_t = struct.Struct('QIBBBB8s') # NOQA: N801 assert nxFrameFixed_t.size ...
mit
eb1639cbc70d7e5e0b9bda2e83bf6176
32.482955
106
0.649584
3.325621
false
false
false
false
ni/nixnet-python
nixnet_examples/can_frame_queued_io.py
1
3364
from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import six import nixnet from nixnet import constants from nixnet import types def main(): database_name = 'NIXNET_example' cluster_name = 'CAN_Cluster' input_frame = 'CANEventFrame1...
mit
b8b4d0391002e3b79e559a435771e87f
35.967033
110
0.52824
4.503347
false
false
false
false
ni/nixnet-python
docs/conf.py
1
5720
# -*- coding: utf-8 -*- # # NI-XNET Python API documentation build configuration file, created by # sphinx-quickstart on Thu Jun 14 09:40:36 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated ...
mit
6e7d615813d1c614b1057dd024849d97
30.086957
79
0.668007
3.872715
false
true
false
false
ni/nixnet-python
nixnet/types.py
1
35486
from __future__ import absolute_import from __future__ import division from __future__ import print_function import abc import collections import typing # NOQA: F401 import six from nixnet import _cconsts from nixnet import _errors from nixnet import _py2 from nixnet import constants __all__ = [ 'DriverVersion...
mit
ce1e5013b10a465785a6e021fb39fce8
32.990421
118
0.591078
3.97959
false
false
false
false
ni/nixnet-python
tests/test_examples.py
1
5737
from __future__ import absolute_import from __future__ import division from __future__ import print_function import copy import mock # type: ignore import pytest # type: ignore from nixnet import _cfuncs from nixnet import _ctypedefs from nixnet_examples import can_dynamic_database_creation from nixnet_examples i...
mit
55669814855548ecd50a90e9396b2dda
34.196319
90
0.677009
2.907755
false
true
false
false
ni/nixnet-python
tests/conftest.py
2
1910
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import pytest # type: ignore def pytest_addoption(parser): parser.addoption( "--can-out-interface", default="None", action="store", help="The CAN interface to use with ...
mit
de668ebdda1d281df30a7b0c632f1a38
27.939394
98
0.660209
3.858586
false
true
false
false
ni/nixnet-python
nixnet/database/_find_object.py
1
1674
from __future__ import absolute_import from __future__ import division from __future__ import print_function import typing # NOQA: F401 from nixnet import _cconsts from nixnet import _errors from nixnet import _funcs from nixnet import constants from nixnet.database import _database_object # NOQA: F401 def find_o...
mit
693e515833e35b0ced1b358aea95e738
34.617021
95
0.71147
3.821918
false
false
false
false
ni/nixnet-python
nixnet/_session/base.py
1
31408
from __future__ import absolute_import from __future__ import division from __future__ import print_function import ctypes # type: ignore import typing # NOQA: F401 import warnings from nixnet import _ctypedefs from nixnet import _errors from nixnet import _funcs from nixnet import _props from nixnet import _utils ...
mit
1f3a3b0089305f437f060078421ea4af
44.126437
142
0.661042
4.531525
false
false
false
false
ni/nixnet-python
nixnet/database/_signal.py
1
20178
from __future__ import absolute_import from __future__ import division from __future__ import print_function import typing # NOQA: F401 from nixnet import _cconsts from nixnet import _errors from nixnet import _props from nixnet import constants from nixnet.database import _database_object from nixnet.database impo...
mit
b19ebc3b3e3ceda99160c5f3175a0343
38.410156
119
0.647884
4.349644
false
false
false
false
cwacek/python-jsonschema-objects
python_jsonschema_objects/wrapper_types.py
1
11522
import collections import logging import six from python_jsonschema_objects import util from python_jsonschema_objects.validators import registry, ValidationError from python_jsonschema_objects.util import lazy_format as fmt logger = logging.getLogger(__name__) class ArrayWrapper(collections.abc.MutableSequence): ...
mit
fd0c49a9fb07748dcba0d412b2958d17
34.343558
96
0.518486
4.837112
false
false
false
false
cwacek/python-jsonschema-objects
test/test_regression_214.py
1
2381
import json import pytest import python_jsonschema_objects as pjo schema = { "$schema": "http://json-schema.org/draft-07/schema", "title": "myschema", "type": "object", "definitions": { "MainObject": { "title": "Main Object", "additionalProperties": False, "t...
mit
f3c325dd43e366e99cebc17648054a97
28.395062
82
0.432591
4.401109
false
false
false
false
rollbar/pyrollbar
rollbar/contrib/fastapi/routing.py
1
3401
__all__ = ['add_to'] import logging import sys from typing import Callable, Optional, Type, Union from fastapi import APIRouter, FastAPI, __version__ from fastapi.routing import APIRoute try: from fastapi import Request, Response except ImportError: # Added in FastAPI v0.51.0 from starlette.requests impo...
mit
ff48591d246d8e2a32883e2440d41bd9
29.63964
90
0.653043
4.073054
false
false
false
false
rollbar/pyrollbar
rollbar/lib/traverse.py
3
4205
import logging try: # Python 3 from collections.abc import Mapping from collections.abc import Sequence except ImportError: # Python 2.7 from collections import Mapping from collections import Sequence from rollbar.lib import binary_type, iteritems, string_types, circular_reference_label CIRC...
mit
11e9e266e872cef00726ef4ac7b5039c
26.664474
129
0.612366
3.704846
false
false
false
false
meraki-analytics/cassiopeia
cassiopeia/core/status.py
1
5417
from typing import List, Union from merakicommons.cache import lazy from merakicommons.container import searchable, SearchableList from ..data import Region, Platform from .common import CoreData, CassiopeiaObject, CassiopeiaGhost, ghost_load_on ############## # Data Types # ############## class TranslationData(C...
mit
22a57223d88b8c1b8ae75e8afc8e8de0
23.963134
88
0.613808
3.908369
false
false
false
false
rollbar/pyrollbar
rollbar/lib/events.py
2
1970
EXCEPTION_INFO = 'exception_info' MESSAGE = 'message' PAYLOAD = 'payload' _event_handlers = { EXCEPTION_INFO: [], MESSAGE: [], PAYLOAD: [] } def _check_type(typ): if typ not in _event_handlers: raise ValueError('Unknown type: %s. Must be one of %s' % (typ, _event_handlers.keys())) def _add_...
mit
f71225c093c548739fbf38c28ce87957
18.89899
95
0.645685
3.299832
false
false
false
false
meraki-analytics/cassiopeia
cassiopeia/_configuration/settings.py
1
7283
from typing import TypeVar, Type, Dict, Union, List import logging import importlib import inspect import copy from datapipelines import ( DataPipeline, DataSink, DataSource, CompositeDataTransformer, DataTransformer, ) from ..data import Region, Platform T = TypeVar("T") logging.basicConfig( ...
mit
691a9586f518157bdeabdc44d2b86b06
31.954751
86
0.574077
4.312019
false
true
false
false
meraki-analytics/cassiopeia
cassiopeia/datastores/cache.py
1
53137
from typing import Type, Mapping, Any, Iterable, TypeVar, Tuple, Callable, Generator import datetime from datapipelines import ( DataSource, DataSink, PipelineContext, validate_query, NotFoundError, ) from merakicommons.cache import Cache as CommonsCache from . import uniquekeys from ..core.static...
mit
55161022443c5dfbb5e9f70dc14567ef
33.730065
96
0.64473
3.672218
false
false
false
false
meraki-analytics/cassiopeia
setup.py
1
1494
#!/usr/bin/env python import sys from setuptools import setup, find_packages install_requires = [ "datapipelines>=1.0.7", "merakicommons>=1.0.10", "Pillow", "arrow", "requests", ] # Require python 3.6 if sys.version_info.major != 3 and sys.version_info.minor != 6: sys.exit("Cassiopeia requi...
mit
5ed0a17d2eb0ee7e592f67d2003cdd9b
32.2
182
0.649264
3.670762
false
false
false
false
meraki-analytics/cassiopeia
cassiopeia/datastores/kernel/championmastery.py
1
8321
from typing import Type, TypeVar, MutableMapping, Any, Iterable, Generator from datapipelines import ( DataSource, PipelineContext, Query, NotFoundError, validate_query, ) from .common import KernelSource, APINotFoundError from ...data import Platform from ...dto.championmastery import ( Champi...
mit
a34de93abce5f48b8063de7c5c8fe750
34.559829
121
0.583343
3.775408
false
false
false
false
meraki-analytics/cassiopeia
cassiopeia/datastores/riotapi/__init__.py
1
3475
from typing import Iterable, Set, Dict import itertools import os from datapipelines import CompositeDataSource from .common import RiotAPIService, RiotAPIRateLimiter def _default_services( api_key: str, limiting_share: float = 1.0, request_error_handling: Dict = None ) -> Set[RiotAPIService]: from ..common ...
mit
2313cf11579bbeabd528068874a79bca
30.306306
82
0.592806
3.962372
false
false
false
false
meraki-analytics/cassiopeia
cassiopeia/core/championmastery.py
1
9150
import arrow from typing import Union from merakicommons.cache import lazy, lazy_property from merakicommons.container import searchable from ..data import Region, Platform from .common import ( CoreData, CassiopeiaObject, CassiopeiaGhost, CassiopeiaLazyList, CoreDataList, get_latest_version, ...
mit
bdb64ebd5f088f9b795e987843198573
32.272727
141
0.60306
3.568643
false
false
false
false
rollbar/pyrollbar
rollbar/examples/fastapi/app_middleware.py
1
1675
#!/usr/bin/env python # This example uses Uvicorn package that must be installed. However, it can be # replaced with any other ASGI-compliant server. # # Optional asynchronous reporting requires HTTPX package to be installed. # # NOTE: FastAPI middlewares don't allow to collect streamed content like a request body. # ...
mit
02d174e29ace4678bf99c44ca6b97f74
28.385965
88
0.733731
3.56383
false
false
false
false
rollbar/pyrollbar
rollbar/contrib/rq/__init__.py
5
1668
""" Exception handler hook for RQ (http://python-rq.org/) How to use: 1. Instead of using the default "rqworker" script to run the worker, write your own short script as shown in this example: https://github.com/nvie/rq/blob/master/examples/run_worker.py 2. In this script, initialize rollbar with `handler='blockin...
mit
d0db574ae39da031ae29979878329b72
29.327273
97
0.682854
3.618221
false
false
false
false
meraki-analytics/cassiopeia
cassiopeia/datastores/uniquekeys.py
1
85975
from typing import ( Tuple, Set, Union, MutableMapping, Any, Mapping, Iterable, Generator, List, ) from datapipelines import Query, PipelineContext, QueryValidationError from ..data import Region, Platform, Continent, Queue, Tier, Division from ..dto.champion import ChampionRotati...
mit
22b657e783a4f5075803c48efbf35b78
25.766812
98
0.601035
3.506178
false
false
false
false
rollbar/pyrollbar
rollbar/lib/transforms/serializable.py
2
3783
import math from rollbar.lib import binary_type, string_types from rollbar.lib import ( circular_reference_label, float_infinity_label, float_nan_label, undecodable_object_label, unencodable_object_label) from rollbar.lib import iteritems, python_major_version, text from rollbar.lib.transforms import Transfor...
mit
a617d3f155130d08b4bfc2f61ea71a6d
31.333333
78
0.528417
4.063373
false
false
false
false
meraki-analytics/cassiopeia
examples/dtos.py
1
2536
import cassiopeia as cass from cassiopeia import Platform # On rare occasions you may want to avoid using Cass's nice type system and instead access dictionary-like objects # pulled directly from the Riot API (or other data sources). # This should be a rare use case, and it neglects the part of Cass that's fun to use...
mit
6c07178e3f714e1048807d3854ef7bde
52.957447
119
0.734621
3.633238
false
false
false
false
kemayo/sublime-text-git
git/history.py
1
9932
from __future__ import absolute_import, unicode_literals, print_function, division import functools import re import sublime from . import GitTextCommand, GitWindowCommand, plugin_file class GitBlameCommand(GitTextCommand): def run(self, edit): # somewhat custom blame command: # -w: ignore white...
mit
b0b71357be6d93aaae5921c9c1bc31a8
34.471429
194
0.580447
3.679881
false
false
false
false
posativ/isso
isso/__init__.py
1
10799
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # The MIT License (MIT) # # Copyright (c) 2012-2014 Martin Zimmermann. # # 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,...
mit
9bb63da9c3a36162f0f465581575e42c
34.4
96
0.632027
4.072803
false
false
false
false
enkore/i3pystatus
i3pystatus/circleci.py
4
5445
import os import dateutil.parser from circleci.api import Api from i3pystatus import IntervalModule from i3pystatus.core.util import TimeWrapper, formatp, internet, require __author__ = 'chestm007' class CircleCI(IntervalModule): """ Get current status of circleci builds Requires `circleci` `dateutil....
mit
d5b8a69ee9daca02b2f23b9617e6d86c
34.129032
119
0.590083
3.88651
false
false
false
false
warner/magic-wormhole
src/wormhole/_dilation/subchannel.py
1
14783
import six from collections import deque from attr import attrs, attrib from attr.validators import instance_of, provides from zope.interface import implementer from twisted.internet.defer import inlineCallbacks, returnValue from twisted.internet.interfaces import (ITransport, IProducer, IConsumer, ...
mit
df5d03242a31660f2a135b9ea16435fc
32.905963
88
0.639383
3.926428
false
false
false
false
posativ/isso
docs/_extensions/sphinx_reredirects/__init__.py
1
4953
# Imported from https://gitlab.com/documatt/sphinx-reredirects # 2021-02-03, commit 15da4697d14bb45c8d0b3586e66fa5df6319045d # # Copyright (c) 2020, documatt # BSD 3-Clause license import re from fnmatch import fnmatch from pathlib import Path from string import Template from typing import Dict, Mapping from sphinx.a...
mit
7a8ee066165f7527ae2c236e46e15070
34.891304
129
0.611347
4.103563
false
false
false
false
warner/magic-wormhole
src/wormhole/_dilation/manager.py
1
24617
from __future__ import print_function, unicode_literals import six import os from collections import deque try: # py >= 3.3 from collections.abc import Sequence except ImportError: # py 2 and py3 < 3.3 from collections import Sequence from attr import attrs, attrib from attr.validators import provides, ...
mit
d428942e8ef61a591e62b6bfc4406a8c
36.930663
93
0.646829
3.814224
false
false
false
false
warner/magic-wormhole
src/wormhole/test/dilate/test_parse.py
1
2402
from __future__ import print_function, unicode_literals import mock from twisted.trial import unittest from ..._dilation.connection import (parse_record, encode_record, KCM, Ping, Pong, Open, Data, Close, Ack) class Parse(unittest.TestCase): def test_parse(self): self....
mit
0c9cb6c6da5230cf27f444a2fc41aed5
53.590909
85
0.579517
3.095361
false
true
false
false
posativ/isso
docs/conf.py
1
8361
# -*- coding: utf-8 -*- # # Isso documentation build configuration file, created by # sphinx-quickstart on Thu Nov 21 11:28:01 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All ...
mit
8eaf5b9ba95518895d05e9c561d01a99
34.261603
95
0.686012
3.764414
false
true
false
false
enkore/i3pystatus
i3pystatus/mem_bar.py
11
1772
from i3pystatus import IntervalModule from psutil import virtual_memory from i3pystatus.core.color import ColorRangeModule from i3pystatus.core.util import make_bar class MemBar(IntervalModule, ColorRangeModule): """ Shows memory load as a bar. .. rubric:: Available formatters * {used_mem_bar} ...
mit
cd1ec4bfaf99ba37bc0e10c10cb27d9d
30.087719
112
0.616817
4.073563
false
false
false
false
posativ/isso
isso/dispatch.py
1
1926
# -*- encoding: utf-8 -*- import sys import os import logging from glob import glob from werkzeug.middleware.dispatcher import DispatcherMiddleware from werkzeug.wrappers import Response from isso import make_app, wsgi, config logger = logging.getLogger("isso") class Dispatcher(DispatcherMiddleware): """ ...
mit
cc7ff702493768b46cb3d4800ecd977a
28.630769
80
0.617342
3.844311
false
false
false
false
enkore/i3pystatus
i3pystatus/external_ip.py
11
2599
from i3pystatus import IntervalModule, formatp from i3pystatus.core.util import internet, require import GeoIP import urllib.request class ExternalIP(IntervalModule): """ Shows the external IP with the country code/name. Requires the PyPI package `GeoIP`. .. rubric:: Available formatters * {co...
mit
2545ce0bf987f1b03010cee4f6c62c6b
28.873563
88
0.580993
3.931921
false
false
false
false
enkore/i3pystatus
i3pystatus/mpd.py
1
8097
from collections import defaultdict import socket from os.path import basename from math import floor from i3pystatus import IntervalModule, formatp from i3pystatus.core.util import TimeWrapper class MPD(IntervalModule): """ Displays various information from MPD (the music player daemon) .. rubric:: Ava...
mit
16da4e3847d4cca40b5c7018a3073c9c
34.950893
106
0.55619
3.757816
false
false
false
false
warner/magic-wormhole
src/wormhole/test/test_machines.py
1
57816
from __future__ import print_function, unicode_literals import json from nacl.secret import SecretBox from spake2 import SPAKE2_Symmetric from twisted.trial import unittest from zope.interface import directlyProvides, implementer import mock from .. import (__version__, _allocator, _boss, _code, _input, _key, _list...
mit
8d334cba3d167d66333e972c9762d176
32.989418
79
0.533226
3.508252
false
true
false
false
posativ/isso
isso/core.py
1
2660
# -*- encoding: utf-8 -*- import time import logging import threading import multiprocessing try: import uwsgi except ImportError: uwsgi = None import _thread as thread from isso.utils.cache import NullCache from isso.utils.cache import SimpleCache logger = logging.getLogger("isso") class Cache: """W...
mit
d4eb0e8e4c764192071a18407e08cfc3
20.111111
77
0.615789
3.751763
false
false
false
false
enkore/i3pystatus
docs/module_docs.py
9
6310
import pkgutil import importlib import sphinx.application from docutils.parsers.rst import Directive from docutils.nodes import paragraph from docutils.statemachine import StringList import i3pystatus.core.settings import i3pystatus.core.modules from i3pystatus.core.imputil import ClassFinder from i3pystatus.core.co...
mit
83ef9ca2d7e84c5953493f040a1c1891
31.515464
105
0.57435
4.128272
false
false
false
false
enkore/i3pystatus
i3pystatus/moon.py
6
3188
from i3pystatus import IntervalModule, formatp import datetime import math import decimal import os from i3pystatus.core.util import TimeWrapper dec = decimal.Decimal class MoonPhase(IntervalModule): """ Available Formatters status: Allows for mapping of current moon phase - New Moon: - Waxin...
mit
95e9f7328e36bd2081737477306bcc7e
24.504
85
0.526662
3.065385
false
false
false
false
warner/magic-wormhole
src/wormhole/ipaddrs.py
1
2927
# no unicode_literals # Find all of our ip addresses. From tahoe's src/allmydata/util/iputil.py import errno import os import re import subprocess from sys import platform from twisted.python.procutils import which # Wow, I'm really amazed at home much mileage we've gotten out of calling # the external route.exe pro...
mit
d1af2aaa107bf5de7d36db5ccee2f8e0
29.489583
75
0.551076
3.48038
false
true
false
false
enkore/i3pystatus
i3pystatus/weather/weathercom.py
2
12461
import json import re from datetime import datetime from html.parser import HTMLParser from urllib.request import Request, urlopen from i3pystatus.core.util import internet, require from i3pystatus.weather import WeatherBackend class WeathercomHTMLParser(HTMLParser): ''' Obtain data points required by the We...
mit
b5295036e95ecd5a730b7f77f9373a77
40.668896
120
0.550445
4.356294
false
false
false
false
enkore/i3pystatus
i3pystatus/pagerduty.py
4
2349
from i3pystatus import IntervalModule from i3pystatus.core.util import internet, require, formatp import pypd __author__ = 'chestm007' class PagerDuty(IntervalModule): """ Module to get the current incidents in PD Requires `pypd` Formatters: * `{num_incidents}` - current number of incidents un...
mit
86162851323179b93f71dbc0496bc4c4
28
93
0.58493
3.670313
false
false
false
false
enkore/i3pystatus
i3pystatus/yubikey.py
3
3446
import re import os import time from i3pystatus import IntervalModule from i3pystatus.core.command import run_through_shell class Yubikey(IntervalModule): """ This module allows you to lock and unlock your Yubikey in order to avoid the OTP to be triggered accidentally. @author Daniel Theodoro <danie...
mit
a8f154f935bfbf95d2c707f96f7c8533
24.864662
76
0.498837
3.976879
false
false
false
false
fxsjy/jieba
jieba/posseg/viterbi.py
71
1610
import sys import operator MIN_FLOAT = -3.14e100 MIN_INF = float("-inf") if sys.version_info[0] > 2: xrange = range def get_top_states(t_state_v, K=4): return sorted(t_state_v, key=t_state_v.__getitem__, reverse=True)[:K] def viterbi(obs, states, start_p, trans_p, emit_p): V = [{}] # tabular mem_p...
mit
f01d1dfc4dc5e8e75dbf6b70382edf0c
29.377358
91
0.520497
2.900901
false
false
false
false
alejandroautalan/pygubu
src/pygubu/plugins/tk/tkstdwidgets.py
1
42688
# encoding: utf-8 import logging import tkinter as tk from pygubu.i18n import _ from pygubu.api.v1 import BuilderObject, register_widget from pygubu.component.builderobject import ( CB_TYPES, EntryBaseBO, PanedWindowBO, PanedWindowPaneBO, ) logger = logging.getLogger(__name__) # # tkinter widgets # _...
mit
a7da727d098caee4440e1d8e0aee0576
24.902913
127
0.545259
3.959558
false
false
false
false
alejandroautalan/pygubu
src/pygubu/plugins/customtkinter/designer/designerplugin.py
1
2144
from pygubu.api.v1 import IPluginBase, IDesignerPlugin from .preview import CTkToplevelPreviewBO, CTkPreviewBO, CTkFramePreviewBO from ..ctkbase import _plugin_uid class CTkDesignerPlugin(IDesignerPlugin): def get_preview_builder(self, builder_uid: str): if builder_uid == f"{_plugin_uid}.CTkToplevel": ...
mit
13a887e73b52613675378865ddd0e922
41.88
74
0.589086
3.621622
false
false
false
false
alejandroautalan/pygubu
src/pygubu/widgets/dialog.py
1
4608
# encoding: UTF-8 import tkinter as tk import tkinter.ttk as ttk class Dialog(object): """ Virtual events: <<DialogClose>> """ def __init__(self, parent, modal=False): self.parent = parent self.is_modal = modal self.show_centered = True self.running_modal = Fal...
mit
c09904aec8a7351eb4d2725ac9be842e
25.635838
77
0.551649
3.836803
false
false
false
false
alejandroautalan/pygubu
src/pygubu/plugins/awesometkinter/scrollbar.py
1
1317
from pygubu.i18n import _ from pygubu.api.v1 import register_widget, register_custom_property from pygubu.plugins.ttk.ttkstdwidgets import TTKScrollbar import awesometkinter as atk from ..awesometkinter import _designer_tab_label, _plugin_uid class SimpleScrollbarBO(TTKScrollbar): OPTIONS_STANDARD = tuple( ...
mit
fd467eb4243744a5bc109c48c0e54a71
31.121951
77
0.666667
3.540323
false
false
false
false
alejandroautalan/pygubu
src/pygubu/plugins/tkintertable/table.py
1
4670
import tkinter as tk from pygubu.i18n import _ from pygubu.api.v1 import ( BuilderObject, register_widget, register_custom_property, ) from pygubu.utils.font import tkfontstr_to_tuple from tkintertable import TableCanvas from ..tkintertable import _designer_tab_label, _plugin_uid class TableCanvasBuilder(...
mit
303783f41a3309963fc2160677dfe8aa
20.422018
76
0.59015
3.570336
false
false
false
false
alejandroautalan/pygubu
src/pygubu/plugins/awesometkinter/frame.py
1
3054
""" Documentation, License etc. @package pygubu.plugins.awesometkinter """ import tkinter as tk from pygubu.i18n import _ from pygubu.api.v1 import register_widget, register_custom_property from pygubu.plugins.tk.tkstdwidgets import TKFrame from pygubu.plugins.ttk.ttkstdwidgets import TTKFrame import awesometkinter as...
mit
292ed28182080b64aad08c13aa22bb6a
23.629032
80
0.647348
3.345016
false
false
false
false
yashaka/selene
examples/log_all_selene_commands_with_wait__framework/framework/extensions/selene.py
1
1709
import logging from typing import Tuple, List from examples.log_all_selene_commands_with_wait__framework.framework.extensions.python.logging import ( TranslatingFormatter, ) def log_with( logger, *, added_handler_translations: List[Tuple[str, str]] = (), ): """ returns decorator factory with ...
mit
b1fbb4f7f44984e1ef00561748dc17bf
27.966102
103
0.577531
4.631436
false
false
false
false
yashaka/selene
tests/acceptance/helpers/givenpage.py
1
3147
# MIT License # # Copyright (c) 2015-2022 Iakiv Kramarenko # # 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, modif...
mit
31a9c798d7339a373f825a44e355f2a8
32.478723
92
0.651414
3.953518
false
false
false
false
uclapi/uclapi
backend/uclapi/common/tests.py
1
17789
from django.test import TestCase, SimpleTestCase from .decorators import ( _check_general_token_issues, _check_oauth_token_issues, _check_temp_token_issues, _get_last_modified_header, how_many_seconds_until_midnight, get_var, throttle_api_call, UclApiIncorrectTokenTypeException ) from ...
mit
fa6c7f0c1beeba0b7d208b8c4f2b9a06
27.831442
73
0.545449
4.054011
false
true
false
false