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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
erdc/proteus | proteus/tests/ci/test_Isosurface.py | 1 | 2141 | from future import standard_library
standard_library.install_aliases()
from builtins import range
from builtins import object
import os
import pytest
class TestIsosurface(object):
@classmethod
def setup_class(cls):
pass
@classmethod
def teardown_class(cls):
pass
def setup_method(... | mit | 8a71ef8c81d2ff3c5d89f2f60c5e740c | 35.288136 | 101 | 0.450257 | 4.396304 | false | true | false | false |
erdc/proteus | proteus/ErrorEstimators.py | 1 | 2594 | """
Classes for a posteriori error estimation
.. inheritance-diagram:: proteus.ErrorEstimators
:parts: 1
"""
from __future__ import absolute_import
from builtins import range
from builtins import object
from .Profiling import logEvent
class HierarchicalMeshEstimator(object):
def __init__(self,mlTransport):
... | mit | 206db896f1119818a49131cf248e60ff | 48.884615 | 111 | 0.603315 | 3.627972 | false | false | false | false |
erdc/proteus | proteus/SimTools.py | 1 | 126856 | """
Collect higher level tools for running simulation, processing results, etc
.. inheritance-diagram:: proteus.SimTools
:parts: 1
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from builtins import input
from builtins import range
from past.utils im... | mit | 6c5ec4f64abd4b2298f97ee4909153df | 58.278505 | 245 | 0.472693 | 4.217568 | false | false | false | false |
klen/muffin | docs/conf.py | 1 | 6578 | # -*- coding: utf-8 -*-
"""Setup Muffin documentation."""
import sys
import os
import pkg_resources
sys.path.append(os.path.abspath('_themes'))
sys.path.append(os.path.abspath('.'))
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your c... | mit | df8004d16a90e5c5debb5671fb60006a | 30.932039 | 86 | 0.688963 | 3.517647 | false | false | false | false |
erdc/proteus | proteus/tests/MeshAdaptPUMI/gauge_compare/dambreak_Colagrossi_2D_rdmc/vof_n.py | 3 | 2900 | from proteus.default_n import *
from proteus import (StepControl,
TimeIntegration,
NonlinearSolvers,
LinearSolvers,
LinearAlgebraTools)
import vof_p as physics
from proteus.mprans import VOF
from proteus import Context
ct = Context.get... | mit | 50ed8bbf92c92404b6f810316a515793 | 29.851064 | 88 | 0.717586 | 3.360371 | false | false | true | false |
erdc/proteus | scripts/povgen.py | 1 | 1345 | #!/usr/bin/env python
"""
A script for generating povray frames of zero level set
"""
from builtins import range
import argparse
import tables
import numpy as np
from proteus import Comm, Domain, Isosurface
parser = argparse.ArgumentParser()
parser.add_argument("prefix",
help="The prefix of the h5 ... | mit | ec6f5a22dee0f55958603d24102835bb | 33.487179 | 73 | 0.627509 | 3.337469 | false | false | false | false |
erdc/proteus | proteus/tests/HotStart_3P/pressureincrement_p.py | 1 | 2823 | from __future__ import absolute_import
from builtins import object
from math import *
from proteus import *
from proteus.default_p import *
from .NS_hotstart import *
#domain = ctx.domain
#nd = ctx.nd
name = "pressureincrement"
from proteus.mprans import PresInc
coefficients=PresInc.Coefficients(rho_f_min = (1.0-1.0e... | mit | 80c9273b33f6b07cd46a597cdd566cfa | 59.06383 | 275 | 0.334396 | 5.095668 | false | false | false | false |
erdc/proteus | scripts/pome_gen_poly.py | 1 | 2175 | from __future__ import print_function
from builtins import zip
from builtins import range
import math
n_domain_vertices = 100
domain_vertices =[(0.75*math.sin(2.0*math.pi*float(n)/float(n_domain_vertices))+0.5,0.75*math.cos(2.0*math.pi*float(n)/float(n_domain_vertices))+0.5) for n in range(n_domain_vertices)]
grain_ce... | mit | 65770848c01bf60497d60d9c4ed05440 | 43.387755 | 185 | 0.667126 | 2.405973 | false | false | false | false |
erdc/proteus | proteus/tests/levelset/rotation/vof_rotation_2d_p.py | 1 | 2488 | from __future__ import absolute_import
from builtins import object
from proteus import *
from proteus.default_p import *
from proteus.ctransportCoefficients import smoothedHeaviside
try:
from .rotation2D import *
except:
from rotation2D import *
from proteus.mprans import VOF
name=soname+"_vof"
"""
The non-con... | mit | ad77d0c84c398da3027e5fc31689b8aa | 27.272727 | 102 | 0.655547 | 2.927059 | false | false | false | false |
erdc/proteus | proteus/tests/CLSVOF/with_RANS3PF/pressureInitial_p.py | 1 | 1293 | from __future__ import absolute_import
from builtins import object
from math import *
from proteus import *
from proteus.default_p import *
try:
from .multiphase import *
except:
from multiphase import *
from proteus.mprans import PresInit
name = "pressureInitial"
#LevelModelType = PresInit.LevelModel
coeffici... | mit | f257330de9c833de5767f618a3e4bf3d | 29.785714 | 71 | 0.675174 | 3.475806 | false | false | false | false |
erdc/proteus | proteus/tests/poisson_2d/poisson_het_2d_dgpk_n.py | 1 | 2470 | from __future__ import absolute_import
from builtins import range
from proteus import *
from proteus.default_n import *
from proteus import defaults
defaults.reset_default_n()
try:
from .poisson_het_2d_p import *
except:
from poisson_het_2d_p import *
parallel = True
direct=False
polynomial_order = 2
numerical... | mit | 75cd64a0e74e14548d05cccab87131b5 | 25.276596 | 86 | 0.716194 | 3.030675 | false | false | false | false |
erdc/proteus | scripts/gen_eqp_quad.py | 1 | 4663 | #!/bin/env python
import math
import sympy
from sympy.integrals import intpoly
import numpy as np
from sympy.abc import I, J, K, N
from sympy import Sum
from sympy.geometry import Triangle, Point
from sympy.matrices import Matrix
from sympy.printing.cxxcode import cxxcode
x,y,z = sympy.symbols('x,y,z')
n01_x,n01_y,n01_... | mit | 430a0db4d803b2d779a0421175921d1c | 35.147287 | 153 | 0.538923 | 2.610862 | false | false | false | false |
caleb531/automata | automata/regex/postfix.py | 1 | 4614 | #!/usr/bin/env python3
"""Classes and methods for converting lists of tokens to postfix ordering."""
import abc
from collections import deque
from itertools import zip_longest
import automata.base.exceptions as exceptions
from automata.regex.lexer import Token
class Operator(Token):
"""Subclass of token definin... | mit | 1249cbf75dc91e5063ff82d5cf25b32a | 30.82069 | 118 | 0.64326 | 4.356941 | false | false | false | false |
fabric-bolt/fabric-bolt | fabric_bolt/task_runners/base.py | 3 | 11897 | import os
import re
import subprocess
import shutil
from django.apps import apps
from django.utils.text import slugify
from django.conf import settings
from django.core.cache import cache
class BaseTaskRunnerBackend(object):
special_options = ['no_agent', 'forward-agent', 'config', 'disable-known-hosts', 'keepal... | mit | 779789a5737a4a814dc1810966e3de43 | 37.626623 | 133 | 0.56199 | 4.063183 | false | true | false | false |
fabric-bolt/fabric-bolt | fabric_bolt/accounts/forms.py | 10 | 3496 | import string
import random
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.contrib.auth.forms import PasswordResetForm
from django.utils.translation import ugettext_lazy as _
class UserChangeForm(forms.ModelForm):
"""
A form fo... | mit | c0d6b0612035e5b7553f1fe92e683e21 | 32.941748 | 107 | 0.627002 | 4.222222 | false | false | false | false |
instana/python-sensor | instana/autoprofile/schedule.py | 1 | 1213 | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
import threading
import time
from ..log import logger
class TimerWraper(object):
def __init__(self):
self.timer = None
self.cancel_lock = threading.Lock()
self.canceled = False
def cancel(self):
with self.cance... | mit | 2a2ba0d8decae588be161147c84cf901 | 21.481481 | 99 | 0.575433 | 3.912903 | false | false | false | false |
instana/python-sensor | instana/agent/aws_lambda.py | 1 | 3564 | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
"""
The Instana agent (for AWS Lambda functions) that manages
monitoring state and reporting that data.
"""
import time
from ..log import logger
from ..util import to_json
from .base import BaseAgent
from ..version import VERSION
from ..collector.aws_lam... | mit | 1a56e03ef443e43318521bf269ee7fdd | 36.515789 | 116 | 0.5867 | 4.330498 | false | false | false | false |
instana/python-sensor | instana/collector/aws_lambda.py | 1 | 2060 | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
"""
AWS Lambda Collector: Manages the periodic collection of metrics & snapshot data
"""
from ..log import logger
from .base import BaseCollector
from ..util import DictionaryOfStan
from ..util.aws import normalize_aws_lambda_arn
class AWSLambdaCollect... | mit | e5c615d6047b7d37107dbf9e3be8b713 | 29.746269 | 95 | 0.618932 | 4.071146 | false | false | false | false |
instana/python-sensor | instana/instrumentation/wsgi.py | 1 | 2301 | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
"""
Instana WSGI Middleware
"""
import opentracing as ot
import opentracing.ext.tags as tags
from ..singletons import agent, tracer
from ..util.secrets import strip_secrets_from_query
class InstanaWSGIMiddleware(object):
""" Instana WSGI middlewar... | mit | 013871e18dcaf6fb5c6e38cda72af90a | 38 | 106 | 0.598435 | 3.723301 | false | false | false | false |
instana/python-sensor | tests/autoprofile/test_runtime.py | 1 | 1120 | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
import unittest
import signal
import os
from instana.autoprofile.profiler import Profiler
from instana.autoprofile.runtime import runtime_info, register_signal
class RuntimeTestCase(unittest.TestCase):
def test_register_signal(self):
if r... | mit | 9586f982cd1ede086436310ed848e90c | 21.857143 | 69 | 0.624107 | 3.648208 | false | true | false | false |
instana/python-sensor | instana/tracer.py | 1 | 6536 | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2016
from __future__ import absolute_import
import os
import re
import time
import traceback
import opentracing as ot
from basictracer import BasicTracer
from .util.ids import generate_id
from .span_context import SpanContext
from .span import InstanaSpan,... | mit | 5e22cfd2341dfb88025da06d5a765a20 | 35.719101 | 101 | 0.570532 | 4.173691 | false | false | false | false |
instana/python-sensor | tests/frameworks/test_pyramid.py | 1 | 9240 | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
from __future__ import absolute_import
import unittest
import urllib3
import tests.apps.pyramid_app
from ..helpers import testenv
from instana.singletons import tracer
class TestPyramid(unittest.TestCase):
def setUp(self):
""" Clear all s... | mit | 69852bc40f2b08ae754e2b4fdf503f34 | 36.408907 | 100 | 0.622727 | 3.593932 | false | true | false | false |
instana/python-sensor | instana/propagators/base_propagator.py | 1 | 11634 | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
from __future__ import absolute_import
import sys
from instana.log import logger
from instana.util.ids import header_to_id, header_to_long_id
from instana.span_context import SpanContext
from instana.w3c_trace_context.traceparent import Traceparent
fro... | mit | 0db7778a2b3bd4f415858d0e4c4a7cd3 | 37.523179 | 117 | 0.606928 | 3.581897 | false | false | false | false |
instana/python-sensor | instana/autoprofile/profile.py | 1 | 3900 | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
import math
import os
import uuid
import time
class Profile(object):
CATEGORY_CPU = 'cpu'
CATEGORY_MEMORY = 'memory'
CATEGORY_TIME = 'time'
TYPE_CPU_USAGE = 'cpu-usage'
TYPE_MEMORY_ALLOCATION_RATE = 'memory-allocation-rate'
TYPE... | mit | 6f349996fb8b566d9b98e2abda5421fb | 27.467153 | 99 | 0.584103 | 3.696682 | false | false | false | false |
instana/python-sensor | instana/util/__init__.py | 1 | 4319 | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
import json
import sys
import time
from collections import defaultdict
import pkg_resources
try:
from urllib import parse
except ImportError:
import urlparse as parse
import urllib
from ..log import logger
if sys.version_info.major == 2:
... | mit | 27faeb1e93f371c9dfe8d04c4a70d6a4 | 27.045455 | 111 | 0.601991 | 3.908597 | false | false | false | false |
veekun/pokedex | pokedex/tests/test_database_sanity.py | 1 | 6762 | import pytest
parametrize = pytest.mark.parametrize
from collections import Counter
import re
from sqlalchemy.orm import aliased, joinedload, lazyload
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.sql import func
from pokedex.db import tables, util
def test_encounter_slots(session):
"""Encounters... | mit | 2aeae56cccbb8e96dee9b9db300a6e75 | 42.909091 | 311 | 0.660603 | 3.616043 | false | true | false | false |
veekun/pokedex | pokedex/util/media.py | 1 | 20051 |
"""Media accessors
All media accessor __init__s take a `root` argument, which should be a path
to the root of the media directory.
Alternatively, `root` can be a custom MediaFile subclass.
Most __init__s take an ORM object as a second argument.
Their various methods take a number of arguments specifying exactly whi... | mit | 0cf814dfa089ae4477200e1f251994e5 | 35.589416 | 83 | 0.583761 | 4.13082 | false | false | false | false |
veekun/pokedex | scripts/xd-tutors.py | 5 | 5004 | # Encoding: UTF-8
"""Add XD tutors to the database
This is an unmaintained one-shot script, only included in the repo for reference.
"""
from pokedex.db import connect, tables, util
session = connect()
emerald = util.get(session, tables.Version, 'emerald')
fire_red = util.get(session, tables.Version, 'firered')
em... | mit | 64dec07f093bc9f9af804d85fed39ec8 | 39.674797 | 88 | 0.672197 | 3.160455 | false | false | false | false |
veekun/pokedex | scripts/markdown-identifiers.py | 5 | 5441 | # Encoding: UTF-8
"""Rewrite markdown links from [Label]{category:thing} to just {category:thing}
There was a version of this script that rewrote stuff from an even earlier
format. Git log should find it without problems.
This is an unmaintained one-shot script, only included in the repo for
reference.
"""
from fun... | mit | 235f2ca1f65493e8d649df01470b4311 | 31.136095 | 100 | 0.482968 | 4.2663 | false | false | false | false |
veekun/pokedex | scripts/pokemon_species.py | 5 | 5715 | # Encoding: UTF-8
"""Reorganize Pokemon, PokemonForm, etc. to Species, Pokemon, etc.
This is an unmaintained one-shot script, only included in the repo for
reference.
"""
import csv
import os
from pokedex import defaults
number_of_species = 649
high_id_start = 10000
csv_dir = defaults.get_default_csv_dir()
def t... | mit | efd94223d06b6374775985076087ba01 | 33.847561 | 89 | 0.626422 | 3.426259 | false | false | false | false |
beetbox/beets | beetsplug/mbsync.py | 2 | 7421 | # This file is part of beets.
# Copyright 2016, Jakob Schnitzer.
#
# 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,... | mit | db18977fae98d5e4421a83ff92ebf454 | 40.691011 | 79 | 0.537798 | 4.41201 | false | false | false | false |
beetbox/beets | test/testall.py | 1 | 1255 | #!/usr/bin/env python
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 th... | mit | 7406ef166c813d05206fa7531debea34 | 30.375 | 78 | 0.694821 | 3.83792 | false | true | false | false |
compas-dev/compas | src/compas_rhino/artists/polyhedronartist.py | 1 | 1681 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import compas_rhino
from compas.artists import ShapeArtist
from compas.colors import Color
from .artist import RhinoArtist
class PolyhedronArtist(RhinoArtist, ShapeArtist):
"""Artist for drawing polyhedro... | mit | 4cbab2820394c9d91c2d8831fe5fff7f | 29.563636 | 107 | 0.614515 | 4.070218 | false | false | false | false |
compas-dev/compas | src/compas/files/gltf/gltf_children.py | 1 | 1656 | from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
class GLTFChildren(object):
def __init__(self, context, values):
self._values = list(values)
self._context = context
for v in values:
self.check_node_context(v)
def... | mit | cc58557896deb5a2ea6e8ed670614f49 | 24.875 | 77 | 0.596618 | 3.763636 | false | false | false | false |
widdowquinn/pyani | pyani/fastani.py | 1 | 14832 | # -*- 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 | f7f73397afc6f615e62599549cfc20bd | 34.715663 | 128 | 0.658953 | 3.845874 | false | false | false | false |
compas-dev/compas | src/compas/files/gltf/gltf_content.py | 1 | 21043 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.files.gltf.data_classes import TextureInfoData
from compas.files.gltf.gltf_mesh import GLTFMesh
from compas.files.gltf.gltf_node import GLTFNode
from compas.files.gltf.gltf_scene import GLTFScene
fr... | mit | 535b5c543af273229139d4130ab22bdd | 33.050162 | 136 | 0.590553 | 4.003615 | false | false | false | false |
compas-dev/compas | src/compas/topology/traversal.py | 1 | 18798 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
try:
from queue import PriorityQueue
except ImportError:
from Queue import PriorityQueue
from collections import deque
from compas.geometry import distance_point_point
# ============================... | mit | 64f611426e89c3dc328198f02297ff09 | 32.09507 | 119 | 0.58086 | 4.009812 | false | false | false | false |
compas-dev/compas | src/compas/robots/model/joint.py | 1 | 24178 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.data import Data
from compas.files import URDFElement
from compas.files import URDFParser
from compas.geometry import Frame
from compas.geometry import Rotation
from compas.geometry import Transform... | mit | eae16c4c9930d4890caf3b13f6e68a41 | 29.566372 | 119 | 0.596203 | 4.129462 | false | false | false | false |
compas-dev/compas | src/compas/geometry/primitives/circle.py | 1 | 6043 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from math import pi
from compas.geometry.primitives import Primitive
from compas.geometry.primitives import Plane
class Circle(Primitive):
"""A circle is defined by a plane and a radius.
Parameters
... | mit | b3a9ce03454dc0b90259dad51b799de4 | 26.098655 | 97 | 0.473771 | 4.634202 | false | false | false | false |
compas-dev/compas | src/compas_rhino/conversions/_shapes.py | 1 | 4128 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.geometry import Plane
from compas.geometry import Circle
from compas.geometry import Box
from compas.geometry import Sphere
from compas.geometry import Cone
from compas.geometry import Cylinder
fro... | mit | e979bbf54cbd80567250cee47b0498b5 | 23.426036 | 88 | 0.654312 | 3.286624 | false | false | false | false |
compas-dev/compas | src/compas_rhino/conduits/lines.py | 1 | 3263 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from System.Drawing.Color import FromArgb
from Rhino.Geometry import Point3d
from compas.utilities import is_sequence_of_iterable
from compas.utilities import iterable_like
from .base import BaseConduit
cla... | mit | 4b86c1f7bd0646c4935a4971a2729274 | 28.93578 | 98 | 0.599755 | 3.847877 | false | false | false | false |
compas-dev/compas | src/compas/datastructures/mesh/conway.py | 1 | 17108 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
__all__ = [
"mesh_conway_dual",
"mesh_conway_join",
"mesh_conway_ambo",
"mesh_conway_kis",
"mesh_conway_needle",
"mesh_conway_zip",
"mesh_conway_truncate",
"mesh_conway_ortho",
... | mit | f585af4c2291ee2c68f244855017514b | 28.701389 | 117 | 0.597264 | 3.363082 | false | false | false | false |
widdowquinn/pyani | tests/test_subcmd_01_download.py | 1 | 4394 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) The James Hutton Institute 2016-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 o... | mit | 8f21adff0debbee2b4db9bac249166a8 | 30.84058 | 79 | 0.738052 | 3.73322 | false | true | false | false |
zzzeek/alembic | alembic/ddl/mysql.py | 2 | 16420 | from __future__ import annotations
import re
from typing import Any
from typing import Optional
from typing import TYPE_CHECKING
from typing import Union
from sqlalchemy import schema
from sqlalchemy import types as sqltypes
from sqlalchemy.ext.compiler import compiles
from .base import alter_table
from .base import... | mit | 7bb6fde74dd1629691d5ab8d4183c304 | 34.464363 | 79 | 0.570463 | 4.458322 | false | false | false | false |
cfelton/rhea | rhea/models/usbext/fx2/usbp_host.py | 2 | 3073 | #
# Copyright (c) 2011-2013 Christopher L. Felton
#
from __future__ import print_function, absolute_import
import myhdl
from myhdl import delay, always, instances
from .fx2_model import Fx2Model
class UsbpHost(Fx2Model):
"""
"""
def __init__(self):
Fx2Model.__init__(self, FifoSize=512, Config=0)... | mit | f9f9cd57db5aee1adcf1193671e54e3a | 29.73 | 121 | 0.485194 | 3.060757 | false | false | false | false |
cfelton/rhea | rhea/cores/video/lcd/lt24lcd_init_sequence.py | 2 | 3672 |
"""
The following describes the display initialization sequence. This
init sequence was adapted from the display init sequence provided
in the terasic example ILI9341.c
Refer to the ILI9341 datasheet for more information.
Init sequence overview
----------------------
0x11: (section 8.2.12) turn off sleep mod... | mit | 53931a381e693ffdf91c7023bc61d0b4 | 31.495575 | 70 | 0.569172 | 2.767144 | false | false | false | false |
cfelton/rhea | rhea/cores/sdram/mem_test.py | 2 | 2400 |
from __future__ import absolute_import
import myhdl
from myhdl import Signal, enum, always_seq
# from ..misc import random_generator
def mem_test(glbl, memmap, progress, error, done,
start_address=0x00000000, end_address=0xFFFFFFFF):
"""
This module performs a memory test over the memory-map bus
... | mit | ef1c961283e19a128aed6d940948fb5a | 28.62963 | 63 | 0.559583 | 3.947368 | false | false | false | false |
cfelton/rhea | rhea/cores/misc/uix/btn_mm_ctl.py | 2 | 1688 |
import myhdl
from myhdl import Signal, intbv, always_seq
from . import button_debounce
from rhea.cores.memmap import controller_basic
@myhdl.block
def button_controller(glbl, regbus, btns, led_addr=0x240):
""" Generate bus cycles from a button input
This is a nonsensical module that creates memory-mapped
... | mit | 5a746199275fd4901c713df340837758 | 29.142857 | 62 | 0.614929 | 3.437882 | false | false | false | false |
reviewboard/rbtools | rbtools/commands/login.py | 1 | 1738 | from __future__ import unicode_literals
import logging
from rbtools.api.errors import AuthorizationError
from rbtools.commands import Command, CommandError
from rbtools.utils.users import get_authenticated_session
class Login(Command):
"""Logs into a Review Board server.
The user will be prompted for a use... | mit | 04b23147d9db9d1d0482cfe5249a778d | 33.76 | 79 | 0.582278 | 5.023121 | false | false | false | false |
reviewboard/rbtools | rbtools/clients/tests/test_scmclient_registry.py | 1 | 8252 | """Unit tests for rbtools.clients.base.registry.
Version Added:
4.0
"""
import re
import sys
if sys.version_info[:2] >= (3, 10):
# Python >= 3.10
from importlib.metadata import EntryPoint, entry_points
else:
# Python <= 3.9
from importlib_metadata import EntryPoint, entry_points
import kgb
from... | mit | 81098ae8465952474a7eb88808a24c17 | 32.140562 | 78 | 0.610397 | 4.233966 | false | true | false | false |
reviewboard/rbtools | rbtools/api/utils.py | 1 | 2490 | """Utilities used by the API interfaces."""
from typing_extensions import TypedDict
class ParsedMIMEType(TypedDict):
"""A MIME type, parsed into its component parts.
Version Added:
4.0
"""
#: The full MIME type.
#:
#: Type:
#: str
type: str
#: Main type (For example... | mit | 83a55dabd4ec0bd296b87a9f9f1416a6 | 20.465517 | 78 | 0.554618 | 3.75 | false | false | false | false |
reviewboard/rbtools | rbtools/utils/graphs.py | 5 | 1847 | from __future__ import unicode_literals
from collections import defaultdict, deque
import six
def visit_depth_first(graph, start):
"""Yield vertices in the graph starting at the start vertex.
The vertices are yielded in a depth first order and only those vertices
that can be reached from the start vert... | mit | dc51116f3ba21a4003576e522f23239d | 22.379747 | 78 | 0.608554 | 4.408115 | false | false | false | false |
reviewboard/rbtools | rbtools/diffs/tools/backends/apple.py | 1 | 8434 | """A diff tool interfacing with Apple Diff.
Version Added:
4.0
"""
import io
import re
from datetime import datetime
from typing import List
from rbtools.diffs.tools.base import BaseDiffTool, DiffFileResult
from rbtools.utils.filesystem import iter_exes_in_path
from rbtools.utils.process import RunProcessError, ... | mit | b1ce39f96c3da23885e2903b39c17d8b | 31.438462 | 78 | 0.534977 | 4.536848 | false | false | false | false |
reviewboard/rbtools | rbtools/testing/transport.py | 1 | 4262 | """Transport subclass used for unit testing.
Deprecated::
3.1:
Replaced with
:py:class:`rbtools.testing.api.transport.URLMapTransport.`
"""
from __future__ import unicode_literals
from rbtools.api.factory import create_resource
from rbtools.api.request import HttpRequest
from rbtools.api.tests.base impor... | mit | 36661df704691ad37179171b498e6a93 | 37.053571 | 79 | 0.633271 | 4.500528 | false | true | false | false |
reviewboard/rbtools | rbtools/utils/tests/test_buffered_iterator.py | 1 | 4140 | """Unit tests for rbtools.utils.streams.BufferedIterator.
Version Added:
4.0
"""
from rbtools.testing import TestCase
from rbtools.utils.streams import BufferedIterator
class BufferedIteratorTests(TestCase):
"""Unit tests for rbtools.utils.streams.BufferedIterator."""
def test_is_empty_with_iter_empty(... | mit | 5952024e1aee175674b5daf40c51f7e4 | 31.093023 | 75 | 0.629227 | 4.078818 | false | true | false | false |
reviewboard/rbtools | rbtools/api/tests/test_errors.py | 1 | 6553 | """Unit tests for rbtools.api.errors."""
from __future__ import unicode_literals
import six
from rbtools.api.errors import APIError, AuthorizationError, BadRequestError
from rbtools.testing import TestCase
class APIErrorTests(TestCase):
"""Unit tests for rbtools.api.errors.APIError."""
def test_str_with_h... | mit | 0da0690485784f6eca7c59b1fc188237 | 36.232955 | 77 | 0.544636 | 4.541234 | false | true | false | false |
reviewboard/rbtools | rbtools/utils/tests/test_repository.py | 1 | 6116 | """Unit tests for rbtools.utils.repository."""
from __future__ import unicode_literals
import json
import kgb
from six.moves.urllib.request import urlopen
from rbtools.api.client import RBClient
from rbtools.api.tests.base import MockResponse
from rbtools.testing import TestCase
from rbtools.utils.repository import... | mit | 83fd98075d58ceef8fea76f1c6296014 | 30.045685 | 76 | 0.48463 | 4.101945 | false | true | false | false |
pytest-dev/pytest-mock | scripts/gen-release-notes.py | 1 | 1138 | """
Generates the release notes for the latest release, in Markdown.
Convert CHANGELOG.rst to Markdown, and extracts just the latest release.
Writes to ``scripts/latest-release-notes.md``, which can be
used with https://github.com/softprops/action-gh-release.
"""
from pathlib import Path
import pypandoc
this_dir = ... | mit | 81243a8cc28adf9b52ad88b3b17d1231 | 30.611111 | 74 | 0.676626 | 3.501538 | false | true | false | false |
ywangd/stash | bin/webviewer.py | 1 | 1337 | # coding: utf-8
"""Opens the given URL in the webbrowser or an App."""
import argparse
import webbrowser
import ui
from objc_util import on_main_thread
@on_main_thread
def open_webbrowser(url, modal=False):
"""opens the url in the webbrowser"""
webbrowser.open(url, modal)
def open_webview(url, modal=False):... | mit | 7c7f60c315dae61c8c9e7a5185aabc91 | 28.711111 | 125 | 0.611818 | 3.565333 | false | false | false | false |
ywangd/stash | bin/head.py | 1 | 2669 | # -*- coding: utf-8 -*-
"""Print the first 10 lines of the given files.
"""
from __future__ import print_function
import argparse
import string
import sys
import fileinput
def filter_non_printable(s):
return ''.join([c if c.isalnum() or c.isspace() or c in string.punctuation else ' ' for c in s])
def head(f, ... | mit | 9efe891f032a3572cf5a07784aeeacc9 | 26.515464 | 110 | 0.48033 | 3.959941 | false | false | false | false |
ywangd/stash | bin/unzip.py | 1 | 3494 | # -*- coding: utf-8 -*-
"""Extract a zip archive into a directory."""
from __future__ import print_function
import os
import sys
import zipfile
import argparse
def main(args):
ap = argparse.ArgumentParser()
ap.add_argument('-d', '--exdir', nargs='?', help='extract files into exdir')
ap.add_argument('-v',... | mit | d2a44b345aa883132a34d022e5aef110 | 37.395604 | 96 | 0.479393 | 4.199519 | false | false | false | false |
ywangd/stash | lib/libcore.py | 1 | 2588 | # -*- coding: utf-8 -*-
import os
import fileinput
try:
unicode
except NameError:
unicode = str
def collapseuser(path):
"""Reverse of os.path.expanduser: return path relative to ~, if
such representation is meaningful. If path is not ~ or a
subdirectory, the absolute path will be returned.
""... | mit | 7339f0f380796576c681019b2ddd1420 | 29.447059 | 132 | 0.584621 | 3.88006 | false | false | false | false |
ywangd/stash | lib/stashutils/fsi/base.py | 1 | 5264 | # -*- coding: utf-8 -*-
"""helper functions and base classes."""
from stashutils.fsi.errors import OperationFailure
import random
import os
import time
import stat
import pwd
class BaseFSI(object):
"""
Baseclass for all FSIs.
Other FSIs should subclass this.
This class currently only serves as a documentation, bu... | mit | 2dae80246a1f03322538f998b39e577b | 23.713615 | 80 | 0.56478 | 3.822803 | false | false | false | false |
ywangd/stash | bin/ping.py | 1 | 8143 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Usage:
ping [-c <count>] [-i <interval>] [-W <timeout>] <destination>
Options:
-c <count>, --count=<count> [default: 5]
-i <interval>, --interval=<interval> [default: 1.0]
Wait interval seconds between sending each packet. The default is to wait... | mit | 9c684c9afe73e0b8adf7debf4f09e884 | 32.372951 | 144 | 0.635392 | 3.604692 | false | false | false | false |
pyvisa/pyvisa | pyvisa/resources/gpib.py | 1 | 7862 | # -*- coding: utf-8 -*-
"""High level wrapper for GPIB resources.
This file is part of PyVISA.
:copyright: 2014-2022 by PyVISA Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from time import perf_counter
from typing import Tuple
from .. import attributes, constants
from ..at... | mit | f9a2a4a7de0d81ac5f090782a6c306d4 | 32.033613 | 88 | 0.641313 | 4.310307 | false | false | false | false |
ywangd/stash | bin/sort.py | 1 | 1035 | # -*- coding: utf-8 -*-
"""Sort standard input or given files to standard output"""
from __future__ import print_function
import os
import sys
import fileinput
import argparse
def main(args):
ap = argparse.ArgumentParser()
ap.add_argument('files', nargs='*', help='files to sort')
ap.add_argument('-r', '--... | mit | a49d857a17870af0972553e1fbc20c4d | 25.538462 | 116 | 0.573913 | 3.90566 | false | false | false | false |
ywangd/stash | bin/zip.py | 1 | 1603 | # -*- coding: utf-8 -*-
""" Package and compress (archive) files and directories """
from __future__ import print_function
import os
import sys
import argparse
import zipfile
def main(args):
ap = argparse.ArgumentParser()
ap.add_argument('zipfile', help='')
ap.add_argument('list', nargs='+', help='')
... | mit | ceab8b7bebfa60e6bae6eb722e01f203 | 34.622222 | 82 | 0.520274 | 4.174479 | false | false | false | false |
pyvisa/pyvisa | pyvisa/resources/usb.py | 1 | 5017 | # -*- coding: utf-8 -*-
"""High level wrapper for USB resources.
This file is part of PyVISA.
:copyright: 2014-2022 by PyVISA Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from .. import attributes, constants
from ..attributes import Attribute
from .messagebased import Contr... | mit | 0b5e94e8fe36aeb61a7a4edca9a26cff | 33.363014 | 95 | 0.646203 | 4.412489 | false | false | false | false |
arogozhnikov/einops | einops/einops.py | 1 | 33737 | import functools
import itertools
import string
import typing
from collections import OrderedDict
from typing import Set, Tuple, List, Dict, Union, Callable, Optional, TypeVar, cast, Any
if typing.TYPE_CHECKING:
import numpy as np
from . import EinopsError
from ._backends import get_backend
from .parsing import P... | mit | 052edfb206dfbc3436f01eeda05ccccb | 41.543506 | 120 | 0.632925 | 3.812952 | false | false | false | false |
ywangd/stash | bin/tar.py | 1 | 4605 | # -*- coding: utf-8 -*-
'''
Create and extract tar, gzip, bz2 archives.
Examples:
Create a gzip compressed archive:
tar -czvf test.tar.gz your_directory file1.py file2.py
Create a tar archive:
tar -cvf test.tar.gz your_directory file1.py file2.py
Unpack a gzip archive:
... | mit | ebbb610f6ca49e5b246a78abcc383310 | 31.202797 | 108 | 0.60456 | 3.710717 | false | false | false | false |
ywangd/stash | lib/stashutils/extensions.py | 1 | 2520 | # -*- coding: utf-8 -*-
"""This module defines functions to interact with stash extensions."""
import os
import shutil
import io
from stash.system.shcommon import _STASH_EXTENSION_BIN_PATH as EBP
from stash.system.shcommon import _STASH_EXTENSION_MAN_PATH as EMP
from stash.system.shcommon import _STASH_EXTENSION_FSI_P... | mit | 4ad313f03ce9f8a6916abfb9359f92f1 | 31.74026 | 78 | 0.668651 | 3.631124 | false | false | false | false |
ywangd/stash | lib/git/git-branch.py | 1 | 11974 | #coding: utf-8
""" git branch [-r | -a] [--abbrev=n | --no-abbrev\n
git branch [--set-upstream | --track | --no-track] [-l][-f] <branchname> <startpoint>
git branch (-m | -M) [<oldbranch>] <newbranch>
git branch (-d | -D) [-r] <branchname>…
git branch --edit-description [<branchname>]"""
from __future_... | mit | 3c3b28c62efabded20851ed0f131a9ed | 35.389058 | 235 | 0.619195 | 3.842105 | false | true | false | false |
arogozhnikov/einops | einops/layers/__init__.py | 1 | 2887 | __author__ = 'Alex Rogozhnikov'
import functools
from typing import Any
from einops.einops import _apply_recipe
from ..einops import TransformRecipe, _prepare_transformation_recipe
from .. import EinopsError
class RearrangeMixin:
"""
Rearrange layer behaves identically to einops.rearrange operation.
:... | mit | 8773d2572b5f056f103e931e07e825e1 | 35.0875 | 117 | 0.638379 | 3.943989 | false | false | false | false |
ywangd/stash | lib/stashutils/fsi/zip.py | 1 | 7023 | # -*- coding: utf-8 -*-
"""The FSI for zipfiles"""
import zipfile
import os
import tempfile
import time
import shutil
import datetime
import stat
from io import BytesIO
from stashutils.fsi import base
from stashutils.fsi import errors
# TODO: check filename bug when writing
class ZipfileFSI(base.BaseFSI):
"""F... | mit | a17c2544118a3b4f856fc653197c570e | 28.758475 | 91 | 0.537804 | 3.901667 | false | false | false | false |
pyvisa/pyvisa | pyvisa/testsuite/keysight_assisted_tests/test_tcpip_resources.py | 1 | 4530 | # -*- coding: utf-8 -*-
"""Test the TCPIP based resources.
"""
import pytest
from pyvisa import constants, errors
from . import copy_func, require_virtual_instr
from .messagebased_resource_utils import (
EventAwareMessagebasedResourceTestCaseMixin,
LockableMessagedBasedResourceTestCaseMixin,
Messagebased... | mit | cef2ecdd04d7456cfdfdb4baea117109 | 36.131148 | 85 | 0.683885 | 3.878425 | false | true | false | false |
arogozhnikov/einops | einops/experimental/indexing.py | 1 | 14777 | """
Indexing one array with the other(s).
Concept for discussion.
Notation targets hard cases, not simple ones, like indexing of 1d-array with another 1d-array
(notation supports that, but you can't simplify arr[ind], and there is no reason to)
Examples
1. query for every token in sequence a token in the image. Im... | mit | feeba9ba6e9a8528b26c2484c11e94a0 | 36.600509 | 121 | 0.595046 | 3.506645 | false | false | false | false |
ywangd/stash | bin/version.py | 1 | 3242 | # -*- coding: utf-8 -*-
""" Show information about this StaSh installation.
"""
from __future__ import print_function
import os
import io
import sys
import time
import platform
import plistlib
_stash = globals()['_stash']
try:
collapseuser = _stash.libcore.collapseuser
except AttributeError:
collapseuser = l... | mit | 2fb38108a3ada71f16686621de27bc5c | 29.584906 | 125 | 0.612893 | 3.370062 | false | false | false | false |
ywangd/stash | lib/stashutils/core.py | 1 | 1149 | # -*- coding: utf-8 -*-
"""core utilities for StaSh-scripts"""
import threading
import imp
import os
from stash.system import shthreads
def get_stash():
"""
returns the currently active StaSh-instance.
returns None if it can not be found.
This is useful for modules.
"""
if "_stash" in globals():
... | mit | 0563660dec4e505a3643a854b386bf44 | 25.113636 | 87 | 0.583986 | 3.767213 | false | false | false | false |
pyvisa/pyvisa | pyvisa/resources/serial.py | 1 | 3638 | # -*- coding: utf-8 -*-
"""High level wrapper for Serial resources.
This file is part of PyVISA.
:copyright: 2014-2022 by PyVISA Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from .. import attributes, constants
from ..attributes import Attribute
from .messagebased import Me... | mit | dd6194dcc192bacba284d099bdf7bb80 | 41.8 | 91 | 0.718802 | 3.700916 | false | false | false | false |
ywangd/stash | system/shhistory.py | 1 | 6418 | #-*- coding: utf-8 -*-
"""
StaSh input history
"""
from io import open
import json
from .shcommon import ShEventNotFound
class ShHistory(object):
"""
This class is responsible for input history.
:param stash: the StaSh core
:type stash: StaSh
"""
ENCODING = "utf-8"
DEFAULT = "_default"
... | mit | a4926bd397b9d35c9fda315212b98934 | 29.417062 | 115 | 0.53459 | 4.290107 | false | false | false | false |
ywangd/stash | tests/misc/test_pwd.py | 1 | 1194 | # -*- coding: utf-8 -*-
"""tests for the 'pwd' command."""
import os
from stash.tests.stashtest import StashTestCase
class PwdTests(StashTestCase):
"""tests for the 'pwd' command."""
cwd = os.path.expanduser("~")
def test_help(self):
"""test 'pwd --help'."""
output = self.run_command("pw... | mit | b6ff144cd8c8216008c6f453e0476061 | 32.166667 | 75 | 0.572864 | 3.864078 | false | true | false | false |
ywangd/stash | lib/mlpatches/tl_patches.py | 1 | 1462 | # -*- coding: utf-8 -*-
"""patches for making some vars thread-local"""
import threading
import copy
from mlpatches import base
class ThreadLocalVar(object):
"""creates a proxy to a thread-local version of passee var."""
# todo: maybe add lock?
def __init__(self, var):
self.__var = var
se... | mit | 463946cfa89fd69be337e3cda047c574 | 24.206897 | 67 | 0.569767 | 3.994536 | false | false | false | false |
pyvisa/pyvisa | pyvisa/typing.py | 1 | 1444 | # -*- coding: utf-8 -*-
"""Type aliases allowing to narrow down definition and reduce duplication
This file is part of PyVISA.
:copyright: 2020-2022 by PyVISA Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from typing import Any, Callable, NewType
from . import constants
#:... | mit | bbba9e3f8c8041c8bc4408aed738c0d9 | 39.111111 | 87 | 0.774238 | 3.945355 | false | false | false | false |
mozillazg/python-pinyin | gen_pinyin_dict.py | 1 | 1118 | # -*- coding: utf-8 -*-
import sys
def main(in_fp, out_fp):
out_fp.write('''# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Warning: Auto-generated file, don't edit.
pinyin_dict = {
''')
for line in in_fp.readlines():
line = line.strip()
if line.startswith('#') or not line:
... | mit | 957c6c7c41f33323f227c0ce497ecf91 | 28.105263 | 69 | 0.506329 | 2.704156 | false | false | false | false |
mozillazg/python-pinyin | pypinyin/contrib/uv.py | 1 | 1334 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
class V2UMixin(object):
"""无声调相关拼音风格下的结果使用 ``ü`` 代替原来的 ``v``
使用方法::
from pypinyin import lazy_pinyin, Style
from pypinyin.contrib.uv import V2UMixin
from pypinyin.converter import DefaultConverter
from pypinyin.c... | mit | dcd3e1d8a98402adeb16ccedde7fc768 | 25.8 | 72 | 0.565506 | 2.674058 | false | false | false | false |
mozillazg/python-pinyin | pypinyin/style/wadegiles.py | 1 | 12194 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pypinyin.constants import Style
from pypinyin.style import register
from pypinyin.style._utils import replace_symbol_to_no_symbol
from pypinyin.style._utils import get_initials
# https://en.wikipedia.org/wiki/Wade%E2%80%93Giles
# https://web.archive... | mit | 3dbf3aa5115b1246d60a6260e7dbfc7e | 20.719141 | 108 | 0.363809 | 2.469189 | false | false | false | false |
pgmpy/pgmpy | pgmpy/estimators/StructureScore.py | 2 | 15672 | #!/usr/bin/env python
import numpy as np
from scipy.special import gammaln
from math import lgamma, log
from pgmpy.estimators import BaseEstimator
class StructureScore(BaseEstimator):
def __init__(self, data, **kwargs):
"""
Abstract base class for structure scoring classes in pgmpy. Use any of th... | mit | 2eb7c912acf3a3a1f1fa5d92e51e0e7c | 43.140845 | 111 | 0.637652 | 4.214632 | false | false | false | false |
pgmpy/pgmpy | pgmpy/tests/test_inference/test_mplp.py | 2 | 2448 | import unittest
import numpy as np
from pgmpy.inference.mplp import Mplp
from pgmpy.readwrite import UAIReader
class TestMplp(unittest.TestCase):
def setUp(self):
reader_file = UAIReader(
"pgmpy/tests/test_readwrite/testdata/grid4x4_with_triplets.uai"
)
self.markov_model = r... | mit | 93deab2e4321c5b47cfbe42552f1550a | 28.142857 | 107 | 0.530229 | 3.294751 | false | true | false | false |
pgmpy/pgmpy | pgmpy/inference/CausalInference.py | 2 | 25809 | from collections.abc import Iterable
from itertools import chain, product
import networkx as nx
import numpy as np
from tqdm.auto import tqdm
from pgmpy.estimators.LinearModel import LinearEstimator
from pgmpy.factors.discrete import DiscreteFactor
from pgmpy.global_vars import SHOW_PROGRESS
from pgmpy.models import ... | mit | 91c4f27b77c1c2fcf4fe5c752e3dbe5b | 36.350217 | 227 | 0.563796 | 4.234454 | false | false | false | false |
pgmpy/pgmpy | pgmpy/tests/test_utils/test_optimizer.py | 2 | 2011 | import unittest
import numpy as np
import numpy.testing as npt
from pgmpy.utils import optimize, pinverse
from pgmpy.global_vars import device, dtype
try: # pragma: no cover
import torch
except ImportError: # pragma: no cover
torch = None
class TestOptimize(unittest.TestCase):
"""
self = TestOptim... | mit | a158046e77f93e39292ac4bc35bb27c5 | 30.421875 | 87 | 0.57633 | 3.540493 | false | true | false | false |
pgmpy/pgmpy | pgmpy/estimators/HillClimbSearch.py | 2 | 13550 | #!/usr/bin/env python
from itertools import permutations
from collections import deque
import networkx as nx
from tqdm.auto import trange
from pgmpy.estimators import (
StructureScore,
StructureEstimator,
K2Score,
ScoreCache,
BDeuScore,
BDsScore,
BicScore,
)
from pgmpy.base import DAG
from... | mit | b8c87f63ce5df1440b6a9acbe8f3d2b7 | 39.690691 | 129 | 0.554022 | 4.292049 | false | false | false | false |
pgmpy/pgmpy | pgmpy/estimators/SEMEstimator.py | 2 | 14703 | import numpy as np
import pandas as pd
import statsmodels.api as sm
try:
import torch
except ImportError:
torch = None
from pgmpy.models import SEMGraph, SEMAlg, SEM
from pgmpy.global_vars import device, dtype
from pgmpy.utils import optimize, pinverse
class SEMEstimator(object):
"""
Base class of S... | mit | 17839329d17070685797449d1b7274a6 | 33.433255 | 150 | 0.536489 | 3.9208 | false | false | false | false |
plotly/dash | components/dash-core-components/tests/integration/input/test_number_input.py | 1 | 2845 | import time
import sys
from selenium.webdriver.common.keys import Keys
def test_inni001_invalid_numbers(ninput_app, dash_dcc):
dash_dcc.start_server(ninput_app)
for invalid_number in ("10e10000", "e+++eeeeeE-", "12-.3"):
for debounce in ("false", "true"):
elem = dash_dcc.find_element(f"#in... | mit | 979b138eb5e298087261a21f86b5a7ad | 32.081395 | 88 | 0.613005 | 3.046039 | false | false | false | false |
plotly/dash | tests/unit/library/test_utils.py | 1 | 1364 | import pytest
import dash._utils as utils
def test_ddut001_attribute_dict():
a = utils.AttributeDict()
assert str(a) == "{}"
with pytest.raises(AttributeError):
a.k
with pytest.raises(KeyError):
a["k"]
assert a.first("no", "k", "nope") is None
a.k = 1
assert a.k == 1
... | mit | 754c9d2d020e483e3dcd354aec48fef1 | 21.733333 | 80 | 0.547654 | 3.201878 | false | true | false | false |
plotly/dash | dash/testing/dash_page.py | 1 | 2926 | from bs4 import BeautifulSoup
class DashPageMixin:
def _get_dash_dom_by_attribute(self, attr):
return BeautifulSoup(
self.find_element(self.dash_entry_locator).get_attribute(attr), "lxml"
)
@property
def devtools_error_count_locator(self):
return ".test-devtools-error-... | mit | 16bafc42692b32e6c4c8ede6367c89b6 | 30.12766 | 101 | 0.580314 | 4.138614 | false | false | false | false |
plotly/dash | dash/long_callback/managers/diskcache_manager.py | 1 | 7013 | import traceback
from contextvars import copy_context
from . import BaseLongCallbackManager
from ..._callback_context import context_value
from ..._utils import AttributeDict
from ...exceptions import PreventUpdate
_pending_value = "__$pending__"
class DiskcacheManager(BaseLongCallbackManager):
"""Manage the ba... | mit | 30cff5e508576356faf53c78756ac45a | 34.241206 | 127 | 0.584058 | 4.527437 | false | false | false | false |
plotly/dash | components/dash-core-components/tests/integration/calendar/test_calendar_props.py | 1 | 3358 | import itertools
import pytest
from dash import Dash, Input, Output, html, dcc
import dash.testing.wait as wait
@pytest.mark.DCC594
def test_cdpr001_date_clearable_true_works(dash_dcc):
app = Dash(__name__)
app.layout = html.Div(
[
dcc.DatePickerRange(id="dpr", clearable=True),
... | mit | 1887fc54c3138529f0e90ec364e916e1 | 28.982143 | 88 | 0.580405 | 3.447639 | false | false | false | false |
plotly/dash | tests/integration/long_callback/utils.py | 1 | 1264 | import os
def get_long_callback_manager():
"""
Get the long callback mangaer configured by environment variables
"""
if os.environ.get("LONG_CALLBACK_MANAGER", None) == "celery":
from dash.long_callback import CeleryLongCallbackManager
from celery import Celery
import redis
... | mit | 4d945be45d29dce0cc4b89abace1b887 | 36.176471 | 79 | 0.653481 | 4.157895 | false | true | false | false |
plotly/dash | components/dash-core-components/tests/integration/calendar/test_date_picker_single.py | 1 | 6972 | from datetime import datetime, timedelta
import pandas as pd
import time
import pytest
import werkzeug
from dash import Dash, Input, Output, html, dcc, no_update
@pytest.mark.DCC652
def test_dtps001_simple_click(dash_dcc):
app = Dash(__name__)
app.layout = html.Div(
[
html.Label("Operati... | mit | 7b6dc6f9264481c9f2ee1d3f67186842 | 29.986667 | 86 | 0.551348 | 3.604964 | false | false | false | false |
plotly/dash | tests/integration/callbacks/test_global_dash_callback.py | 1 | 1761 | import dash
from dash import Input, Output, dcc, html
def test_dash_callback_001(dash_duo):
app = dash.Dash(__name__)
app.layout = html.Div(
[
dcc.Input(id="input"),
html.Div(id="div-1"),
html.Div(id="div-2"),
html.Div(id="div-3"),
html.Div(... | mit | b8cbd8d11c8541132958153dcda3371e | 31.611111 | 72 | 0.558773 | 3.237132 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.