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
plotly/dash
dash/_validate.py
1
18551
from collections.abc import MutableSequence import re from textwrap import dedent from keyword import iskeyword import flask from ._grouping import grouping_len, map_grouping from .development.base_component import Component from . import exceptions from ._utils import patch_collections_abc, stringify_id, to_json, coe...
mit
bccb2c57650194347e6f607d566b5b12
35.087549
130
0.547091
4.503277
false
false
false
false
plotly/dash
components/dash-table/dash_table_base/__init__.py
1
2609
import os as _os import sys as _sys import json import dash as _dash if not hasattr(_dash, "__plotly_dash") and not hasattr(_dash, "development"): print( "Dash was not successfully imported. " "Make sure you don't have a file " 'named \n"dash.py" in your current directory.', file=_...
mit
a1c68f15d492074a68de587552afac9d
26.463158
85
0.537754
3.474035
false
false
false
false
b-ryan/powerline-shell
powerline_shell/segments/hg.py
3
2097
import subprocess from ..utils import RepoStats, ThreadedSegment, get_subprocess_env def _get_hg_branch(): p = subprocess.Popen(["hg", "branch"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=get_subprocess_env()) branch = p.comm...
mit
476b75bf1ab55a5d6a2a4cb33691d567
29.838235
78
0.555079
3.854779
false
false
false
false
tomerfiliba/plumbum
plumbum/path/local.py
1
10683
import errno import glob import logging import os import shutil import urllib.parse as urlparse import urllib.request as urllib from contextlib import contextmanager from plumbum.lib import IS_WIN32 from plumbum.path.base import FSUser, Path from plumbum.path.remote import RemotePath try: from grp import getgrgid...
mit
82eb3360c71749bf5bf74bd9f811d88e
29.092958
101
0.535898
4.028281
false
false
false
false
radish-bdd/radish
radish/hookregistry.py
1
4063
# -*- coding: utf-8 -*- """ This module provides a registry for all hooks """ from singleton import singleton from . import utils from .exceptions import HookError import tagexpressions @singleton() class HookRegistry(object): """ Represents an object with all registered hooks """ DEFAULT_...
mit
b2cfefef37a9aa3ea58e2693eecaaf63
28.021429
107
0.492001
4.504435
false
false
false
false
radish-bdd/radish
tests/unit/test_model.py
1
2730
# -*- coding: utf-8 -*- """ radish ~~~~~~ Behavior Driven Development tool for Python - the root from red to green Copyright: MIT, Timo Furrer <tuxtimo@gmail.com> """ import time import pytest from radish.model import Model, Tag from radish.exceptions import RadishError def test_creating_simple_...
mit
247d1b42ba5eb3b430ae1ed9969ddd1a
21.016129
103
0.576923
3.601583
false
true
false
false
radish-bdd/radish
tests/radish/steps.py
1
5348
# -*- coding: utf-8 -*- """ radish ~~~~~~ Behavior Driven Development tool for Python - the root from red to green Copyright: MIT, Timo Furrer <tuxtimo@gmail.com> """ import os import json from radish import given, when, then, world from radish.extensions.cucumber_json_writer import CucumberJSONWri...
mit
19052295c553fb011fdbfc102190eb34
26.152284
110
0.675019
3.410714
false
false
false
false
radish-bdd/radish
radish/extensions/endreport_writer.py
1
7389
# -*- coding: utf-8 -*- """ This radish extension module provide the functionality to write the end report """ # disable no-member lint error because of dynamic method from colorful # pylint: disable=no-member from datetime import timedelta import colorful import humanize from radish.hookregistry import after from...
mit
8bb1e6b6fc1e8a6dd25758c5c77d6ada
36.130653
169
0.508459
4.739577
false
false
false
false
radish-bdd/radish
radish/core.py
1
3214
# -*- coding: utf-8 -*- """ Providing radish core functionality. """ from threading import Lock from collections import OrderedDict from .parser import FeatureParser class Configuration(object): """ Manage configuration. Attributes of the class are created from the names of the command line opt...
mit
9776f00d3a0d87dbb2410f1458970b36
27.442478
87
0.561294
4.644509
false
false
false
false
onecodex/onecodex
onecodex/viz/_bargraph.py
1
12197
from onecodex.exceptions import OneCodexException, PlottingException from onecodex.lib.enums import Rank, Metric, Link from onecodex.viz._primitives import ( interleave_palette, prepare_props, sort_helper, get_ncbi_taxonomy_browser_url, get_classification_url, open_links_in_new_tab, ) class Vi...
mit
7ec2211f07f714fd3fb7b73f192f1680
38.859477
107
0.567025
4.179918
false
false
false
false
python-visualization/folium
folium/plugins/marker_cluster.py
1
3791
from jinja2 import Template from folium.elements import JSCSSMixin from folium.map import Layer, Marker from folium.utilities import parse_options, validate_locations class MarkerCluster(JSCSSMixin, Layer): """ Provides Beautiful Animated Marker Clustering functionality for maps. Parameters --------...
mit
a7c97d6a844057580963c162dacc367b
33.463636
107
0.575838
4.18895
false
false
false
false
python-visualization/folium
folium/plugins/heat_map.py
1
3672
import warnings import numpy as np from jinja2 import Template from folium.elements import JSCSSMixin from folium.map import Layer from folium.utilities import ( if_pandas_df_convert_to_numpy, none_max, none_min, parse_options, validate_location, ) class HeatMap(JSCSSMixin, Layer): """ C...
mit
4ff52db3cd3833367c9db9cc58e0d0d5
29.347107
112
0.535948
3.948387
false
false
false
false
python-visualization/folium
tests/plugins/test_tag_filter_button.py
1
2470
""" Test TagFilterButton ------------ """ import random import numpy as np from jinja2 import Template import folium from folium import plugins from folium.utilities import normalize def test_tag_filter_button(): np.random.seed(3141592) # Generate base data initial_data = np.random.normal(size=(100, 2...
mit
c2c458e07ca161ed04e8eec3bced41dd
38.83871
143
0.631984
3.459384
false
false
false
false
python-visualization/folium
folium/plugins/polyline_text_path.py
1
2292
from jinja2 import Template from folium.elements import JSCSSMixin from folium.features import MacroElement from folium.utilities import parse_options class PolyLineTextPath(JSCSSMixin, MacroElement): """ Shows a text along a PolyLine. Parameters ---------- polyline: folium.features.PolyLine obj...
mit
b721a98a3abf949725b90522bfd9ae6a
27.65
90
0.585515
4.190128
false
false
false
false
python-visualization/folium
folium/folium.py
1
16746
""" Make beautiful, interactive maps with Python and Leaflet.js """ import time import warnings import webbrowser from branca.element import Element, Figure, MacroElement from jinja2 import Environment, PackageLoader, Template from folium.elements import JSCSSMixin from folium.map import FitBounds from folium.raste...
mit
a560a47c2897dc5c64be0e4cf8546028
33.315574
114
0.562702
3.923618
false
false
false
false
python-visualization/folium
tests/plugins/test_time_slider_choropleth.py
1
2895
""" tests TimeSliderChoropleth -------------------------- """ import json import numpy as np import pandas as pd from branca.colormap import linear import folium from folium.plugins import TimeSliderChoropleth from folium.utilities import normalize def test_timedynamic_geo_json(): """ tests folium.plugins...
mit
a830755df966a478a69fbf031fe9765c
31.166667
86
0.643523
3.509091
false
false
false
false
python-visualization/folium
folium/plugins/feature_group_sub_group.py
1
2789
from jinja2 import Template from folium.elements import JSCSSMixin from folium.map import Layer class FeatureGroupSubGroup(JSCSSMixin, Layer): """ Creates a Feature Group that adds its child layers into a parent group when added to a map (e.g. through LayerControl). Useful to create nested groups, or...
mit
3db420c84b5cfbd27f2624cb76fb3989
33.8625
106
0.595195
3.548346
false
false
false
false
python-visualization/folium
folium/plugins/minimap.py
1
4858
from branca.element import MacroElement from jinja2 import Template from folium.elements import JSCSSMixin from folium.raster_layers import TileLayer from folium.utilities import parse_options class MiniMap(JSCSSMixin, MacroElement): """Add a minimap (locator) to an existing map. Uses the Leaflet plugin by ...
mit
3fae8bac2ae869f5645daaa32b102ae0
35.526316
95
0.615068
4.096121
false
false
false
false
python-visualization/folium
setup.py
1
2623
import os import sys from setuptools import setup rootpath = os.path.abspath(os.path.dirname(__file__)) if sys.version_info < (3, 5): error = """ folium 0.9+ supports Python 3.5 and above. When using Python 2.7, please install folium 0.8.*. See folium `README.rst` file for more information: htt...
mit
ddda6aeefc4cd01b0fb33a957f021ae6
26.904255
75
0.600076
3.419817
false
false
false
false
pypa/setuptools
setuptools/_vendor/importlib_metadata/_text.py
11
2166
import re from ._functools import method_cache # from jaraco.text 3.5 class FoldedCase(str): """ A case insensitive string class; behaves just like str except compares equal when the only variation is case. >>> s = FoldedCase('hello world') >>> s == 'Hello World' True >>> 'Hello World'...
mit
089e44128f88bd18127e700897934efd
20.878788
62
0.576639
3.671186
false
false
false
false
beerfactory/hbmqtt
samples/client_subscribe_acl.py
1
1653
import logging import asyncio from hbmqtt.client import MQTTClient, ClientException from hbmqtt.mqtt.constants import QOS_1 # # This sample shows how to subscbribe a topic and receive data from incoming messages # It subscribes to '$SYS/broker/uptime' topic and displays the first ten values returned # by the broker....
mit
ae18a01e4c82445bbadbf921b4b83d59
34.934783
100
0.647913
3.42236
false
false
false
false
pypa/setuptools
setuptools/_vendor/importlib_resources/simple.py
12
2836
""" Interface adapters for low-level readers. """ import abc import io import itertools from typing import BinaryIO, List from .abc import Traversable, TraversableResources class SimpleReader(abc.ABC): """ The minimum, low-level interface required from a resource provider. """ @abc.abstractprop...
mit
f8488bcb5fe470a64051115f6d2dace6
23.448276
85
0.615656
4.245509
false
false
false
false
pypa/setuptools
setuptools/extension.py
1
5591
import re import functools import distutils.core import distutils.errors import distutils.extension from .monkey import get_unpatched def _have_cython(): """ Return True if Cython can be imported. """ cython_impl = 'Cython.Distutils.build_ext' try: # from (cython_impl) import build_ext ...
mit
a6a2ea854bba08190a058f361acb6fb3
36.777027
85
0.676623
4.327399
false
false
false
false
pypa/setuptools
setuptools/command/setopt.py
7
5086
from distutils.util import convert_path from distutils import log from distutils.errors import DistutilsOptionError import distutils import os import configparser from setuptools import Command __all__ = ['config_file', 'edit_config', 'option_base', 'setopt'] def config_file(kind="local"): """Get the filename o...
mit
c05d89f0c353f6fef3ae3abf93987b55
33.134228
79
0.567833
4.354452
false
true
false
false
pypa/setuptools
pkg_resources/_vendor/jaraco/context.py
8
5420
import os import subprocess import contextlib import functools import tempfile import shutil import operator @contextlib.contextmanager def pushd(dir): orig = os.getcwd() os.chdir(dir) try: yield dir finally: os.chdir(orig) @contextlib.contextmanager def tarball_context(url, target_d...
mit
d6895bb6479fea18a123146bf0fea3b9
24.446009
85
0.595941
4.084401
false
false
false
false
pypa/setuptools
setuptools/_distutils/command/bdist.py
1
5409
"""distutils.command.bdist Implements the Distutils 'bdist' command (create a built [binary] distribution).""" import os import warnings from ..core import Command from ..errors import DistutilsPlatformError, DistutilsOptionError from ..util import get_platform def show_formats(): """Print list of available fo...
mit
59db9a68b3a11e2cf005b188a05b5199
33.452229
85
0.57164
4.265773
false
false
false
false
pypa/setuptools
setuptools/command/install_egg_info.py
2
2226
from distutils import log, dir_util import os from setuptools import Command from setuptools import namespaces from setuptools.archive_util import unpack_archive from .._path import ensure_directory import pkg_resources class install_egg_info(namespaces.Installer, Command): """Install an .egg-info directory for ...
mit
e56af98371c35052bd5103e993ee226f
34.333333
78
0.601078
3.912127
false
false
false
false
pypa/setuptools
setuptools/_distutils/tests/test_archive_util.py
1
12919
"""Tests for distutils.archive_util.""" import os import sys import tarfile from os.path import splitdrive import warnings import functools import operator import pathlib import pytest import path from distutils import archive_util from distutils.archive_util import ( check_archive_formats, make_tarball, ...
mit
71c7dd75d6751de56df83020f45fd016
32.401554
84
0.585046
3.744699
false
true
false
false
pypa/setuptools
pkg_resources/_vendor/pyparsing/actions.py
12
6426
# actions.py from .exceptions import ParseException from .util import col class OnlyOnce: """ Wrapper for parse actions, to ensure they are only called once. """ def __init__(self, method_call): from .core import _trim_arity self.callable = _trim_arity(method_call) self.call...
mit
10a5e3093fe01fffa4a8eb32a685506c
30.043478
122
0.594304
3.831843
false
false
false
false
pypa/setuptools
setuptools/_distutils/archive_util.py
1
8572
"""distutils.archive_util Utility functions for creating archive files (tarballs, zip files, that sort of thing).""" import os from warnings import warn import sys try: import zipfile except ImportError: zipfile = None from .errors import DistutilsExecError from .spawn import spawn from .dir_util import mk...
mit
115873bd3bdb1a00b5c779370f786269
29.614286
88
0.581545
3.903461
false
false
false
false
pypa/setuptools
setuptools/_distutils/tests/test_upload.py
1
6634
"""Tests for distutils.command.upload.""" import os import unittest.mock as mock from urllib.request import HTTPError from distutils.command import upload as upload_mod from distutils.command.upload import upload from distutils.core import Distribution from distutils.errors import DistutilsError from distutils.tests...
mit
5a4c42418325cf39476522e14d805f91
29.571429
88
0.59994
3.691708
false
true
false
false
pypa/setuptools
setuptools/_distutils/command/bdist_rpm.py
1
22016
"""distutils.command.bdist_rpm Implements the Distutils 'bdist_rpm' command (create RPM source and binary distributions).""" import subprocess import sys import os from ..core import Command from ..debug import DEBUG from ..file_util import write_file from ..errors import ( DistutilsOptionError, DistutilsPla...
mit
f9c0e6dc360063e264ea0b53dd662936
34.798374
88
0.529342
4.164964
false
false
false
false
pypa/setuptools
setuptools/config/_validate_pyproject/formats.py
1
8736
import logging import os import re import string import typing from itertools import chain as _chain _logger = logging.getLogger(__name__) # ------------------------------------------------------------------------------------- # PEP 440 VERSION_PATTERN = r""" v? (?: (?:(?P<epoch>[0-9]+)!)? ...
mit
ed0fea06b8b46692c1128f3079597100
32.72973
88
0.555746
4.05007
false
false
false
false
pypa/setuptools
pkg_resources/_vendor/pyparsing/results.py
12
25341
# results.py from collections.abc import MutableMapping, Mapping, MutableSequence, Iterator import pprint from weakref import ref as wkref from typing import Tuple, Any str_type: Tuple[type, ...] = (str, bytes) _generator_type = type((_ for _ in ())) class _ParseResultsWithOffset: __slots__ = ["tup"] def __...
mit
baf13cce8c5de7990d36a4140dcf6b61
32.343421
183
0.470542
4.328096
false
false
false
false
pypa/setuptools
setuptools/_vendor/importlib_resources/_compat.py
8
2706
# flake8: noqa import abc import sys import pathlib from contextlib import suppress if sys.version_info >= (3, 10): from zipfile import Path as ZipPath # type: ignore else: from ..zipp import Path as ZipPath # type: ignore try: from typing import runtime_checkable # type: ignore except ImportError: ...
mit
1f6ece2b9e4f3b4b6c476ffc0d72078f
26.612245
84
0.623429
4.44335
false
false
false
false
pypa/setuptools
setuptools/tests/test_config_discovery.py
1
22192
import os import sys from configparser import ConfigParser from itertools import product from setuptools.command.sdist import sdist from setuptools.dist import Distribution from setuptools.discovery import find_package_path, find_parent_package from setuptools.errors import PackageDiscoveryError import setuptools # ...
mit
50776102a6d74d2689666b5cfd697326
33.838305
88
0.547224
3.713521
false
true
false
false
pypa/setuptools
setuptools/tests/test_packageindex.py
1
10263
import sys import os import distutils.errors import platform import urllib.request import urllib.error import http.client from unittest import mock import pytest import setuptools.package_index from .textwrap import DALS class TestPackageIndex: def test_regex(self): hash_url = 'http://other_url?:action=...
mit
3b26d81920b7d21b68dc497c8f285888
31.580952
86
0.565916
3.732
false
true
false
false
locustio/locust
locust/test/test_log.py
1
6737
from unittest import mock import socket import subprocess import textwrap from logging import getLogger import gevent from locust import log from locust.log import greenlet_exception_logger from .testcases import LocustTestCase from .util import temporary_file from . import changed_rlimit class TestGreenletExceptio...
mit
436c493629c7a1651d8c8de57f790003
31.703883
108
0.468309
4.906773
false
true
false
false
hydralabs/pyamf
pyamf/amf3.py
3
44902
# Copyright (c) The PyAMF Project. # See LICENSE.txt for details. """ AMF3 implementation. C{AMF3} is the default serialization for U{ActionScript<http://en.wikipedia.org/wiki/ActionScript>} 3.0 and provides various advantages over L{AMF0<pyamf.amf0>}, which is used for ActionScript 1.0 and 2.0. It adds support for s...
mit
086eb9834738c538e257e82c39f614c5
26.479804
102
0.580375
3.975739
false
false
false
false
hydralabs/pyamf
pyamf/remoting/amf0.py
6
5208
# Copyright (c) The PyAMF Project. # See LICENSE.txt for details. """ AMF0 Remoting support. @since: 0.1.0 """ import traceback import sys from pyamf import remoting from pyamf.remoting import gateway class RequestProcessor(object): def __init__(self, gateway): self.gateway = gateway @property ...
mit
6ff26121b4938e5faf0730fc2737ca21
26.267016
79
0.551651
4.725953
false
false
false
false
hydralabs/pyamf
pyamf/alias.py
6
17749
# Copyright (c) The PyAMF Project. # See LICENSE.txt for details. """ Class alias base functionality. @since: 0.6 """ import inspect import pyamf from pyamf import python, util class UnknownClassAlias(Exception): """ Raised if the AMF stream specifies an Actionscript class that does not have a Python ...
mit
7c47e0f1a778adc4cf36975bbd42040e
29.236797
79
0.558285
4.317441
false
false
false
false
hydralabs/pyamf
doc/tutorials/examples/actionscript/bytearray/python/client.py
8
1278
# Copyright (c) The PyAMF Project. # See LICENSE for details. """ Python ByteArray example. @since: 0.5 """ import os from optparse import OptionParser from gateway import images_root from pyamf.amf3 import ByteArray from pyamf.remoting.client import RemotingService # parse commandline options parser = OptionPa...
mit
290eef0c89aacf9d7977fa237a1eae1a
22.666667
66
0.698748
3.124694
false
false
false
false
hydralabs/pyamf
doc/tutorials/examples/gateways/appengine/demo/simplejson/jsonfilter.py
178
1662
import simplejson import cgi class JSONFilter(object): def __init__(self, app, mime_type='text/x-json'): self.app = app self.mime_type = mime_type def __call__(self, environ, start_response): # Read JSON POST input to jsonfilter.json if matching mime type response = {'status': ...
mit
6f46f8d726c919255b60cacf2b438c6d
40.55
74
0.565584
3.929078
false
false
false
false
hydralabs/pyamf
pyamf/adapters/_google_appengine_ext_ndb.py
6
10205
# Copyright (c) The PyAMF Project. # See LICENSE.txt for details. """ Google App Engine ndb adapter module. """ import datetime from google.appengine.ext import ndb from google.appengine.ext.ndb import polymodel import pyamf from pyamf.adapters import util, models as adapter_models, gae_base NDB_STUB_NAME = 'gae_...
mit
ca35df6180f795590fbbf2ee2d5a7cf0
25.997354
79
0.609309
4.006675
false
false
false
false
qtile/qtile
libqtile/scripts/start.py
2
4388
# Copyright (c) 2008, Aldo Cortesi. All rights reserved. # Copyright (c) 2011, Florian Mounier # # 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 limitat...
mit
5ead7646468a7b78581f9e592b507955
30.568345
93
0.655424
4.120188
false
true
false
false
qtile/qtile
libqtile/ipc.py
2
9252
# Copyright (c) 2008, Aldo Cortesi. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
mit
1446abf9bd015a50dd5a773d6b329715
33.014706
96
0.628405
4.184532
false
false
false
false
qtile/qtile
libqtile/widget/countdown.py
2
2363
# Copyright (c) 2014 Sean Vig # Copyright (c) 2014 roger # Copyright (c) 2014 Tycho Andersen # Copyright (c) 2014 Adi Sieker # # 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 restrict...
mit
2eb7614f5cc67cfbaade4f00e1453806
35.921875
79
0.644096
4.039316
false
false
false
false
qtile/qtile
test/widgets/docs_screenshots/ss_netgraph.py
2
2383
# Copyright (c) 2022 elParaguayo # # 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, distrib...
mit
c28bac25bb31264246cfd473416e1f75
30.773333
79
0.686949
3.938843
false
false
false
false
qtile/qtile
libqtile/backend/wayland/drawer.py
1
2980
from __future__ import annotations from typing import TYPE_CHECKING import cairocffi from libqtile import utils from libqtile.backend import base if TYPE_CHECKING: from libqtile.backend.wayland.window import Internal from libqtile.core.manager import Qtile from libqtile.utils import ColorsType class D...
mit
38c8bb38cc9c7a4c1702235de075e0cc
32.111111
85
0.620805
3.973333
false
false
false
false
qtile/qtile
libqtile/backend/x11/drawer.py
1
5970
from __future__ import annotations from typing import TYPE_CHECKING import cairocffi import xcffib.xproto from libqtile import utils from libqtile.backend import base if TYPE_CHECKING: from libqtile.backend.base import Internal from libqtile.core.manager import Qtile class Drawer(base.Drawer): """A he...
mit
6bea00de0496845c9f5eb8e60a20aaf0
29.773196
89
0.58325
3.86658
false
false
false
false
qtile/qtile
libqtile/widget/launchbar.py
1
11028
# Copyright (c) 2014 Tycho Andersen # Copyright (c) 2014 dequis # Copyright (c) 2014-2015 Joseph Razik # Copyright (c) 2014 Sean Vig # Copyright (c) 2015 reus # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal ...
mit
ca6df1a5f9e82a4c79f4b4e04ccf3ea9
38.669065
97
0.568553
4.084444
false
false
false
false
qtile/qtile
libqtile/scripts/main.py
2
2254
import argparse import logging import sys from libqtile.log_utils import get_default_log, init_log from libqtile.scripts import check, cmd_obj, migrate, run_cmd, shell, start, top try: # Python>3.7 can get the version from importlib from importlib.metadata import distribution VERSION = distribution("qtil...
mit
a272fb44ad071d417e7fb30605f23a5f
28.657895
81
0.64197
3.801012
false
false
false
false
qtile/qtile
libqtile/scripts/shell.py
2
2316
# Copyright (c) 2008, Aldo Cortesi. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
mit
05fb62b1461565de3d549f1219cb0d0e
34.630769
98
0.681347
4.063158
false
false
false
false
qtile/qtile
libqtile/widget/pulseaudio_ffi.py
2
14097
# -*- coding: utf-8 -*- from cffi import FFI pulseaudio_ffi = FFI() pulseaudio_ffi.set_source( "libqtile.widget._pulse_audio", """ #include "pulse/sample.h" #include "pulse/volume.h" #include "pulse/def.h" #include "pulse/introspect.h" #include "pulse/mainloop.h" #include "pulse/mainlo...
mit
edad8991aad6cee4dfce84ac3d922099
32.484561
113
0.608356
3.16218
false
false
false
false
qtile/qtile
libqtile/widget/sep.py
2
2912
# Copyright (c) 2010 Aldo Cortesi # Copyright (c) 2011 Mounier Florian # Copyright (c) 2012, 2015 Tycho Andersen # Copyright (c) 2012 Craig Barnes # Copyright (c) 2013 Tao Sauvage # Copyright (c) 2014 Sean Vig # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associ...
mit
c34c0e8e9764f6d7a8c7cb04d71ed563
42.462687
91
0.651786
3.945799
false
true
false
false
mpdavis/python-jose
tests/rfc/test_rfc7520.py
1
3373
# Disable flake8 reporting # flake8: noqa import pytest from jose.backends import RSAKey from jose.jws import verify expected_payload = b"It\xe2\x80\x99s a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there\xe2\x80\x99s no knowing where you might be swept ...
mit
4750236416e1e0ad3f12bf54e09078f4
47.884058
653
0.830418
1.779947
false
true
false
false
redis/redis-py
tests/test_asyncio/test_json.py
2
32575
import pytest import redis.asyncio as redis from redis import exceptions from redis.commands.json.path import Path from tests.conftest import skip_ifmodversion_lt @pytest.mark.redismod async def test_json_setbinarykey(modclient: redis.Redis): d = {"hello": "world", b"some": "value"} with pytest.raises(TypeEr...
mit
9341c126d2d1fa45939fa5990225e25c
33.137317
88
0.544478
3.211419
false
true
false
false
gwu-libraries/sfm-ui
sfm/ui/forms.py
1
59182
#!/usr/bin/env python # -*- coding: utf-8 -*- from django import forms from django.contrib.auth.models import Group from django.forms.widgets import DateTimeInput from django.urls import reverse from django.utils import timezone from django.core.exceptions import ValidationError from django.core.validators import MinV...
mit
89d98a430bb393dc59c03b5adb296c35
43.596081
333
0.593751
4.092248
false
false
false
false
adrn/gala
gala/dynamics/actionangle/tests/test_actionangle_staeckel.py
1
5520
# Third-party from astropy.constants import G import astropy.units as u import numpy as np import pytest # gala from gala.dynamics import PhaseSpacePosition from gala.dynamics.actionangle import ( get_staeckel_fudge_delta, find_actions_o2gf ) from gala.dynamics.actionangle.tests.staeckel_helpers import galpy_f...
mit
97f54279963b33df431724979c9e5971
34.159236
88
0.611594
2.79777
false
true
false
false
adrn/gala
gala/potential/potential/tests/test_interop_galpy.py
1
6598
""" Test converting the builtin Potential classes to other packages """ # Third-party from astropy.coordinates import CylindricalRepresentation from astropy.tests.helper import catch_warnings import astropy.units as u import numpy as np import pytest # This project import gala.potential as gp from gala.units import g...
mit
e52d0e57baafe3563e1908b34912b0aa
34.095745
79
0.541982
3.046168
false
true
false
false
adrn/gala
gala/coordinates/velocity_frame_transforms.py
1
2265
""" Miscellaneous astronomical velocity transformations. """ import astropy.coordinates as coord __all__ = ["vgsr_to_vhel", "vhel_to_vgsr"] def _get_vproj(c, vsun): gal = c.transform_to(coord.Galactic()) cart_data = gal.data.to_cartesian() unit_vector = cart_data / cart_data.norm() return coord.Cart...
mit
9dd3336a7e0cbd31454ec986ba5c4513
29.608108
77
0.659161
3.406015
false
false
false
false
adrn/gala
gala/potential/potential/builtin/pybuiltin.py
1
3183
# Third-party import numpy as np from gala.potential.potential.core import PotentialBase from gala.potential.potential.util import sympy_wrap from gala.potential.common import PotentialParameter __all__ = ["HarmonicOscillatorPotential"] class HarmonicOscillatorPotential(PotentialBase): r""" Represents an N-...
mit
0b5322582939fb9b5a3aec2529fb0240
34.366667
89
0.626139
3.608844
false
false
false
false
redis/redis-py
redis/commands/graph/node.py
4
2315
from ..helpers import quote_string class Node: """ A node within the graph. """ def __init__(self, node_id=None, alias=None, label=None, properties=None): """ Create a new node. """ self.id = node_id self.alias = alias if isinstance(label, list): ...
mit
3c21e67872502b2322027f6adcc79508
26.559524
79
0.483801
4.401141
false
false
false
false
gwu-libraries/sfm-ui
sfm/ui/notifications.py
1
16697
import logging from datetime import date, datetime, timedelta, time from collections import OrderedDict from smtplib import SMTPException from subprocess import check_output, CalledProcessError import pytz from itertools import chain from django.template.loader import get_template from django.core.mail import EmailMul...
mit
e15b25ba2010c9a94f16ccbaad0b442b
39.625304
146
0.597892
3.78188
false
false
false
false
gwu-libraries/sfm-ui
sfm/ui/management/commands/resendwarccreatedmsgs.py
2
2500
from django.core.management.base import BaseCommand, CommandError from ui.models import Warc from ui.rabbit import RabbitWorker import json class Command(BaseCommand): help = 'Resends warc_created messages to the messaging service.' def add_arguments(self, parser): parser.add_argument("routing_key", ...
mit
901c97e96758598ee54e9beaa247d13d
42.859649
116
0.5832
4.295533
false
false
false
false
aio-libs/aioredis
aioredis/connection.py
1
59561
import asyncio import errno import inspect import io import os import socket import ssl import threading import time import warnings from distutils.version import StrictVersion from itertools import chain from typing import ( Any, Iterable, List, Mapping, Optional, Set, Tuple, Type, ...
mit
e1bda9df1edfa2e1613c3366429638ef
36.155958
97
0.589312
4.512539
false
false
false
false
aio-libs/aioredis
docs/examples/pipeline.py
1
1759
import asyncio import aioredis async def main(): redis = aioredis.from_url("redis://localhost") # No pipelining; async def wait_each_command(): val = await redis.get("foo") # wait until `val` is available cnt = await redis.incr("bar") # wait until `cnt` is available return val,...
mit
61787c724729e1fe45876104867b485d
26.920635
70
0.609437
4.148585
false
false
false
false
indico/indico
indico/web/http_api/handlers.py
2
12034
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. """ HTTP API - Handlers """ import hashlib import hmac import posixpath import re import time from urllib...
mit
14a48bca97e2c96b7df17543c569d9b6
41.522968
117
0.604537
4.203283
false
false
false
false
indico/indico
indico/modules/events/persons/blueprint.py
1
2358
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from indico.modules.events.persons.controllers import (RHAPIEmailEventPersonsMetadata, RHAPIEmailEventPers...
mit
6e70784b345c671f53d8b1e0ea09cade
57.95
116
0.666243
3.778846
false
false
false
false
indico/indico
indico/modules/events/registration/controllers/display.py
1
22392
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from uuid import UUID from flask import flash, jsonify, redirect, request, session from sqlalchemy.orm im...
mit
d29c7bd19882b95a5e3d80e90078d406
45.943396
120
0.627456
4.49458
false
false
false
false
indico/indico
indico/modules/events/contributions/models/subcontributions.py
2
6375
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from sqlalchemy.ext.declarative import declared_attr from indico.core.db import db from indico.core.db.sq...
mit
55064fcf51355be563ba9a368995eff9
31.860825
112
0.667137
3.954715
false
false
false
false
indico/indico
indico/modules/events/surveys/operations.py
2
1948
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from flask import session from indico.core.db import db from indico.modules.events.surveys import logger ...
mit
0acb70170ba2ec004f6414c5896d3060
32.016949
96
0.705339
3.746154
false
false
false
false
indico/indico
indico/cli/event.py
1
5596
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. import sys import click from indico.cli.core import cli_group from indico.core import signals from indic...
mit
d588186cc83c60c614a8e7e243d78365
42.379845
118
0.67441
3.636127
false
false
false
false
indico/indico
indico/modules/events/editing/models/revision_files.py
2
2051
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from indico.core.db import db from indico.util.fs import secure_filename from indico.util.locators import ...
mit
f579c5c50d509356646e3322c356eaff
25.986842
89
0.59727
3.749543
false
false
false
false
indico/indico
indico/web/http_api/hooks/base.py
2
11292
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. """ Base export interface """ import re from datetime import datetime, time, timedelta from types import ...
mit
60ccde69c129c2438c6bb712d7f7768b
37.671233
117
0.598742
3.973258
false
false
false
false
indico/indico
indico/util/mimetypes.py
2
2740
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. import mimetypes import re _exact_mapping = { 'application/json': 'icon-file-css', 'text/css': '...
mit
3e9c27e8e30fb9f27d23b85103ae07b9
31.619048
106
0.64781
3.366093
false
false
false
false
indico/indico
docs/source/indico_uml_directive.py
4
1164
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. """ A simple Sphinx directive which extends plantweb's `directive`. The config setting `indico_uml_prelud...
mit
b4659733cd5a80b15808c4970364779c
30.459459
63
0.685567
3.592593
false
true
false
false
indico/indico
indico/modules/rb/statistics.py
2
3137
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from datetime import date, datetime, time from dateutil.relativedelta import relativedelta from indico.c...
mit
e482fa9ddf46d73cb49a7c29e5267f41
48.015625
116
0.652534
3.424672
false
false
false
false
indico/indico
indico/migrations/versions/20210219_1555_da06d8f50342_separate_authorized_scopes_from_tokens.py
4
3691
"""Separate authorized scopes from tokens Revision ID: da06d8f50342 Revises: 3782de7970da Create Date: 2021-02-19 15:55:53.134744 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = 'da06d8f50342' down_revision = '3782de79...
mit
0082c2d6303716d71f39c73ac1a1385d
46.935065
119
0.645083
3.528681
false
false
false
false
indico/indico
indico/core/plugins/controllers.py
2
2589
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from collections import defaultdict from operator import attrgetter from flask import flash, request from...
mit
556c49cd4322c796924f923cd3360d09
37.641791
113
0.660487
4.223491
false
false
false
false
indico/indico
indico/modules/events/abstracts/__init__.py
2
7783
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from flask import render_template, session from indico.core import signals from indico.core.config import...
mit
06ca4b0a36cbc7dd2e4fae839a51b79c
39.536458
118
0.740203
3.815196
false
false
false
false
indico/indico
indico/modules/attachments/controllers/display/event.py
2
2732
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from flask import redirect, request, session from werkzeug.exceptions import Forbidden from indico.module...
mit
decdf78b87edad938b2f120926295be6
42.365079
101
0.721816
4.329635
false
false
false
false
indico/indico
indico/modules/events/layout/clone.py
1
3312
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from indico.core.db import db from indico.modules.events.cloning import EventCloner, get_attrs_to_clone fr...
mit
6bb56e886ed88e7b438082576da7c089
40.4
104
0.666063
3.576674
false
false
false
false
indico/indico
indico/modules/events/persons/schemas.py
2
4809
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from marshmallow import fields, post_dump, post_load, pre_load from marshmallow_enum import EnumField fro...
mit
3b31644bd25ae6ab8d416f2a2bee8054
40.817391
116
0.669994
3.690714
false
false
false
false
indico/indico
indico/modules/legal/forms.py
2
1314
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from wtforms.fields import TextAreaField, URLField from wtforms.validators import URL, Optional from indi...
mit
d8ff8cc94fcfb55368b811bcc1524521
49.538462
120
0.679604
4.308197
false
false
false
false
indico/indico
indico/migrations/versions/20210607_1548_735dc4e8d2f3_update_merged_users_in_registrations.py
4
1729
"""Update merged users in registrations Revision ID: 735dc4e8d2f3 Revises: 178d297eae7e Create Date: 2021-06-07 15:48:19.154975 """ from alembic import op # revision identifiers, used by Alembic. revision = '735dc4e8d2f3' down_revision = '178d297eae7e' branch_labels = None depends_on = None def upgrade(): op....
mit
fd269f56db74113a3bb963177b769c36
35.020833
112
0.655292
3.5
false
false
false
false
indico/indico
indico/modules/vc/plugins.py
2
9554
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. import re from flask import render_template from flask_pluginengine import render_plugin_template from i...
mit
5e6adee80fa1341ab9e6f2699e91b053
38.974895
109
0.630731
3.8869
false
false
false
false
wandb/client
wandb/sdk/internal/file_pusher.py
1
5854
import logging import os import queue import tempfile import time from typing import Mapping, Optional, Tuple, TYPE_CHECKING import wandb from wandb.filesync import dir_watcher, stats, step_checksum, step_upload import wandb.util if TYPE_CHECKING: from wandb.sdk.interface import artifacts from wandb.sdk.inter...
mit
1734f696b3259fa41d31bca2564e80ce
31.342541
87
0.580629
3.968814
false
false
false
false
wandb/client
wandb/integration/kfp/wandb_logging.py
1
6159
def wandb_log( # noqa: C901 func=None, # /, # py38 only log_component_file=True, ): """Wrap a standard python function and log to W&B""" import json import os from functools import wraps from inspect import Parameter, signature from kfp import components from kfp.components im...
mit
e4525e2043b29d71164f4cbde5c047d3
32.655738
137
0.550414
3.93044
false
false
false
false
wandb/client
wandb/vendor/pygments/lexers/dalvik.py
29
4420
# -*- coding: utf-8 -*- """ pygments.lexers.dalvik ~~~~~~~~~~~~~~~~~~~~~~ Pygments lexers for Dalvik VM-related languages. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import RegexLexer, include, bygr...
mit
ba01f3177284a376215c6690a895be64
34.36
80
0.49095
3.733108
false
false
false
false
wandb/client
wandb/vendor/pygments/lexers/nix.py
29
4031
# -*- coding: utf-8 -*- """ pygments.lexers.nix ~~~~~~~~~~~~~~~~~~~ Lexers for the NixOS Nix language. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import RegexLexer, include from pygments.token impor...
mit
9c33576b74e14d95f0c86f781243991a
28.639706
89
0.420987
3.621743
false
false
false
false
wandb/client
tests/functional_tests/t0_main/lightning/train_tpu_ddp.py
1
1149
#!/usr/bin/env python import os from pl_base import BoringModel, RandomDataset from pytorch_lightning import Trainer from pytorch_lightning.loggers import WandbLogger from torch.utils.data import DataLoader import wandb def main(): # Use concurrency experiment wandb.require(experiment="service") print("...
mit
d1d4a7d4ac9064ae70c1cdb76b4c385d
27.02439
77
0.70148
3.209497
false
true
false
false
wandb/client
wandb/vendor/graphql-core-1.1/wandb_graphql/language/visitor.py
3
6276
from copy import copy import six from . import ast from .visitor_meta import QUERY_DOCUMENT_KEYS, VisitorMeta class Falsey(object): def __nonzero__(self): return False def __bool__(self): return False BREAK = object() REMOVE = Falsey() class Stack(object): __slots__ = 'in_array', '...
mit
80e47a655d9a4da4f4f32d5be227822d
26.893333
81
0.50733
4.313402
false
false
false
false
wandb/client
wandb/sklearn/calculate/learning_curve.py
1
1703
from warnings import simplefilter import numpy as np from sklearn import model_selection import wandb from wandb.sklearn import utils # ignore all future warnings simplefilter(action="ignore", category=FutureWarning) def learning_curve( model, X, y, cv=None, shuffle=False, random_state=None...
mit
8d4e15b74d970bb056aa60cf2762c46f
25.609375
86
0.630652
3.547917
false
true
false
false
wandb/client
wandb/sdk/internal/meta.py
1
10015
""" meta. """ from datetime import datetime import glob import json import logging import multiprocessing import os from shutil import copyfile import subprocess import sys from urllib.parse import unquote from wandb import util from wandb.vendor.pynvml import pynvml from ..lib.filenames import ( CONDA_ENVIRONME...
mit
3c7f7be65a5aabac383faef2c01136fe
36.092593
88
0.557963
4.193886
false
false
false
false
wandb/client
tests/unit_tests/tests_launch/test_launch_jobs.py
1
7412
import json import os import tempfile from unittest import mock import pytest import wandb from wandb.errors import CommError, LaunchError from wandb.sdk.data_types._dtypes import TypeRegistry import wandb.sdk.launch.launch as launch from wandb.sdk.launch.launch_add import launch_add import wandb.sdk.launch._project_s...
mit
e738b26bd750b56436945addc3baaafc
30.675214
106
0.565704
3.644051
false
true
false
false
wandb/client
wandb/vendor/pygments/formatters/html.py
25
31759
# -*- coding: utf-8 -*- """ pygments.formatters.html ~~~~~~~~~~~~~~~~~~~~~~~~ Formatter for HTML output. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import print_function import os import sys import os.path from ...
mit
aaf0925505cd5b976b9cf881fa606972
36.319624
86
0.537328
4.155849
false
false
false
false
wandb/client
wandb/sdk/service/service_sock.py
1
2369
"""socket service. Implement ServiceInterface for socket transport. """ from typing import TYPE_CHECKING from wandb.proto import wandb_server_pb2 as spb from .service_base import _pbmap_apply_dict from .service_base import ServiceInterface from ..lib.sock_client import SockClient if TYPE_CHECKING: from wandb.s...
mit
ad83da79f352dad7c478e489c57d5ef6
33.333333
83
0.678767
3.393983
false
false
false
false
wandb/client
wandb/vendor/watchdog/observers/api.py
16
11720
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com> # Copyright 2012 Google, 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 # # ...
mit
7c9bb4a6b6dec9ac27133b515412f346
30.761518
83
0.601195
4.451196
false
false
false
false
wandb/client
wandb/vendor/graphql-core-1.1/wandb_graphql/utils/extend_schema.py
3
14143
from collections import defaultdict from ..error import GraphQLError from ..language import ast from ..pyutils.ordereddict import OrderedDict from ..type.definition import (GraphQLArgument, GraphQLEnumType, GraphQLEnumValue, GraphQLField, GraphQLInputObject...
mit
6d60940d66cc993c88e5ac4aa98a1de3
38.616246
93
0.601216
4.404547
false
false
false
false