language
stringclasses
1 value
repo
stringclasses
346 values
path
stringlengths
6
201
class_span
dict
source
stringlengths
21
2.38M
target
stringlengths
1
96
python
vyperlang__vyper
vyper/semantics/types/bytestrings.py
{ "start": 329, "end": 5510 }
class ____(VyperType): """ Private base class for single-value types which occupy multiple memory slots and where a maximum length must be given via a subscript (string, bytes). Types for literals have an inferred minimum length. For example, `b"hello"` has a length of 5 of more and so can be used ...
_BytestringT
python
walkccc__LeetCode
solutions/208. Implement Trie (Prefix Tree)/208.py
{ "start": 108, "end": 738 }
class ____: def __init__(self): self.root = TrieNode() def insert(self, word: str) -> None: node: TrieNode = self.root for c in word: node = node.children.setdefault(c, TrieNode()) node.isWord = True def search(self, word: str) -> bool: node = self._find(word) return node is not No...
Trie
python
bokeh__bokeh
src/bokeh/models/annotations/dimensional.py
{ "start": 4762, "end": 5093 }
class ____(ReciprocalMetric): """ Metric units of reciprocal length measurement. """ # explicit __init__ to support Init signatures def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) base_unit = Override(default="m") exclude = Override(default=["dm", "hm"])
ReciprocalMetricLength
python
PyCQA__pylint
pylint/config/argument.py
{ "start": 5230, "end": 6178 }
class ____: """Class representing an argument to be parsed by an argparse.ArgumentsParser. This is based on the parameters passed to argparse.ArgumentsParser.add_message. See: https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.add_argument """ def __init__( self, ...
_Argument
python
walkccc__LeetCode
solutions/2792. Count Nodes That Are Great Enough/2792.py
{ "start": 0, "end": 414 }
class ____: def countGreatEnoughNodes(self, root: TreeNode | None, k: int) -> int: ans = 0 def dfs(root: TreeNode | None) -> list[int]: nonlocal ans if not root: return [] kSmallest = sorted(dfs(root.left) + dfs(root.right))[:k] if len(kSmallest) == k and root.val > kSmallest...
Solution
python
nedbat__coveragepy
coverage/tomlconfig.py
{ "start": 997, "end": 7558 }
class ____: """TOML file reading with the interface of HandyConfigParser.""" # This class has the same interface as config.HandyConfigParser, no # need for docstrings. # pylint: disable=missing-function-docstring def __init__(self, our_file: bool) -> None: self.our_file = our_file ...
TomlConfigParser
python
plotly__plotly.py
plotly/graph_objs/sankey/link/hoverlabel/_font.py
{ "start": 233, "end": 17163 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "sankey.link.hoverlabel" _path_str = "sankey.link.hoverlabel.font" _valid_props = { "color", "colorsrc", "family", "familysrc", "lineposition", "linepositionsrc", "shadow", "shadowsrc", ...
Font
python
tensorflow__tensorflow
tensorflow/python/ops/linalg/linear_operator_identity.py
{ "start": 20610, "end": 35637 }
class ____(BaseLinearOperatorIdentity): """`LinearOperator` acting like a scaled [batch] identity matrix `A = c I`. This operator acts like a scaled [batch] identity matrix `A` with shape `[B1,...,Bb, N, N]` for some `b >= 0`. The first `b` indices index a batch member. For every batch index `(i1,...,ib)`, `...
LinearOperatorScaledIdentity
python
openai__openai-python
src/openai/types/evals/run_create_params.py
{ "start": 2181, "end": 2752 }
class ____(TypedDict, total=False): data_source: Required[DataSource] """Details about the run's data source.""" metadata: Optional[Metadata] """Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured f...
RunCreateParams
python
astropy__astropy
astropy/time/tests/test_basic.py
{ "start": 31798, "end": 42340 }
class ____: """Test input and output subformat functionality""" def test_input_subformat(self): """Input subformat selection""" # Heterogeneous input formats with in_subfmt='*' (default) times = [ "2000-01-01", "2000-01-01 01:01", "2000-01-01 01:01:01...
TestSubFormat
python
getsentry__sentry
src/sentry/models/dashboard_widget.py
{ "start": 623, "end": 1173 }
class ____: TYPES: list[tuple[int, str]] @classmethod def as_choices(cls): return [(k, str(v)) for k, v in cls.TYPES] @classmethod def as_text_choices(cls): return [(str(v), str(v)) for _, v in cls.TYPES] @classmethod def get_type_name(cls, num): for id, name in cl...
TypesClass
python
google__jax
tests/lobpcg_test.py
{ "start": 13968, "end": 14994 }
class ____(LobpcgTest): def setUp(self): # TODO(phawkins): investigate this failure if jtu.test_device_matches(["gpu"]): raise unittest.SkipTest("Test is failing on CUDA gpus") super().setUp() @parameterized.named_parameters(_make_concrete_cases(f64=True)) @jtu.skip_on_devices("tpu", "gpu") ...
F64LobpcgTest
python
numba__numba
numba/core/typed_passes.py
{ "start": 15052, "end": 15559 }
class ____(AnalysisPass): _name = "dump_parfor_diagnostics" def __init__(self): AnalysisPass.__init__(self) def run_pass(self, state): if state.flags.auto_parallel.enabled: if config.PARALLEL_DIAGNOSTICS: if state.parfor_diagnostics is not None: ...
DumpParforDiagnostics
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/hooks/eventbridge.py
{ "start": 1126, "end": 3364 }
class ____(AwsBaseHook): """Amazon EventBridge Hook.""" def __init__(self, *args, **kwargs): super().__init__(client_type="events", *args, **kwargs) def put_rule( self, name: str, description: str | None = None, event_bus_name: str | None = None, event_patte...
EventBridgeHook
python
django__django
django/views/generic/edit.py
{ "start": 8798, "end": 9039 }
class ____(SingleObjectTemplateResponseMixin, BaseDeleteView): """ View for deleting an object retrieved with self.get_object(), with a response rendered by a template. """ template_name_suffix = "_confirm_delete"
DeleteView
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/triggers/bedrock.py
{ "start": 9827, "end": 10754 }
class ____(BedrockBaseBatchInferenceTrigger): """ Trigger when a batch inference job is scheduled. :param job_arn: The Amazon Resource Name (ARN) of the batch inference job. :param waiter_delay: The amount of time in seconds to wait between attempts. (default: 120) :param waiter_max_attempts: The ...
BedrockBatchInferenceScheduledTrigger
python
realpython__materials
build-a-rest-api-frontend/source_code_final/models.py
{ "start": 1082, "end": 1416 }
class ____(ma.SQLAlchemyAutoSchema): class Meta: model = Person load_instance = True sqla_session = db.session include_relationships = True notes = fields.Nested(NoteSchema, many=True) note_schema = NoteSchema() person_schema = PersonSchema() people_schema = PersonSchema(many=...
PersonSchema
python
tensorflow__tensorflow
tensorflow/python/keras/layers/convolutional.py
{ "start": 87419, "end": 94924 }
class ____(SeparableConv): """Depthwise separable 2D convolution. Separable convolutions consist of first performing a depthwise spatial convolution (which acts on each input channel separately) followed by a pointwise convolution which mixes the resulting output channels. The `depth_multiplier` argument c...
SeparableConv2D
python
scipy__scipy
scipy/optimize/tests/test_optimize.py
{ "start": 112523, "end": 126502 }
class ____: def __init__(self): self.number_of_calls = threading.local() def __call__(self, x): if not hasattr(self.number_of_calls, 'c'): self.number_of_calls.c = 0 self.number_of_calls.c += 1 return np.sum(x**2), 2 * x @pytest.fixture def function_with_gradient()...
FunctionWithGradient
python
explosion__spaCy
spacy/lang/sv/__init__.py
{ "start": 639, "end": 1276 }
class ____(Language): lang = "sv" Defaults = SwedishDefaults @Swedish.factory( "lemmatizer", assigns=["token.lemma"], default_config={ "model": None, "mode": "rule", "overwrite": False, "scorer": {"@scorers": "spacy.lemmatizer_scorer.v1"}, }, default_score_w...
Swedish
python
google__python-fire
fire/helptext.py
{ "start": 26991, "end": 27341 }
class ____: """A group of actions of the same kind.""" def __init__(self, name, plural): self.name = name self.plural = plural self.names = [] self.members = [] def Add(self, name, member=None): self.names.append(name) self.members.append(member) def GetItems(self): return zip(sel...
ActionGroup
python
tensorflow__tensorflow
tensorflow/python/data/kernel_tests/unique_test.py
{ "start": 1140, "end": 3671 }
class ____(test_base.DatasetTestBase, parameterized.TestCase): def _testSimpleHelper(self, dtype, test_cases): """Test the `unique()` transformation on a list of test cases. Args: dtype: The `dtype` of the elements in each test case. test_cases: A list of pairs of lists. The first component is t...
UniqueTest
python
celery__celery
celery/utils/deprecated.py
{ "start": 2397, "end": 3620 }
class ____: def __init__(self, fget=None, fset=None, fdel=None, doc=None, **depreinfo): self.__get = fget self.__set = fset self.__del = fdel self.__name__, self.__module__, self.__doc__ = ( fget.__name__, fget.__module__, fget.__doc__, ) self.depreinfo =...
_deprecated_property
python
py-pdf__pypdf
pypdf/filters.py
{ "start": 18939, "end": 19979 }
class ____: """§7.4.6, optional parameters for the CCITTFaxDecode filter.""" K: int = 0 columns: int = 1728 rows: int = 0 EndOfLine: Union[bool, None] = False EncodedByteAlign: Union[bool, None] = False EndOfBlock: Union[bool, None] = True BlackIs1: bool = False DamagedRowsBeforeErr...
CCITTParameters
python
pypa__warehouse
tests/unit/email/test_services.py
{ "start": 3733, "end": 5319 }
class ____: def test_verify_service(self, sender_class): assert verifyClass(IEmailSender, sender_class) def test_creates_service(self, sender_class): mailer = pretend.stub() context = pretend.stub() request = pretend.stub( registry=pretend.stub( setti...
TestSMTPEmailSender
python
getsentry__sentry
src/sentry/replays/lib/new_query/fields.py
{ "start": 3455, "end": 5563 }
class ____(BaseField[T]): def __init__( self, expression: Expression, parse_fn: Callable[[str], T], query_type: type[GenericBase] ) -> None: self.expression = expression self.parse = parse_fn self.query = query_type def apply(self, search_filter: SearchFilter) -> Condition: ...
ExpressionField
python
tensorflow__tensorflow
tensorflow/python/ops/init_ops.py
{ "start": 7294, "end": 14350 }
class ____(Initializer): """Initializer that generates tensors with constant values. The resulting tensor is populated with values of type `dtype`, as specified by arguments `value` following the desired `shape` of the new tensor (see examples below). The argument `value` can be a constant value, or a list ...
Constant
python
lepture__authlib
authlib/oauth2/rfc7636/challenge.py
{ "start": 1077, "end": 5790 }
class ____: """CodeChallenge extension to Authorization Code Grant. It is used to improve the security of Authorization Code flow for public clients by sending extra "code_challenge" and "code_verifier" to the authorization server. The AuthorizationCodeGrant SHOULD save the ``code_challenge`` and ...
CodeChallenge
python
pyca__cryptography
tests/x509/test_x509_ext.py
{ "start": 72495, "end": 73379 }
class ____: def test_non_a_label(self): with pytest.raises(ValueError): x509.DNSName(".\xf5\xe4\xf6\xfc.example.com") def test_init(self): name = x509.DNSName("*.xn--4ca7aey.example.com") assert name.value == "*.xn--4ca7aey.example.com" with pytest.raises(TypeError)...
TestDNSName
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/eventloop/inputhook.py
{ "start": 2648, "end": 6130 }
class ____(BaseSelector): """ Usage: selector = selectors.SelectSelector() loop = asyncio.SelectorEventLoop(InputHookSelector(selector, inputhook)) asyncio.set_event_loop(loop) """ def __init__( self, selector: BaseSelector, inputhook: Callable[[InputHookContext], None]...
InputHookSelector
python
giampaolo__psutil
psutil/_pswindows.py
{ "start": 13719, "end": 21579 }
class ____: # noqa: PLW1641 """Represents an installed Windows service.""" def __init__(self, name, display_name): self._name = name self._display_name = display_name def __str__(self): details = f"(name={self._name!r}, display_name={self._display_name!r})" return f"{self....
WindowsService
python
h5py__h5py
h5py/_hl/files.py
{ "start": 9375, "end": 25643 }
class ____(Group): """ Represents an HDF5 file. """ @property def attrs(self): """ Attributes attached to this object """ # hdf5 complains that a file identifier is an invalid location for an # attribute. Instead of self, pass the root group to AttributeManager: ...
File
python
huggingface__transformers
src/transformers/models/cohere2/modular_cohere2.py
{ "start": 11070, "end": 11122 }
class ____(CohereLayerNorm): pass
Cohere2LayerNorm
python
wandb__wandb
wandb/vendor/pygments/lexers/sql.py
{ "start": 27192, "end": 28555 }
class ____(Lexer): """ Lexer for example sessions using sqlite3. .. versionadded:: 0.11 """ name = 'sqlite3con' aliases = ['sqlite3'] filenames = ['*.sqlite3-console'] mimetypes = ['text/x-sqlite3-console'] def get_tokens_unprocessed(self, data): sql = SqlLexer(**self.opti...
SqliteConsoleLexer
python
scrapy__scrapy
tests/test_spidermiddleware_referer.py
{ "start": 21576, "end": 21736 }
class ____(MixinSameOrigin, TestRefererMiddleware): settings = {"REFERRER_POLICY": "scrapy.spidermiddlewares.referer.SameOriginPolicy"}
TestSettingsSameOrigin
python
ray-project__ray
python/ray/tests/test_actor_state_metrics.py
{ "start": 3628, "end": 6313 }
class ____: def ready(self): pass actors = [Actor.remote() for _ in range(10)] ray.get([actor.ready.remote() for actor in actors]) """ info = ray.init(num_cpus=3, _system_config=_SYSTEM_CONFIG) output = run_string_as_driver(driver) print(output) timeseries = PrometheusTimese...
Actor
python
pytorch__pytorch
benchmarks/operator_benchmark/pt/ao_sparsifier_test.py
{ "start": 677, "end": 1530 }
class ____(op_bench.TorchBenchmarkBase): def init(self, M, SL, SBS, ZPB): weight = torch.ones(M) model = nn.Module() model.register_buffer("weight", weight) sparse_config = [{"tensor_fqn": "weight"}] self.sparsifier = pruning.WeightNormSparsifier( sparsity_level=...
WeightNormSparsifierBenchmark
python
jmcnamara__XlsxWriter
xlsxwriter/test/table/test_table07.py
{ "start": 481, "end": 2076 }
class ____(unittest.TestCase): """ Test assembling a complete Table file. """ def test_assemble_xml_file(self): """Test writing a table""" self.maxDiff = None worksheet = Worksheet() worksheet.worksheet_meta = WorksheetMeta() worksheet.str_table = SharedStringT...
TestAssembleTable
python
marshmallow-code__marshmallow
tests/test_schema.py
{ "start": 51311, "end": 58674 }
class ____: @pytest.fixture def user(self): return User(name="Monty", age=81) @pytest.fixture def blog(self, user): col1 = User(name="Mick", age=123) col2 = User(name="Keith", age=456) return Blog( "Monty's blog", user=user, categories...
TestNestedSchema
python
huggingface__transformers
src/transformers/models/depth_pro/modeling_depth_pro.py
{ "start": 31959, "end": 33471 }
class ____(nn.Module): def __init__(self, config: DepthProConfig): super().__init__() self.config = config self.out_size = config.image_model_config.image_size // config.image_model_config.patch_size self.model = AutoModel.from_config(config.fov_model_config) self.neck = nn....
DepthProFovEncoder
python
django__django
tests/generic_views/views.py
{ "start": 5619, "end": 5690 }
class ____(BookConfig, generic.WeekArchiveView): pass
BookWeekArchive
python
google__jax
tests/pallas/indexing_test.py
{ "start": 26381, "end": 27790 }
class ____(PallasBaseTest): def setUp(self): if jtu.test_device_matches(["tpu"]): self.skipTest("Advanced indexers are not supported on TPU") # 4 arrays that are used in test cases of advanced indexing self.a = jnp.array([1, 1, 1, 1, 1], dtype=jnp.int32) self.b = jnp.array([1, 2, 2, 2, 2], dty...
AdvancedIndexerOpsTest
python
huggingface__transformers
src/transformers/models/esm/modeling_esmfold.py
{ "start": 38503, "end": 39170 }
class ____(nn.Module): """ Implementation of dropout with the ability to share the dropout mask along a particular dimension. """ def __init__(self, r: float, batch_dim: Union[int, list[int]]): super().__init__() self.r = r if isinstance(batch_dim, int): batch_dim =...
EsmFoldDropout
python
kamyu104__LeetCode-Solutions
Python/score-of-a-string.py
{ "start": 38, "end": 232 }
class ____(object): def scoreOfString(self, s): """ :type s: str :rtype: int """ return sum(abs(ord(s[i+1])-ord(s[i])) for i in xrange(len(s)-1))
Solution
python
numpy__numpy
numpy/distutils/intelccompiler.py
{ "start": 279, "end": 1362 }
class ____(UnixCCompiler): """A modified Intel compiler compatible with a GCC-built Python.""" compiler_type = 'intel' cc_exe = 'icc' cc_args = 'fPIC' def __init__(self, verbose=0, dry_run=0, force=0): UnixCCompiler.__init__(self, verbose, dry_run, force) v = self.get_version() ...
IntelCCompiler
python
huggingface__transformers
tests/trainer/test_trainer.py
{ "start": 5003, "end": 5290 }
class ____(TrainerCallback): """ Simple callback to store the loss. """ def __init__(self): self.losses = [] def on_log(self, args, state, control, logs=None, **kwargs): if "loss" in logs: self.losses.append(logs["loss"])
StoreLossCallback
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/linalg/linalg_ops_test.py
{ "start": 11783, "end": 11896 }
class ____(test.TestCase, _MatrixRankTest): dtype = np.float64 use_static_shape = False
MatrixRankDynamic64Test
python
numba__llvmlite
llvmlite/binding/value.py
{ "start": 12881, "end": 13107 }
class ____(_AttributeIterator): def _dispose(self): self._capi.LLVMPY_DisposeAttributeSetIter(self) def _next(self): return ffi.ret_bytes(ffi.lib.LLVMPY_AttributeSetIterNext(self))
_AttributeSetIterator
python
cython__cython
Cython/Coverage.py
{ "start": 5488, "end": 15605 }
class ____(CoveragePlugin): # map from traced file paths to absolute file paths _file_path_map = None # map from traced file paths to corresponding C files _c_files_map = None # map from parsed C files to their content _parsed_c_files = None # map from traced files to lines that are excluded...
Plugin
python
pypa__setuptools
setuptools/tests/test_setuptools.py
{ "start": 975, "end": 3797 }
class ____: def testExtractConst(self): if not hasattr(dep, 'extract_constant'): # skip on non-bytecode platforms return def f1(): global x, y, z x = "test" y = z # pyright: ignore[reportUnboundVariable] # Explicitly testing for this runt...
TestDepends
python
vyperlang__vyper
vyper/semantics/types/primitives.py
{ "start": 730, "end": 1486 }
class ____(_PrimT): _id = "bool" _valid_literal = (vy_ast.NameConstant,) def validate_boolean_op(self, node: vy_ast.BoolOp) -> None: return def validate_numeric_op( self, node: Union[vy_ast.UnaryOp, vy_ast.BinOp, vy_ast.AugAssign] ) -> None: if not isinstance(node.op, vy_as...
BoolT
python
tox-dev__tox
src/tox/config/source/legacy_toml.py
{ "start": 364, "end": 977 }
class ____(IniSource): FILENAME = "pyproject.toml" def __init__(self, path: Path) -> None: if path.name != self.FILENAME or not path.exists(): raise ValueError with path.open("rb") as file_handler: toml_content = tomllib.load(file_handler) try: conten...
LegacyToml
python
kamyu104__LeetCode-Solutions
Python/find-the-last-marked-nodes-in-tree.py
{ "start": 1016, "end": 2881 }
class ____(object): def lastMarkedNodes(self, edges): """ :type edges: List[List[int]] :rtype: List[int] """ def increase(x): return (x[0]+1, x[1]) def bfs(): dp = [[(0, u)]*2 for u in xrange(len(adj))] new_root = -1 de...
Solution2
python
getsentry__sentry
src/sentry/workflow_engine/migrations/0001_squashed_0065_add_status_to_detector_and_workflow.py
{ "start": 588, "end": 34770 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
coleifer__peewee
playhouse/reflection.py
{ "start": 7357, "end": 11015 }
class ____(Metadata): column_map = { 16: BooleanField, 17: BlobField, 20: BigIntegerField, 21: SmallIntegerField, 23: IntegerField, 25: TextField, 700: FloatField, 701: DoubleField, 1042: CharField, # blank-padded CHAR 1043: CharField, ...
PostgresqlMetadata
python
keras-team__keras
keras/src/backend/common/compute_output_spec_test.py
{ "start": 201, "end": 2118 }
class ____(testing.TestCase): def test_basics(self): out = backend.compute_output_spec( example_fn, backend.KerasTensor((2, 3)) ) self.assertIsInstance(out, backend.KerasTensor) self.assertEqual(out.shape, (2, 3, 2)) out = backend.compute_output_spec( ...
ComputeOutputSpecTest
python
sphinx-doc__sphinx
sphinx/directives/patches.py
{ "start": 6775, "end": 8225 }
class ____(SphinxDirective): """A patch of the docutils' :rst:dir:`rubric` directive, which adds a level option to specify the heading level of the rubric. """ required_arguments = 1 optional_arguments = 0 final_argument_whitespace = True option_spec = { 'class': directives.class_op...
Rubric
python
ray-project__ray
rllib/utils/postprocessing/tests/test_value_predictions.py
{ "start": 153, "end": 1694 }
class ____(unittest.TestCase): def test_extract_bootstrapped_values(self): """Tests, whether the extract_bootstrapped_values utility works properly.""" # Fake vf_preds sequence. # Spaces = denote (elongated-by-one-artificial-ts) episode boundaries. # digits = timesteps within the ac...
TestPostprocessing
python
eth-brownie__brownie
brownie/network/contract.py
{ "start": 54124, "end": 60099 }
class ____: def __init__(self, address: ChecksumAddress, name: str, owner: Optional[AccountsType]): self._address: Final = address self._name: Final = name self._owner: Final = owner self.methods: Final[Dict[Any, ContractCall | ContractTx]] = {} self.natspec: Final[Dict[str, ...
OverloadedMethod
python
plotly__plotly.py
plotly/graph_objs/violin/_box.py
{ "start": 233, "end": 4780 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "violin" _path_str = "violin.box" _valid_props = {"fillcolor", "line", "visible", "width"} @property def fillcolor(self): """ Sets the inner box plot fill color. The 'fillcolor' property is a color and may be specified...
Box
python
getsentry__sentry
src/sentry/workflow_engine/migrations/0104_action_data_fallthrough_type.py
{ "start": 799, "end": 2132 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
walkccc__LeetCode
solutions/2490. Circular Sentence/2490.py
{ "start": 0, "end": 226 }
class ____: def isCircularSentence(self, sentence: str) -> bool: for i, c in enumerate(sentence): if c == ' ' and sentence[i - 1] != sentence[i + 1]: return False return sentence[0] == sentence[-1]
Solution
python
django__django
tests/postgres_tests/test_search.py
{ "start": 28870, "end": 37521 }
class ____(GrailTestData, PostgreSQLTestCase): def test_and(self): searched = Line.objects.annotate( search=SearchVector("scene__setting", "dialogue"), ).filter(search=SearchQuery(Lexeme("bedemir") & Lexeme("scales"))) self.assertSequenceEqual(searched, [self.bedemir0]) def ...
TestLexemes
python
google__pytype
pytype/tests/test_utils.py
{ "start": 3228, "end": 6369 }
class ____: """Mixin providing utilities for operators tests.""" _HAS_DYNAMIC_ATTRIBUTES = True def check_expr(self, expr, assignments, expected_return): """Check the expression.""" # Note that testing "1+2" as opposed to "x=1; y=2; x+y" doesn't really test # anything because the peephole optimizer ...
OperatorsTestMixin
python
gevent__gevent
src/gevent/_config.py
{ "start": 16901, "end": 17590 }
class ____(ByteCountSettingMixin, Setting): name = 'max_memory_usage' environment_key = 'GEVENT_MONITOR_MEMORY_MAX' default = None desc = """\ If `monitor_thread` is enabled, then if memory usage exceeds this amount (in bytes), events will be emitted. See `gevent.events`. In the environmen...
MonitorMemoryMaxUsage
python
google__jax
jax/experimental/_private_mm/mini_dime.py
{ "start": 3736, "end": 9738 }
class ____(enum.Enum): SEND = 0 RECV = 1 def get_or_create_stream(op: OpT, local_device: jax.Device): # XXX: I think this can be one stream per local_device for this specific example. # It depends on the use case stream = local_streams.get((op, local_device)) if stream is None: with c...
OpT
python
Textualize__textual
tests/snapshot_tests/snapshot_apps/remove_tab.py
{ "start": 124, "end": 793 }
class ____(App[None]): BINDINGS = [ Binding("space", "close_pane"), ] def __init__(self): super().__init__() self.animation_level = "none" def compose(self): with TabbedContent(): yield TabPane("foo1", Label("foo contents")) yield TabPane("bar22"...
ReproApp
python
getsentry__sentry
src/sentry/replays/usecases/ingest/event_parser.py
{ "start": 1068, "end": 1170 }
class ____: timestamp: int message: str view_class: str view_id: str @dataclass
TapEvent
python
ray-project__ray
python/ray/llm/tests/batch/cpu/processor/test_processor_base.py
{ "start": 4574, "end": 5783 }
class ____(ProcessorConfig): pass def test_builder(): def build_processor(config: ProcessorConfig) -> Processor: stages = [ DummyStage( fn_constructor_kwargs=dict(), map_batches_kwargs=dict(concurrency=1), ) ] processor = Processo...
DummyProcessorConfig
python
mamba-org__mamba
micromamba/tests/test_config.py
{ "start": 6558, "end": 12815 }
class ____: @pytest.mark.parametrize("rc_file_args", ({"channels": ["channel1", "channel2"]},)) def test_list_with_rc(self, rc_file, rc_file_text): assert ( config("list", "--no-env", "--rc-file", rc_file).splitlines() == rc_file_text.splitlines() ) def test_list_wit...
TestConfigList
python
pappasam__jedi-language-server
jedi_language_server/initialization_options.py
{ "start": 2340, "end": 2513 }
class ____: auto_import_modules: List[str] = field(default_factory=list) case_insensitive_completion: bool = True debug: bool = False @light_dataclass
JediSettings
python
python-markdown__markdown
tests/test_syntax/extensions/test_def_list.py
{ "start": 781, "end": 8825 }
class ____(TestCase): def test_def_list_with_ol(self): self.assertMarkdownRenders( self.dedent( ''' term : this is a definition for term. it has multiple lines in the first paragraph. 1. first thing ...
TestDefList
python
readthedocs__readthedocs.org
readthedocs/api/v3/tests/test_projects.py
{ "start": 610, "end": 30260 }
class ____(APIEndpointMixin): def test_projects_list(self): url = reverse("projects-list") self.client.logout() response = self.client.get(url) self.assertEqual(response.status_code, 401) self.client.credentials(HTTP_AUTHORIZATION=f"Token {self.token.key}") response...
ProjectsEndpointTests
python
PrefectHQ__prefect
tests/infrastructure/provisioners/test_ecs.py
{ "start": 16494, "end": 19625 }
class ____: async def test_requires_provisioning_no_cluster(self, cluster_resource): needs_provisioning = await cluster_resource.requires_provisioning() assert needs_provisioning @pytest.mark.usefixtures("existing_cluster") async def test_requires_provisioning_with_cluster(self, cluster_re...
TestClusterResource
python
walkccc__LeetCode
solutions/680. Valid Palindrome II/680.py
{ "start": 0, "end": 353 }
class ____: def validPalindrome(self, s: str) -> bool: def validPalindrome(l: int, r: int) -> bool: return all(s[i] == s[r - i + l] for i in range(l, (l + r) // 2 + 1)) n = len(s) for i in range(n // 2): if s[i] != s[~i]: return validPalindrome(i + 1, n - 1 - i) or validPalindrome(i,...
Solution
python
apache__airflow
airflow-core/src/airflow/traces/tracer.py
{ "start": 6456, "end": 9395 }
class ____(type): factory: Callable[[], Tracer] | None = None instance: Tracer | EmptyTrace | None = None def __new__(cls, name, bases, attrs): # Read the debug flag from the class body. if "check_debug_traces_flag" not in attrs: raise TypeError(f"Class '{name}' must define 'che...
_TraceMeta
python
pytorch__pytorch
torch/distributed/checkpoint/_experimental/staging.py
{ "start": 3078, "end": 8237 }
class ____(CheckpointStager): """ DefaultStager provides a full-featured staging implementation that combines multiple optimization techniques for efficient checkpoint preparation. The staging process works as follows: 1. State dictionary is submitted for staging (sync or async) 2. Tensors are ...
DefaultStager
python
allegroai__clearml
clearml/backend_api/services/v2_23/dataviews.py
{ "start": 144171, "end": 145238 }
class ____(Request): """ Unarchive dataviews :param ids: IDs of the dataviews to unarchive :type ids: Sequence[str] """ _service = "dataviews" _action = "unarchive_many" _version = "2.23" _schema = { "definitions": {}, "properties": { "ids": { ...
UnarchiveManyRequest
python
run-llama__llama_index
llama-index-packs/llama-index-packs-fuzzy-citation/llama_index/packs/fuzzy_citation/base.py
{ "start": 4388, "end": 5275 }
class ____(BaseLlamaPack): def __init__( self, query_engine: BaseQueryEngine, threshold: int = DEFAULT_THRESHOLD ) -> None: """Init params.""" try: from thefuzz import fuzz # noqa: F401 except ImportError: raise ImportError( "Please run `p...
FuzzyCitationEnginePack
python
dagster-io__dagster
python_modules/dagster-pipes/dagster_pipes/__init__.py
{ "start": 40863, "end": 41934 }
class ____(PipesBlobStoreMessageWriter): """Message writer that writes messages by periodically writing message chunks to an S3 bucket. Args: client (Any): A boto3.client("s3") object. interval (float): interval in seconds between upload chunk uploads """ # client is a boto3.client("s3...
PipesS3MessageWriter
python
sympy__sympy
sympy/codegen/cnodes.py
{ "start": 1888, "end": 2175 }
class ____(Basic): """ Represents the pre-decrement operator Examples ======== >>> from sympy.abc import x >>> from sympy.codegen.cnodes import PreDecrement >>> from sympy import ccode >>> ccode(PreDecrement(x)) '--(x)' """ nargs = 1
PreDecrement
python
PyCQA__pylint
tests/functional/m/mixin_class_rgx.py
{ "start": 250, "end": 658 }
class ____: """Class that does match the option pattern""" def __aenter__(self): pass async def check_not_async_context_manager(): """Function calling the classes for not-async-context-manager""" async with AsyncManagerMixedin: # [not-async-context-manager] pass async with AsyncM...
AsyncManagerMixin
python
pypa__pipenv
pipenv/utils/exceptions.py
{ "start": 2321, "end": 3014 }
class ____(FileCorruptException): def __init__(self, path, backup_path=None): self.message = self.get_message(path, backup_path=backup_path) super().__init__(self.message) def get_message(self, path, backup_path=None): message = f"ERROR: Failed to load Pipfile at {path}" if back...
PipfileCorruptException
python
apache__airflow
airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py
{ "start": 28571, "end": 51110 }
class ____: def setup_method(self): clear_db_assets() clear_db_runs() def teardown_method(self): clear_db_assets() clear_db_runs() @pytest.mark.parametrize( ("state", "end_date", "expected_state"), [ (State.SUCCESS, DEFAULT_END_DATE, State.SUCCES...
TestTIUpdateState
python
realpython__materials
python-mutable-immutable/color.py
{ "start": 47, "end": 102 }
class ____: red: int green: int blue: int
Color
python
jmcnamara__XlsxWriter
dev/fuzzing/xlsx_fuzzer.py
{ "start": 311, "end": 1511 }
class ____(Enum): WRITE_STRING = 0 WRITE_NUMBER = 1 WRITE_FORMULA = 2 choices = [FuncChoice.WRITE_STRING, FuncChoice.WRITE_NUMBER, FuncChoice.WRITE_FORMULA] def TestOneInput(data): fdp = EnhancedFuzzedDataProvider(data) try: out = BytesIO() with xlsxwriter.Workbook(out) as wb: ...
FuncChoice
python
nedbat__coveragepy
tests/plugin2.py
{ "start": 1105, "end": 1722 }
class ____(FileTracer): """A FileTracer using information from the caller.""" def has_dynamic_source_filename(self) -> bool: return True def dynamic_source_filename( self, filename: str, frame: FrameType, ) -> str | None: if frame.f_code.co_name != "render": ...
RenderFileTracer
python
astropy__astropy
astropy/io/fits/hdu/groups.py
{ "start": 437, "end": 2632 }
class ____(FITS_record): """ One group of the random group data. """ def __init__(self, input, row=0, start=None, end=None, step=None, base=None): super().__init__(input, row, start, end, step, base) @property def parnames(self): return self.array.parnames @property de...
Group
python
django__django
django/db/models/fields/__init__.py
{ "start": 83747, "end": 84123 }
class ____(PositiveIntegerRelDbTypeMixin, SmallIntegerField): description = _("Positive small integer") def get_internal_type(self): return "PositiveSmallIntegerField" def formfield(self, **kwargs): return super().formfield( **{ "min_value": 0, *...
PositiveSmallIntegerField
python
ray-project__ray
release/ray_release/buildkite/settings.py
{ "start": 697, "end": 6885 }
class ____(enum.Enum): DEFAULT = 0 MANUAL = 10 HIGH = 50 HIGHEST = 100 priority_str_to_enum = { "default": Priority.DEFAULT, "manual": Priority.MANUAL, "high": Priority.HIGH, "highest": Priority.HIGHEST, } def get_frequency(frequency_str: str) -> Frequency: frequency_str = freque...
Priority
python
kubernetes-client__python
kubernetes/client/models/v1_certificate_signing_request_spec.py
{ "start": 383, "end": 18541 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1CertificateSigningRequestSpec
python
django__django
tests/generic_relations_regress/models.py
{ "start": 1647, "end": 1866 }
class ____(models.Model): content_type = models.ForeignKey(ContentType, models.CASCADE) object_id = models.TextField() content_object = GenericForeignKey() value = models.CharField(max_length=250)
TextLink
python
numba__numba
numba/core/ir.py
{ "start": 7920, "end": 8529 }
class ____(object): """ Mixin for basic equality checking """ def __eq__(self, other): if type(self) is type(other): def fixup(adict): bad = ('loc', 'scope') d = dict(adict) for x in bad: d.pop(x, None) retu...
EqualityCheckMixin
python
pytorch__pytorch
test/torch_np/numpy_tests/linalg/test_linalg.py
{ "start": 28138, "end": 28186 }
class ____(PinvCases, TestCase): pass
TestPinv
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/operators/datasync.py
{ "start": 1496, "end": 20312 }
class ____(AwsBaseOperator[DataSyncHook]): """ Find, Create, Update, Execute and Delete AWS DataSync Tasks. If ``do_xcom_push`` is True, then the DataSync TaskArn and TaskExecutionArn which were executed will be pushed to an XCom. .. seealso:: For more information on how to use this operat...
DataSyncOperator
python
django__django
tests/gis_tests/distapp/models.py
{ "start": 592, "end": 852 }
class ____(NamedModel): "City model for Australia, using WGS84." point = models.PointField() radius = models.IntegerField(default=10000) allowed_distance = models.FloatField(default=0.5) ref_point = models.PointField(null=True)
AustraliaCity
python
rq__rq
tests/test_retry.py
{ "start": 6168, "end": 9934 }
class ____(RQTestCase): """Tests from test_job_retry.py""" def test_retry(self): """Worker processes retry correctly when job returns Retry""" queue = Queue(connection=self.connection) job = queue.enqueue(return_retry) worker = Worker([queue], connection=self.connection) ...
TestWorkerRetry
python
great-expectations__great_expectations
great_expectations/core/expectation_diagnostics/supporting_types.py
{ "start": 5015, "end": 5406 }
class ____(SerializableDictDot): """Summarizes the result of a diagnostic Check. Used within the ExpectationDiagnostic object.""" message: str passed: bool doc_url: Optional[str] = None sub_messages: Sequence[ ExpectationDiagnosticCheckMessage | ExpectationDiagnosticCheckMessageDict ] =...
ExpectationDiagnosticCheckMessage
python
pydantic__pydantic
pydantic-core/python/pydantic_core/core_schema.py
{ "start": 123694, "end": 125070 }
class ____(TypedDict, total=False): name: Required[str] schema: Required[CoreSchema] mode: Literal['positional_only', 'positional_or_keyword', 'keyword_only'] # default positional_or_keyword alias: Union[str, list[Union[str, int]], list[list[Union[str, int]]]] def arguments_parameter( name: str, ...
ArgumentsParameter
python
sanic-org__sanic
sanic/exceptions.py
{ "start": 283, "end": 452 }
class ____(Exception): """Exception Sanic server uses when killing a server process for something unexpected happening.""" # noqa: E501 quiet = True
ServerKilled