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
compas-dev/compas
src/compas/geometry/primitives/line.py
1
8729
from __future__ import print_function from __future__ import absolute_import from __future__ import division from compas.geometry.primitives import Primitive from compas.geometry.primitives import Point class Line(Primitive): """A line is defined by two points. Parameters ---------- p1 : [float, flo...
mit
f4218b0e697bd88269c35371f4aad946
27.249191
97
0.469584
4.283121
false
false
false
false
compas-dev/compas
src/compas/numerical/pca/pca_numpy.py
1
3099
from __future__ import print_function from __future__ import absolute_import from __future__ import division from numpy import asarray from scipy.linalg import svd __all__ = ["pca_numpy"] def pca_numpy(data): """Compute the principle components of a set of data points. Parameters ---------- data :...
mit
966a4361776cabef26bbd545250f1df4
33.433333
113
0.659245
4.262724
false
false
false
false
compas-dev/compas
src/compas_plotters/artists/lineartist.py
1
5285
from typing import Tuple from typing import List from typing import Any from typing_extensions import Literal from matplotlib.lines import Line2D from compas.geometry import Point, Line from compas.geometry import intersection_line_box_xy from compas.artists import PrimitiveArtist from .artist import PlotterArtist C...
mit
fda7ab11cafa9b41962b91ceb8ca2f6f
30.646707
119
0.541154
3.874633
false
false
false
false
compas-dev/compas
src/compas/datastructures/mesh/operations/swap.py
1
1584
from __future__ import print_function from __future__ import absolute_import from __future__ import division __all__ = ["trimesh_swap_edge"] def trimesh_swap_edge(mesh, u, v, allow_boundary=True): """Replace an edge of the mesh by an edge connecting the opposite vertices of the adjacent faces. Paramete...
mit
93701a6e7fd2b0402e968fbfc9afce8a
23
74
0.607323
3.155378
false
false
false
false
compas-dev/compas
src/compas/geometry/triangulation/__init__.py
1
2847
from __future__ import absolute_import from __future__ import division from __future__ import print_function import compas from compas.plugins import pluggable from .delaunay import * # noqa: F401 F403 if not compas.IPY: from .delaunay_numpy import * # noqa: F401 F403 @pluggable(category="triangulation") def...
mit
364124e063aaee8ead25d9313a8701cd
27.188119
111
0.67615
4.413953
false
false
false
false
compas-dev/compas
src/compas/geometry/booleans/__init__.py
1
2735
from __future__ import print_function from __future__ import absolute_import from __future__ import division from compas.plugins import pluggable __all__ = [ "boolean_union_mesh_mesh", "boolean_difference_mesh_mesh", "boolean_intersection_mesh_mesh", ] @pluggable(category="booleans") def boolean_union_m...
mit
a6bc33fe486944bb72be60bc129d27b6
28.408602
80
0.606947
3.793343
false
true
false
false
compas-dev/compas
src/compas_rhino/artists/meshartist.py
1
15412
from __future__ import print_function from __future__ import absolute_import from __future__ import division from compas.geometry import add_vectors from compas.geometry import scale_vector from compas.geometry import centroid_points import compas_rhino from compas.artists import MeshArtist from compas.colors import ...
mit
87c3490d6e9e3e8cdbbbca8fe6d1b76c
32.798246
120
0.521607
4.325568
false
false
false
false
widdowquinn/pyani
pyani/pyani_graphics/mpl/__init__.py
1
13772
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) The University of Strathclyde 2019 # Author: Leighton Pritchard # # Contact: # leighton.pritchard@strath.ac.uk # # Leighton Pritchard, # Strathclyde Institute of Pharmaceutical and Biomedical Sciences # The University of Strathclyde # Cathedral Street # Glasgow # G1 1...
mit
d6b1b4298e50a4fc5f1653d37750c186
32.754902
134
0.664246
3.443
false
false
false
false
compas-dev/compas
src/compas_rhino/uninstall.py
1
7893
from __future__ import absolute_import from __future__ import division from __future__ import print_function import itertools import os import sys import compas._os import compas.plugins import compas_rhino from compas_rhino.install import _run_post_execution_steps from compas_rhino.install import installable_rhino_p...
mit
d2e55bf9b2a0ec7372ac93de8c66114c
30.955466
111
0.60826
4.152025
false
false
false
false
widdowquinn/pyani
pyani/scripts/parsers/fastani_parser.py
1
6646
# -*- coding: utf-8 -*- # (c) The University of Strathclyde 2021–Present # Author: Bailey Harrington # # Contact: bailey.harrington@strath.ac.uk # # Bailey Harrington, # Strathclyde Institute for Pharmacy and Biomedical Sciences, # Cathedral Street, # Glasgow, # G4 0RE, # Scotland, # UK # # The MIT License # # Copyrigh...
mit
52040effbaaced03e63d23e85c4a8093
31.4
180
0.658838
3.868375
false
false
false
false
compas-dev/compas
src/compas/plugins.py
1
16185
# The COMPAS plugin system owes a lot to pluggy, the pytest plugin framework # There are portions of code loosely based on pluggy's # and while it is not strictly derivative work, we include # their license and copyright notice to give credit where credit is due. # # MIT license # Copyright (c) 2015 holger krekel (rath...
mit
be3fcba9657a0a1aa86f4f09701f3ccb
31.049505
119
0.598826
4.725547
false
false
false
false
compas-dev/compas
src/compas_rhino/artists/curveartist.py
1
1467
from __future__ import print_function from __future__ import absolute_import from __future__ import division import compas_rhino from compas.artists import CurveArtist from compas.colors import Color from .artist import RhinoArtist class CurveArtist(RhinoArtist, CurveArtist): """Artist for drawing curves. P...
mit
0a79d97a0ddaa0dcbb319b11769c69ee
30.891304
107
0.630539
3.912
false
false
false
false
compas-dev/compas
src/compas_ghpython/artists/networkartist.py
1
3612
from __future__ import print_function from __future__ import absolute_import from __future__ import division import compas_ghpython from compas.artists import NetworkArtist from .artist import GHArtist class NetworkArtist(GHArtist, NetworkArtist): """Artist for drawing network data structures. Parameters ...
mit
266107c8687ba42b7abe94875b733a7d
32.137615
120
0.564507
4.3
false
false
false
false
compas-dev/compas
src/compas_blender/artists/lineartist.py
1
3209
from typing import Any from typing import List from typing import Optional from typing import Union import bpy import compas_blender from compas.artists import PrimitiveArtist from compas.geometry import Line from compas.colors import Color from compas_blender.artists import BlenderArtist class LineArtist(BlenderAr...
mit
7773c293853baf3e2beb224510937a3f
28.172727
107
0.552197
4.26162
false
false
false
false
compas-dev/compas
src/compas_blender/artists/polygonartist.py
1
3475
from typing import Any from typing import List from typing import Optional from typing import Union import bpy import compas_blender from compas.artists import PrimitiveArtist from compas.geometry import Polygon from compas.colors import Color from .artist import BlenderArtist class PolygonArtist(BlenderArtist, Pri...
mit
091b204cfaceab754f2d36e059e6f8e7
30.880734
119
0.577554
4.327522
false
false
false
false
widdowquinn/pyani
pyani/scripts/parsers/anib_parser.py
1
3857
# -*- coding: utf-8 -*- # (c) The James Hutton Institute 2016-2019 # (c) University of Strathclyde 2019-2020 # Author: Leighton Pritchard # # Contact: # leighton.pritchard@strath.ac.uk # # Leighton Pritchard, # Strathclyde Institute for Pharmacy and Biomedical Sciences, # Cathedral Street, # Glasgow, # G4 0RE # Scotlan...
mit
3f410fcd4472fe14b21cfe5bbd358111
31.141667
85
0.680581
3.947799
false
false
false
false
compas-dev/compas
src/compas/robots/model/geometry.py
1
13651
from __future__ import absolute_import from __future__ import division from __future__ import print_function import compas import compas.colors import compas.geometry from compas.data import Data from compas.datastructures import Mesh from compas.files.urdf import URDFElement from compas.geometry import Frame from com...
mit
19be17f66c2ba006496e7a001be7ee24
27.030801
101
0.598271
3.895833
false
false
false
false
widdowquinn/pyani
pyani/pyani_config.py
1
6882
# -*- coding: utf-8 -*- # (c) The James Hutton Institute 2017-2019 # (c) The University of Strathclude 2019-2020 # Author: Leighton Pritchard # # Contact: # leighton.pritchard@strath.ac.uk # # Leighton Pritchard, # Strathclyde Institute of Pharmaceutical and Biomedical Sciences # The University of Strathclyde # 161 Cat...
mit
b54cd41f3726755764342ae0af74e1b2
33.757576
88
0.635426
2.782855
false
false
false
false
compas-dev/compas
src/compas_blender/geometry/booleans/__init__.py
1
3103
import bpy from compas.plugins import plugin @plugin(category="booleans", requires=["bpy"]) def boolean_union_mesh_mesh(A, B, remesh=False): """Compute the boolean union of two triangle meshes. Parameters ---------- A : tuple[sequence[[float, float, foat], :class:`~compas.geometry.Point`], sequence[[...
mit
812117310531fdb8bf3aea6a0108dc9e
33.477778
105
0.643248
3.61655
false
false
false
false
compas-dev/compas
src/compas/geometry/_core/tangent.py
1
1429
from __future__ import print_function from __future__ import absolute_import from __future__ import division from math import sqrt __all__ = ["tangent_points_to_circle_xy"] def tangent_points_to_circle_xy(circle, point): """Calculates the tangent points on a circle in the XY plane. Parameters --------...
mit
579607244628dec9015f087345547a65
23.637931
85
0.521344
2.824111
false
false
false
false
compas-dev/compas
src/compas/datastructures/mesh/explode.py
1
2092
from __future__ import print_function from __future__ import absolute_import from __future__ import division from compas.topology import connected_components __all__ = [ "mesh_disconnected_vertices", "mesh_disconnected_faces", "mesh_explode", ] def mesh_disconnected_vertices(mesh): """Get the discon...
mit
91861e37e4f29d2a5bdd23cc4eb72a52
26.526316
95
0.641491
3.866913
false
false
false
false
compas-dev/compas
src/compas/datastructures/network/transformations.py
1
1548
from __future__ import print_function from __future__ import absolute_import from __future__ import division from compas.geometry import transform_points __all__ = [ "network_transform", "network_transformed", ] def network_transform(network, transformation): """Transform a network. Parameters ...
mit
4870daee6ef905a6762b2b4a012b6489
22.815385
73
0.641473
4.448276
false
false
false
false
widdowquinn/pyani
pyani/scripts/subcommands/subcmd_anib.py
1
11681
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # (c) The James Hutton Institute 2017-2019 # (c) University of Strathclyde 2019-2020 # Author: Leighton Pritchard # # Contact: # leighton.pritchard@strath.ac.uk # # Leighton Pritchard, # Strathclyde Institute for Pharmacy and Biomedical Sciences, # 161 Cathedral Street, # ...
mit
360659312628c244dc2fed60dfadcb53
37.04886
90
0.677425
3.93035
false
false
false
false
compas-dev/compas
src/compas_rhino/conversions/cylinder.py
1
2373
from __future__ import print_function from __future__ import absolute_import from __future__ import division import Rhino from compas.geometry import Cylinder from ._exceptions import ConversionError from ._shapes import cylinder_to_rhino from ._shapes import cylinder_to_compas from ._geometry import RhinoGeometry...
mit
01381d72562dd3c463ceb3b26e0bc8fc
32.9
111
0.584914
4.625731
false
false
false
false
compas-dev/compas
src/compas_ghpython/artists/vectorartist.py
1
2281
from __future__ import absolute_import from __future__ import division from __future__ import print_function import compas_ghpython from compas.artists import PrimitiveArtist from compas.geometry import Point from compas.colors import Color from .artist import GHArtist class VectorArtist(GHArtist, PrimitiveArtist):...
mit
bf28874e6b19c94bedd84b8457ddab24
31.585714
114
0.578255
4.102518
false
false
false
false
widdowquinn/pyani
pyani/download.py
1
19501
# -*- coding: utf-8 -*- # (c) The James Hutton Institute 2016-2019 # (c) University of Strathclyde 2019-2021 # Author: Leighton Pritchard # # Contact: # leighton.pritchard@strath.ac.uk # # Leighton Pritchard, # Strathclyde Institute for Pharmacy and Biomedical Sciences, # Cathedral Street, # Glasgow, # G1 1XQ # Scotlan...
mit
4275fdd834e77928c4831dea2e9b6692
30.453226
91
0.668222
3.74731
false
false
false
false
compas-dev/compas
src/compas/artists/curveartist.py
1
1423
from __future__ import print_function from __future__ import absolute_import from __future__ import division from compas.colors import Color from .artist import Artist class CurveArtist(Artist): """Base class for artists for curves. Parameters ---------- curve: :class:`~compas.geometry.Curve` ...
mit
fee48fc520ab6237a6861c51c3617472
22.716667
80
0.593816
4.100865
false
false
false
false
cfelton/rhea
rhea/system/clock.py
2
2529
from __future__ import division import myhdl from myhdl import instance, delay _clock_num = 0 _clock_list = [] class Clock(myhdl.SignalType): timescale = '1ns' def __init__(self, val, frequency=1): """ This is a clock object, it is a thin wrapper around the myhdl.Signal object and ...
mit
1a96953c048dcce964fbf87c516f23df
26.48913
79
0.552392
4.05939
false
false
false
false
cfelton/rhea
test/test_cores/test_fifo/test_fifo_mem.py
1
7095
from random import randint import pytest import myhdl from myhdl import Signal, ResetSignal, intbv, modbv, always_seq from myhdl import instance, delay, StopSimulation from myhdl.conversion import analyze, verify from rhea.system import Signals from rhea.cores.fifo.fifo_mem import fifo_mem def test_fifo_mem_conve...
mit
b3cc9e9d00158c5bf4081278dfde379d
27.38
76
0.565751
3.370546
false
false
false
false
zzzeek/alembic
alembic/operations/batch.py
2
26563
from __future__ import annotations from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import TYPE_CHECKING from typing import Union from sqlalchemy import CheckConstraint from sqlalchemy import Column from sqlalchemy import ForeignKe...
mit
4b623c83b2f12d885b5c49a9fb037313
36.360056
94
0.540338
4.43012
false
false
false
false
cfelton/rhea
rhea/cores/misc/serio.py
2
3995
import myhdl from myhdl import Signal, intbv, always_seq, always_comb, concat @myhdl.block def io_stub(clock, reset, sdi, sdo, port_inputs, port_outputs, valid): """ Port emulators, serial to parallel input / output This module is a port emulator, a single input and single output will be serialized into...
mit
eb1b48b53de62d9944788aeb7d1c2bf7
31.217742
75
0.579725
3.519824
false
false
false
false
cfelton/rhea
rhea/cores/spi/cso.py
2
2935
import myhdl from myhdl import intbv from rhea import Constants from rhea.system import Bit, Byte from rhea.system import ControlStatusBase from ..misc import assign class ControlStatus(ControlStatusBase): def __init__(self): """ The control-status object for the SPI controller Attributes: ...
mit
57a1b396144392665897297754eca788
29.257732
72
0.572743
3.955526
false
true
false
false
cfelton/rhea
test/test_system/test_regfile_api.py
2
1706
import myhdl from myhdl import Signal from rhea import Global from rhea.system import RegisterFile, Register from rhea.system import Barebone from rhea.cores.misc import led_blinker from rhea.cores.misc import button_controller, button_debounce def create_regfile(): # create a register file regfile = Regist...
mit
4c81df32e0bd6365450770be9f6a2e7a
26.516129
73
0.684056
3.325536
false
false
false
false
zzzeek/alembic
alembic/operations/base.py
2
19041
from __future__ import annotations from contextlib import contextmanager import re import textwrap from typing import Any from typing import Callable from typing import Dict from typing import Iterator from typing import List # noqa from typing import Mapping from typing import Optional from typing import Sequence #...
mit
bfa6b80770ab371b6a06bf13e2d432b2
35.407266
79
0.618875
4.63172
false
false
false
false
cfelton/rhea
rhea/utils/command_packet.py
2
3355
import struct from myhdl import now, delay # packet definition constants PACKET_LENGTH = 12 DATA_OFFSET = 8 class CommandPacket(object): def __init__(self, rnw=True, address=0, vals=None): """ """ assert isinstance(vals, (type(None), list)) self.rawbytes = bytearray([0 for _ in range(PAC...
mit
29875b99ec6cc9134d9542b7874c8493
31.892157
80
0.558867
3.666667
false
false
false
false
cfelton/rhea
rhea/system/memmap/avalonmm.py
1
7210
# # Copyright (c) 2014-2015 Christopher L. Felton # from __future__ import absolute_import import myhdl from myhdl import (Signal, intbv, always_seq, always, always_comb, instances, enum, delay, concat) from .. import Clock from .. import Reset from . import MemoryMapped from . import Barebone c...
mit
abcb877e2602b34157f3492641974011
32.691589
77
0.518724
4.039216
false
false
false
false
cfelton/rhea
rhea/system/stream/streamers.py
2
1924
class Streamers(object): def __init__(self, glbl, data_width=32): """ Base class for the streaming interfaces """ # @todo: need upstream and downstream clocks and resets self.clock = glbl.clock self.reset = glbl.reset self.data_width = data_width # transact...
mit
b1598883525e52debc1d527b640763b8
26.884058
71
0.551975
4.613909
false
false
false
false
cfelton/rhea
examples/build/board_build_example.py
2
1964
""" This file contains a general function to run the build for various boards. >> python example_build_boards.py --board=<board name> """ import argparse import rhea.build as build from rhea.build.boards import get_board from rhea.build.boards import get_all_board_names from test_boards import led_port_pin_map...
mit
026f10dc6296980d4a51c4fed4332df2
25.186667
75
0.553462
3.577413
false
false
false
false
zzzeek/alembic
alembic/util/pyfiles.py
2
3374
from __future__ import annotations import atexit from contextlib import ExitStack import importlib import importlib.machinery import importlib.util import os import re import tempfile from typing import Optional from mako import exceptions from mako.template import Template from . import compat from .exc import Comm...
mit
2d715af18afa4cd037a858867af98349
29.396396
127
0.632484
3.932401
false
false
false
false
zzzeek/alembic
alembic/autogenerate/api.py
2
20646
from __future__ import annotations import contextlib from typing import Any from typing import Callable from typing import Dict from typing import Iterator from typing import Optional from typing import Set from typing import Tuple from typing import TYPE_CHECKING from typing import Union from sqlalchemy import inspe...
mit
9bd6116fe8e3a87b3d3d687fd39596e5
33.01318
79
0.614938
4.544574
false
false
false
false
cfelton/rhea
rhea/build/toolflow/lattice/iceriver.py
2
4021
from __future__ import absolute_import from __future__ import print_function import os import subprocess import shlex from ..toolflow import ToolFlow from ..convert import convert from ..yosys import Yosys from rhea.build.extintf import Clock class IceRiver(Yosys): _name = "Open-source Lattice iCE40" def ...
mit
24438f53b213586702b474ae67762001
36.231481
74
0.532952
3.539613
false
false
false
false
cfelton/rhea
examples/boards/icestick/icestick_blinky_host.py
2
3279
import argparse import subprocess import myhdl from myhdl import Signal, intbv, always_seq, always_comb from rhea.cores.uart import uartlite from rhea.cores.memmap import command_bridge from rhea.cores.misc import glbl_timer_ticks from rhea.system import Global, Clock from rhea.system import Barebone from rhea.syst...
mit
d44e61c04b1d8a7f19b63d3cb7f2dac7
24.818898
72
0.622751
3.295477
false
false
false
false
cfelton/rhea
rhea/build/boards/xilinx/_atlys.py
1
1343
from rhea.build import FPGA from rhea.build.toolflow import ISE class Atlys(FPGA): vendor = 'xilinx' family = 'spartan6' device = 'XC6SLX45' package = 'CSG324' speed = -3 _name = 'atlys' default_clocks = { 'clock': dict(frequency=50e6, pins=('L15',)), } default_res...
mit
be9e57d0cf21d434c3bb43698a68301d
28.866667
74
0.481757
2.96468
false
false
false
false
cfelton/rhea
rhea/build/boards/xilinx/zybo.py
1
2247
from rhea.build import FPGA from rhea.build.toolflow import Vivado class Zybo(FPGA): vendor = 'xilinx' family = 'zynq' device = 'XC7Z010' package = 'CLG400' speed = -1 _name = 'zybo' default_clocks = { 'clock': dict(frequency=125e6, pins=('L16',), iostan...
mit
57479b15e0c555534288c2975d9f8895
33.045455
73
0.453939
2.952694
false
false
false
false
cfelton/rhea
examples/boards/parallella/test_serdes/parallella_serdes.py
1
3091
from __future__ import print_function, division import argparse from pprint import pprint import myhdl from myhdl import Signal, intbv, ConcatSignal, always_comb, concat from rhea.system import Global, Clock, Reset from rhea.cores.misc import io_stub from rhea.cores.comm import prbs_generate from rhea.cores.comm im...
mit
1ce921c3625d88a547722cbff4639d42
27.1
74
0.629893
3.115927
false
false
false
false
cfelton/rhea
rhea/build/toolflow/yosys.py
2
2997
# # Copyright (c) 2015 Christopher Felton # from __future__ import print_function, division, absolute_import import os from .toolflow import ToolFlow from .convert import convert class Yosys(ToolFlow): _name = "yosys" def __init__(self, brd, top=None, path='yosys/'): """ use yosys synthesis (mainl...
mit
5468162c75ac4ce86b4537d999c2719c
33.848837
99
0.503837
3.615199
false
false
false
false
mozillazg/python-pinyin
pypinyin/style/__init__.py
1
2060
# -*- coding: utf-8 -*- from functools import wraps # 存储各拼音风格对应的实现 _registry = {} def convert(pinyin, style, strict, default=None, **kwargs): """根据拼音风格把原始拼音转换为不同的格式 :param pinyin: 原始有声调的单个拼音 :type pinyin: unicode :param style: 拼音风格 :param strict: 只获取声母或只获取韵母相关拼音风格的返回结果 是否严格遵照《...
mit
0e7125973d862ce495c05081f9aed42c
20.150685
64
0.569948
1.887531
false
false
false
false
wummel/dosage
dosagelib/util.py
2
18118
# -*- coding: iso-8859-1 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam from __future__ import division, print_function try: from urllib.parse import quote as url_quote, unquote as url_unquote except ImportError: from urllib import quote as url_q...
mit
86b57c74226335bbf6e69103bfe8f66b
29.760611
113
0.627718
3.743388
false
false
false
false
wummel/dosage
dosagelib/plugins/w.py
3
8807
# -*- coding: iso-8859-1 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam from re import compile, escape, IGNORECASE from ..scraper import _BasicScraper from ..util import tagre from ..helpers import indirectStarter class WapsiSquare(_BasicScraper): ...
mit
28cc39da8850b1fdf40e32922f4d8e33
35.543568
140
0.603497
2.902769
false
false
false
false
wummel/dosage
scripts/comicfury.py
3
13660
#!/usr/bin/env python # Copyright (C) 2013-2014 Bastian Kleineidam """ Script to get arcamax comics and save the info in a JSON file for further processing. """ from __future__ import print_function import codecs import re import sys import os import requests sys.path.append(os.path.join(os.path.dirname(__file__), ".."...
mit
cb3d86a1ca99cfa2e85f324b1c3e4b9b
38.825073
174
0.681406
3.492713
false
false
false
false
pytest-dev/pytest-xdist
testing/test_newhooks.py
1
4462
import pytest class TestHooks: @pytest.fixture(autouse=True) def create_test_file(self, pytester: pytest.Pytester) -> None: pytester.makepyfile( """ import os def test_a(): pass def test_b(): pass def test_c(): pass """ ) ...
mit
9b2948a390396f95c850a217b02d7c3b
35.876033
92
0.49238
4.112442
false
true
false
false
tomerfiliba/plumbum
plumbum/cli/progress.py
1
8374
""" Progress bar ------------ """ import datetime import sys import warnings from abc import ABC, abstractmethod from plumbum.cli.termsize import get_terminal_size class ProgressBase(ABC): """Base class for progress bars. Customize for types of progress bars. :param iterator: The iterator to wrap with a pr...
mit
8f049d4467ee4b4cc27c7ec914b7c42d
29.786765
121
0.581681
4.164097
false
false
false
false
radish-bdd/radish
radish/customtyperegistry.py
1
2193
# -*- coding: utf-8 -*- """ This module provides the Argument-Expression Registry """ from singleton import singleton from .exceptions import RadishError from parse_type import TypeBuilder @singleton() class CustomTypeRegistry(object): """ Registry for all custom argument expressions """ def ...
mit
d5f46bab0931e18dfeae762e803aa525
20.93
96
0.600547
3.937163
false
false
false
false
pypa/setuptools
pkg_resources/_vendor/importlib_resources/_adapters.py
16
4504
from contextlib import suppress from io import TextIOWrapper from . import abc class SpecLoaderAdapter: """ Adapt a package spec to adapt the underlying loader. """ def __init__(self, spec, adapter=lambda spec: spec.loader): self.spec = spec self.loader = adapter(spec) def __get...
mit
36dc2830fca89166aa8bd38dc1f36a70
25.494118
87
0.571714
4.277303
false
false
false
false
pypa/setuptools
pkg_resources/_vendor/importlib_resources/_legacy.py
14
3494
import functools import os import pathlib import types import warnings from typing import Union, Iterable, ContextManager, BinaryIO, TextIO, Any from . import _common Package = Union[types.ModuleType, str] Resource = str def deprecated(func): @functools.wraps(func) def wrapper(*args, **kwargs): war...
mit
af54ec8038af3261bc8e27a35d1d6040
27.876033
80
0.672295
4.025346
false
false
false
false
pypa/setuptools
pkg_resources/__init__.py
2
108568
""" Package resource API -------------------- A resource is a logical file contained within a package, or a logical subdirectory thereof. The package resource API expects resource names to have their path parts separated with ``/``, *not* whatever the local path separator is. Do not use os.path operations to manipul...
mit
8df5ccebf63b69d15d3c1ca4f668263b
31.938714
85
0.60296
4.257657
false
false
false
false
pypa/setuptools
pkg_resources/_vendor/packaging/markers.py
6
8496
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. import operator import os import platform import sys from typing import Any, Callable, Dict, List, Optional, Tuple, Union from pkg_resourc...
mit
43562f380438b266ab2e5da1ab7a9190
26.947368
81
0.610169
3.724682
false
false
false
false
beerfactory/hbmqtt
samples/client_publish.py
1
1830
import logging import asyncio from hbmqtt.client import MQTTClient, ConnectException from hbmqtt.mqtt.constants import QOS_1, QOS_2 # # This sample shows how to publish messages to broker using different QOS # Debug outputs shows the message flows # logger = logging.getLogger(__name__) config = { 'will': { ...
mit
139a632e996bbf41e8d446e0d578c324
30.016949
94
0.639344
3.171577
false
true
false
false
pypa/setuptools
setuptools/_vendor/packaging/requirements.py
3
4700
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. import re import string import urllib.parse from typing import List, Optional as TOptional, Set from setuptools.extern.pyparsing import ( ...
mit
ed43cb2a55fbc34ccb0ab09e932fe165
31.191781
95
0.649787
3.607061
false
false
false
false
pypa/setuptools
pkg_resources/_vendor/pyparsing/common.py
18
12936
# common.py from .core import * from .helpers import delimited_list, any_open_tag, any_close_tag from datetime import datetime # some other useful expressions - using lower-case class name since we are really using this as a namespace class pyparsing_common: """Here are some common low-level expressions that may ...
mit
ae893b89de18b831f955a0321be6c2d8
29.509434
156
0.538961
3.437683
false
false
false
false
pypa/setuptools
setuptools/_vendor/pyparsing/testing.py
12
13402
# testing.py from contextlib import contextmanager import typing from .core import ( ParserElement, ParseException, Keyword, __diag__, __compat__, ) class pyparsing_test: """ namespace class for classes useful in writing unit tests """ class reset_pyparsing_context: """ ...
mit
4b1418a0a47408fc19c9f8a8d9701818
39.465257
120
0.51874
4.747962
false
true
false
false
pypa/setuptools
setuptools/_distutils/command/clean.py
1
2595
"""distutils.command.clean Implements the Distutils 'clean' command.""" # contributed by Bastian Kleineidam <calvin@cs.uni-sb.de>, added 2000-03-18 import os from ..core import Command from ..dir_util import remove_tree from distutils._log import log class clean(Command): description = "clean up temporary fil...
mit
01b509fbbf8a77218fad570e1b86b57e
33.144737
88
0.561079
4.017028
false
false
false
false
pypa/setuptools
setuptools/tests/test_sandbox.py
3
4249
"""develop tests """ import os import types import pytest import pkg_resources import setuptools.sandbox class TestSandbox: def test_devnull(self, tmpdir): with setuptools.sandbox.DirectorySandbox(str(tmpdir)): self._file_writer(os.devnull) @staticmethod def _file_writer(path): ...
mit
faaf93b2de8ef565107a4250a4a4fca2
30.708955
79
0.612615
4.403109
false
true
false
false
pypa/setuptools
setuptools/_vendor/more_itertools/recipes.py
12
16256
"""Imported from the recipes section of the itertools documentation. All functions taken from the recipes section of the itertools library docs [1]_. Some backward-compatible usability improvements have been made. .. [1] http://docs.python.org/library/itertools.html#recipes """ import warnings from collections impor...
mit
f6c8c5d4c69800efeaa9b3ac295f7ce3
25.219355
79
0.577325
3.602837
false
false
false
false
pypa/setuptools
setuptools/_distutils/command/install_egg_info.py
1
2788
""" distutils.command.install_egg_info Implements the Distutils 'install_egg_info' command, for installing a package's PKG-INFO metadata. """ import os import sys import re from ..cmd import Command from .. import dir_util from .._log import log class install_egg_info(Command): """Install an .egg-info file for...
mit
ea258ebcdaccc0857abd071364f0a71b
29.304348
81
0.628766
3.861496
false
false
false
false
beerfactory/hbmqtt
samples/client_subscribe.py
1
1391
import logging import asyncio from hbmqtt.client import MQTTClient, ClientException from hbmqtt.mqtt.constants import QOS_1, QOS_2 # # 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 ...
mit
5e328f29b7fca854dacaf4fd0d856380
32.119048
100
0.65133
3.443069
false
false
false
false
pypa/setuptools
pkg_resources/_vendor/importlib_resources/tests/test_reader.py
7
4286
import os.path import sys import pathlib import unittest from importlib import import_module from importlib_resources.readers import MultiplexedPath, NamespaceReader class MultiplexedPathTest(unittest.TestCase): @classmethod def setUpClass(cls): path = pathlib.Path(__file__).parent / 'namespacedata01...
mit
238fae33a1e4536a19bfb96293acd23e
32.484375
88
0.604526
4.001867
false
true
false
false
pypa/setuptools
setuptools/dist.py
1
45252
__all__ = ['Distribution'] import io import sys import re import os import warnings import numbers import distutils.log import distutils.core import distutils.cmd import distutils.dist import distutils.command from distutils.util import strtobool from distutils.debug import DEBUG from distutils.fancy_getopt import tra...
mit
8923bb26bc513df5d4ae5b2dee9ad264
36.305853
88
0.602294
4.320825
false
false
false
false
pypa/setuptools
setuptools/_vendor/zipp.py
15
8425
import io import posixpath import zipfile import itertools import contextlib import sys import pathlib if sys.version_info < (3, 7): from collections import OrderedDict else: OrderedDict = dict __all__ = ['Path'] def _parents(path): """ Given a path with elements separated by posixpath.sep, gen...
mit
414d5dd8cf927fd67bdb836849911288
24.516717
78
0.579869
3.831584
false
false
false
false
pypa/setuptools
setuptools/_distutils/spawn.py
1
3495
"""distutils.spawn Provides the 'spawn()' function, a front-end to various platform- specific functions for launching another program in a sub-process. Also provides the 'find_executable()' to search the path for a given executable name. """ import sys import os import subprocess from .errors import DistutilsExecErr...
mit
30411d7f7832eb453e4c66b29cd971c6
31.06422
80
0.632046
3.980638
false
false
false
false
pypa/setuptools
tools/finalize.py
2
2397
""" Finalize the repo for a release. Invokes towncrier and bumpversion. """ __requires__ = ['bump2version', 'towncrier'] import subprocess import pathlib import re import sys def release_kind(): """ Determine which release to make based on the files in the changelog. """ # use min here as 'majo...
mit
335b94bd038ab6916319cd90a5502a14
22.5
83
0.597831
3.551111
false
false
false
false
pypa/setuptools
setuptools/installer.py
3
3824
import glob import os import subprocess import sys import tempfile import warnings from distutils import log from distutils.errors import DistutilsError import pkg_resources from setuptools.wheel import Wheel from ._deprecation_warning import SetuptoolsDeprecationWarning def _fixup_find_links(find_links): """Ens...
mit
814784eb57dc6f8beca5066541cbc700
35.769231
79
0.637552
3.946336
false
false
false
false
locustio/locust
examples/grpc/locustfile.py
2
2631
# make sure you use grpc version 1.39.0 or later, # because of https://github.com/grpc/grpc/issues/15880 that affected earlier versions import grpc import hello_pb2_grpc import hello_pb2 from locust import events, User, task from locust.exception import LocustError from locust.user.task import LOCUST_STATE_STOPPING fro...
mit
fe8db4c080874a18aaa83f16cc4bc3e0
31.481481
93
0.613835
3.903561
false
false
false
false
locustio/locust
locust/user/inspectuser.py
1
2641
from collections import defaultdict import inspect from json import dumps from typing import List, Type, Dict from .task import TaskSet from .users import User def print_task_ratio(user_classes, num_users, total): """ This function calculates the task ratio of users based on the user total count. """ ...
mit
4692f22f963b3321ede10935f8e6b568
32.0125
120
0.625142
3.240491
false
false
false
false
nicodv/kmodes
kmodes/util/dissim.py
1
3473
""" Dissimilarity measures for clustering """ import numpy as np def matching_dissim(a, b, **_): """Simple matching dissimilarity function""" return np.sum(a != b, axis=1) def jaccard_dissim_binary(a, b, **__): """Jaccard dissimilarity function for binary encoded variables""" if ((a == 0) | (a == 1...
mit
57a6f08ed613062cc35582463641207c
39.858824
83
0.608408
3.368574
false
false
false
false
locustio/locust
locust/user/users.py
1
9184
from __future__ import annotations from typing import Callable, Dict, List, Optional from gevent import GreenletExit, greenlet from gevent.pool import Group from typing_extensions import final from urllib3 import PoolManager from locust.clients import HttpSession from locust.exception import LocustError, StopUser fro...
mit
8074f3c6eea87a8762692fb9db3c4c43
35.15748
145
0.645035
4.281585
false
false
false
false
nicodv/kmodes
examples/soybean.py
1
1429
#!/usr/bin/env python import numpy as np from kmodes.kmodes import KModes # reproduce results on small soybean data set x = np.genfromtxt('soybean.csv', dtype=int, delimiter=',')[:, :-1] y = np.genfromtxt('soybean.csv', dtype=str, delimiter=',', usecols=(35, )) kmodes_huang = KModes(n_clusters=4, init='Huang', verbo...
mit
03595ce0868cbcdff0747cd83f75c4a0
33.853659
88
0.63331
2.753372
false
false
false
false
locustio/locust
locust/input_events.py
2
3048
from typing import Dict, Callable import gevent import logging import os import sys if os.name == "nt": from win32api import STD_INPUT_HANDLE from win32console import ( GetStdHandle, KEY_EVENT, ENABLE_ECHO_INPUT, ENABLE_LINE_INPUT, ENABLE_PROCESSED_INPUT, ) else: ...
mit
3f6b806976368e9570b4ee702fd420d7
25.973451
107
0.55479
4.021108
false
false
false
false
locustio/locust
examples/extend_web_ui/extend.py
2
4530
""" This is an example of a locustfile that uses Locust's built in event and web UI extension hooks to track the sum of the content-length header in all successful HTTP responses and display them in the web UI. """ import os from time import time from html import escape from locust import HttpUser, TaskSet, task, web,...
mit
3ab34a03f36dfcd75ac04a1b786994fb
33.06015
125
0.587638
4.314286
false
false
false
false
locustio/locust
locust/user/sequential_taskset.py
1
2542
import logging from locust.exception import LocustError from .task import TaskSet, TaskSetMeta class SequentialTaskSetMeta(TaskSetMeta): """ Meta class for SequentialTaskSet. It's used to allow SequentialTaskSet classes to specify task execution in both a list as the tasks attribute or using the @task dec...
mit
4f249ca129a258e057626be01bd71bbc
40
113
0.632966
4.323129
false
false
false
false
locustio/locust
locust/argument_parser.py
1
23418
import os import platform import sys import textwrap from typing import Dict, List import configargparse import locust version = locust.__version__ DEFAULT_CONFIG_FILES = ["~/.locust.conf", "locust.conf"] class LocustArgumentParser(configargparse.ArgumentParser): """Drop-in replacement for `configargparse.Ar...
mit
883cdaa99157d204242db1e8bee12c0f
35.604069
244
0.614964
3.943686
false
false
false
false
hydralabs/pyamf
pyamf/remoting/amf3.py
6
7128
# Copyright (c) The PyAMF Project. # See LICENSE.txt for details. """ AMF3 RemoteObject support. @see: U{RemoteObject on Adobe Help (external) <http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/rpc/ remoting/RemoteObject.html>} @since: 0.1 """ import calendar import time import uuid impo...
mit
9ecea04f6b78e0293c85bfb5fc01c7f5
26.84375
79
0.605499
4.110727
false
false
false
false
hydralabs/pyamf
doc/tutorials/examples/actionscript/socket/python/client.py
8
1800
# Copyright (c) The PyAMF Project. # See LICENSE for details. """ Python client for socket example. @since: 0.5 """ import socket import pyamf from server import appPort, host class AmfSocketClient(object): def __init__(self): self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def con...
mit
5f6d27c3970b3bec56a41c7ce59afce5
22.376623
69
0.563889
3.896104
false
false
false
false
qtile/qtile
libqtile/widget/clock.py
2
3447
# Copyright (c) 2010 Aldo Cortesi # Copyright (c) 2012 Andrew Grigorev # Copyright (c) 2014 Sean Vig # Copyright (c) 2014 Tycho Andersen # # 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 with...
mit
1f2a6ed04764ab4cd7eb5b4444248af4
37.3
82
0.656223
4.245074
false
false
false
false
qtile/qtile
test/widgets/docs_screenshots/conftest.py
1
6854
# Copyright (c) 2021 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
ecd8fc729049332b10b0d17c89092067
33.791878
110
0.637876
3.980256
false
true
false
false
qtile/qtile
libqtile/scripts/check.py
2
5124
# Copyright (c) 2020, Tycho Andersen. 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, modif...
mit
6f9d4cfca59bad6a885045848941af21
32.058065
83
0.641686
4.069897
false
true
false
false
qtile/qtile
libqtile/widget/wallpaper.py
2
4047
# Copyright (c) 2015 Muhammed Abuali # # 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, dis...
mit
2dbc7e83cea707df854c7e220a2b8500
36.12844
97
0.612305
4.087879
false
false
false
false
movidius/ncappzoo
networks/age_gender_net/age_gender_net.py
1
4350
#! /usr/bin/env python3 # Copyright(c) 2017 Intel Corporation. # License: MIT See LICENSE file in root directory. import sys import numpy import cv2 import argparse GREEN = '\033[1;32m' RED = '\033[1;31m' NOCOLOR = '\033[0m' YELLOW = '\033[1;33m' AGE_OUTPUT_LAYER = 'age_conv3' GENDER_OUTPUT_LAYER = 'prob' GENDER_...
mit
2f339918d3ceef7116dbeff5c15142c2
37.486726
209
0.610025
3.342813
false
false
false
false
movidius/ncappzoo
networks/tiny_yolo_v3/Tiny_yolo_v3_object_detector.py
1
12969
from openvino.inference_engine import IENetwork, IECore import numpy import cv2 import sys sys.path.append('../../shared/Python/') from Object_detector import * class Tiny_yolo_v3_object_detector(Object_detector): def __init__(self, ie, # type: IECore net, # type: I...
mit
a7dbfb3bda6c6d75bde07190db80a3c4
49.660156
165
0.58794
4.061697
false
false
false
false
movidius/ncappzoo
networks/tiny_yolo_v3/tiny_yolo_v3.py
1
15480
# Copyright(c) 2017 Intel Corporation. # License: MIT See LICENSE file in root directory. GREEN = '\033[1;32m' RED = '\033[1;31m' NOCOLOR = '\033[0m' YELLOW = '\033[1;33m' DEVICE = "MYRIAD" try: from openvino.inference_engine import IENetwork, IECore except: print(RED + '\nPlease make sure your OpenVINO en...
mit
c1232fa6608cd1505f1a17fef72b915a
45.068452
209
0.617546
3.657609
false
false
false
false
redis/redis-py
tests/test_asyncio/test_lock.py
2
8730
import asyncio import pytest import pytest_asyncio from redis.asyncio.lock import Lock from redis.exceptions import LockError, LockNotOwnedError class TestLock: @pytest_asyncio.fixture() async def r_decoded(self, create_redis): redis = await create_redis(decode_responses=True) yield redis ...
mit
df7c50dc021dd153ab5defbacb487ac2
36.307692
77
0.615693
3.65731
false
true
false
false
gwu-libraries/sfm-ui
sfm/ui/export.py
2
3371
import logging from django.utils import timezone from django.template.loader import get_template from .models import Export from .utils import diff_collection_and_seeds_history from .rabbit import RabbitWorker from sfmutils.utils import datetime_now log = logging.getLogger(__name__) def export_receiver(sender, **k...
mit
073e25c2c3d1a128e5dd8ae5c2e7e37b
31.728155
111
0.657075
3.961222
false
false
false
false
gwu-libraries/sfm-ui
sfm/ui/test_forms.py
1
15328
from datetime import datetime import pytz from django.contrib.auth.models import Group from django.test import TestCase, RequestFactory from .forms import CollectionSetForm, ExportForm, CredentialWeiboForm, CredentialFlickrForm, \ CredentialTwitterForm, CredentialTwitter2Form, CollectionTwitterSearchForm, SeedTwi...
mit
74aa1328078dcfbc77f4928ebbbc92c1
44.48368
108
0.538948
4.439039
false
true
false
false
adrn/gala
gala/dynamics/actionangle/tests/test_analyticactionangle.py
1
6033
# Third-party import numpy as np import astropy.units as u # Project from gala.dynamics.actionangle import ( isochrone_xv_to_aa, isochrone_aa_to_xv, harmonic_oscillator_xv_to_aa, ) from gala.logging import logger from gala.potential import ( IsochronePotential, HarmonicOscillatorPotential, Hami...
mit
893f3fc8685590723033d14dceaed96e
32.148352
84
0.501575
3.240064
false
false
false
false
indico/indico
indico/modules/events/abstracts/models/persons.py
2
1568
# 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.sqlalchemy import PyIntEnum, db from indico.modules.events.contributions.models.person...
mit
d3a04c8e354ff77658a46c90ad3f2be5
30.36
102
0.673469
3.769231
false
false
false
false
indico/indico
indico/modules/events/contributions/lists.py
1
10611
# 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 timedelta from operator import attrgetter from flask import flash, request, session ...
mit
029873bef2a003ed7a442f2535824cbb
50.509709
117
0.608425
4.345209
false
false
false
false
indico/indico
indico/core/webpack.py
2
1531
# 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 os from flask_webpackext import FlaskWebpackExt from flask_webpackext.manifest import JinjaManifes...
mit
628e334b9751c359315553c99163e762
36.341463
92
0.690398
3.846734
false
false
false
false
indico/indico
indico/migrations/versions/20220513_1337_1950e5d12ab5_add_predefined_affiliations_to_persons.py
2
3354
"""Add predefined affiliations to persons Revision ID: 1950e5d12ab5 Revises: c39db219f85a Create Date: 2022-05-12 10:54:33.212208 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '1950e5d12ab5' down_revision = 'c39db219f85a' branch_labels = None depends_on = Non...
mit
2e6c0f1025c38800198c1a200cab0e90
56.827586
110
0.659213
3.504702
false
false
false
false
indico/indico
indico/web/forms/fields/markdown.py
2
1326
# 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 import TextAreaField from indico.util.i18n import _ from indico.web.forms.widgets import Jin...
mit
4dd26b379de721f41e98455800fa8a81
34.837838
102
0.667421
3.777778
false
false
false
false
indico/indico
indico/modules/events/papers/controllers/management.py
2
14766
# 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 flash, render_template, request, session from werkzeug.exceptions import NotFound from ...
mit
179884211a728a43867dc5aedc342061
45.727848
116
0.644386
3.922954
false
false
false
false