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
conda__conda
conda/exceptions.py
{ "start": 44462, "end": 47478 }
class ____(CondaError): def __init__(self, msg: str, *args, **kwargs): super().__init__(msg, *args, **kwargs) def maybe_raise(error: BaseException, context: Context): if isinstance(error, CondaMultiError): groups = groupby(lambda e: isinstance(e, ClobberError), error.errors) clobber_er...
SpecNotFoundInPackageCache
python
pallets__jinja
src/jinja2/nativetypes.py
{ "start": 2861, "end": 4205 }
class ____(Template): environment_class = NativeEnvironment def render(self, *args: t.Any, **kwargs: t.Any) -> t.Any: """Render the template to produce a native Python type. If the result is a single node, its value is returned. Otherwise, the nodes are concatenated as strings. If the r...
NativeTemplate
python
apache__airflow
providers/common/messaging/tests/unit/common/messaging/triggers/test_msg_queue.py
{ "start": 2821, "end": 8722 }
class ____: """Test cases for MessageQueueTrigger error handling and provider matching.""" def test_no_providers_available(self): """Test error when no message queue providers are available.""" trigger = MessageQueueTrigger(queue=TEST_QUEUE) with mock.patch(MESSAGE_QUEUE_PROVIDERS_PATH,...
TestMessageQueueTrigger
python
geekcomputers__Python
venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers.py
{ "start": 519, "end": 864 }
class ____(ResolverException): def __init__(self, criterion): super(RequirementsConflicted, self).__init__(criterion) self.criterion = criterion def __str__(self): return "Requirements conflict: {}".format( ", ".join(repr(r) for r in self.criterion.iter_requirement()), ...
RequirementsConflicted
python
facelessuser__soupsieve
tests/test_level4/test_playing.py
{ "start": 52, "end": 940 }
class ____(util.TestCase): """Test playing selectors.""" MARKUP = """ <!DOCTYPE html> <html> <body> <video id="vid" width="320" height="240" controls> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> Your browser does not support the video t...
TestPlaying
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 921730, "end": 922470 }
class ____(sgqlc.types.relay.Connection): """The connection type for ReleaseAsset.""" __schema__ = github_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of("ReleaseAssetEdge"), graphql_name="edges") """A list of edges.""" node...
ReleaseAssetConnection
python
django__django
tests/sessions_tests/models.py
{ "start": 379, "end": 640 }
class ____(AbstractBaseSession): """ A session model with a column for an account ID. """ account_id = models.IntegerField(null=True, db_index=True) @classmethod def get_session_store_class(cls): return SessionStore
CustomSession
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/linalg/linear_operator_kronecker_test.py
{ "start": 2157, "end": 3133 }
class ____(test.TestCase): """Test of `_kronecker_dense` function.""" def test_kronecker_dense_matrix(self): x = ops.convert_to_tensor([[2., 3.], [1., 2.]], dtype=dtypes.float32) y = ops.convert_to_tensor([[1., 2.], [5., -1.]], dtype=dtypes.float32) # From explicitly writing out the kronecker product o...
KroneckerDenseTest
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/index1.py
{ "start": 1983, "end": 2155 }
class ____: __getitem__ = ClassH() reveal_type(ClassI()[0], expected_text="ClassH") def func4(l: list[Literal["a", "b"]]): l[0] = "a" l[0:0] = ["a", "b"]
ClassI
python
scikit-learn__scikit-learn
sklearn/utils/_param_validation.py
{ "start": 10105, "end": 10522 }
class ____(_Constraint): """Constraint representing instances of a given type. Parameters ---------- type : type The valid type. """ def __init__(self, type): super().__init__() self.type = type def is_satisfied_by(self, val): return isinstance(val, self.ty...
_InstancesOf
python
ray-project__ray
python/ray/tests/test_node_manager.py
{ "start": 10214, "end": 14092 }
class ____(RuntimeEnvPlugin): """ The first worker will start up normally, but all subsequent workers will hang at start up indefinitely. How it works: Ray RuntimeEnvAgent caches the modified context so we can't do it in modify_context. Instead, we use a bash command to read a file and hang forever....
HangOnSecondWorkerPlugin
python
great-expectations__great_expectations
great_expectations/metrics/column/sample_values.py
{ "start": 215, "end": 556 }
class ____(ColumnMetric[ColumnSampleValuesResult]): """ This metric returns a list of sample values from the column. It is only supported for SQLAlchemy execution engines at this time. Args: count: The number of sample values to return. """ name = "column.sample_values" count: in...
ColumnSampleValues
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_contextlib.py
{ "start": 673, "end": 1812 }
class ____(importlib.abc.MetaPathFinder): def find_spec(self, fullname, path, target=None): # Check if the import is the problematic one if fullname in redirect_imports: try: # Attempt to import the standalone module name = fullname.removeprefix("test.") ...
RedirectImportFinder
python
coleifer__peewee
playhouse/postgres_ext.py
{ "start": 11042, "end": 12127 }
class ____(object): __slots__ = ('cursor', 'array_size', 'exhausted', 'iterable') def __init__(self, cursor, array_size=None): self.cursor = cursor self.array_size = array_size or cursor.itersize self.exhausted = False self.iterable = self.row_gen() def __del__(self): ...
FetchManyCursor
python
ray-project__ray
python/ray/llm/tests/serve/cpu/deployments/test_prefix_tree.py
{ "start": 4569, "end": 11772 }
class ____: def test_insert_non_existent_tenant(self, tree: PrefixTree) -> None: """Test inserting a string for a non-existent tenant fails.""" # Insert without adding tenant first tree.insert("hello", "nonexistent", 1) # Verify insert did nothing since tenant doesn't exist ...
TestPrefixTreeInsert
python
ray-project__ray
python/ray/autoscaler/v2/tests/util.py
{ "start": 1015, "end": 2120 }
class ____: def __init__(self): self.events = [] def notify(self, events): self.events.extend(events) def clear(self): self.events.clear() def events_by_id(self, instance_id): return [e for e in self.events if e.instance_id == instance_id] def make_autoscaler_instanc...
MockSubscriber
python
numba__numba
numba/core/types/abstract.py
{ "start": 2694, "end": 7733 }
class ____(metaclass=_TypeMetaclass): """ The base class for all Numba types. It is essential that proper equality comparison is implemented. The default implementation uses the "key" property (overridable in subclasses) for both comparison and hashing, to ensure sane behaviour. """ mutabl...
Type
python
scipy__scipy
scipy/special/tests/test_spherical_bessel.py
{ "start": 10200, "end": 10399 }
class ____(SphericalDerivativesTestCase): def f(self, n, z): return spherical_yn(n, z) def df(self, n, z): return spherical_yn(n, z, derivative=True)
TestSphericalYnDerivatives
python
huggingface__transformers
src/transformers/models/unispeech/modeling_unispeech.py
{ "start": 17418, "end": 20348 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.config = config self.pos_conv_embed = UniSpeechPositionalConvEmbedding(config) self.layer_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn.Dropout(config.hidden_drop...
UniSpeechEncoder
python
kamyu104__LeetCode-Solutions
Python/second-minimum-time-to-reach-destination.py
{ "start": 107, "end": 1933 }
class ____(object): def secondMinimum(self, n, edges, time, change): """ :type n: int :type edges: List[List[int]] :type time: int :type change: int :rtype: int """ # Template: # https://github.com/kamyu104/LeetCode-Solutions/blob/master/Python...
Solution
python
openai__openai-python
src/openai/resources/chat/completions/messages.py
{ "start": 7570, "end": 7783 }
class ____: def __init__(self, messages: Messages) -> None: self._messages = messages self.list = to_streamed_response_wrapper( messages.list, )
MessagesWithStreamingResponse
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/linalg/linear_operator_addition_test.py
{ "start": 6853, "end": 10673 }
class ____(test.TestCase): """Test that the order of addition is done as specified by tiers.""" def test_tier_0_additions_done_in_tier_0(self): diag1 = linalg.LinearOperatorDiag([1.]) diag2 = linalg.LinearOperatorDiag([1.]) diag3 = linalg.LinearOperatorDiag([1.]) addition_tiers = [ [linear_...
LinearOperatorOrderOfAdditionTest
python
pytorch__pytorch
torch/fx/experimental/migrate_gradual_types/constraint.py
{ "start": 1609, "end": 1816 }
class ____(Constraint): """ True """ def __init__(self) -> None: pass def __eq__(self, other): return isinstance(other, T) def __repr__(self): return "True"
T
python
tensorflow__tensorflow
tensorflow/lite/python/interpreter_test.py
{ "start": 17278, "end": 19859 }
class ____(test_util.TensorFlowTestCase): def setUp(self): super(InterpreterTensorAccessorTest, self).setUp() self.interpreter = interpreter_wrapper.Interpreter( model_path=resource_loader.get_path_to_datafile( 'testdata/permute_float.tflite')) self.interpreter.allocate_tensors() ...
InterpreterTensorAccessorTest
python
ray-project__ray
python/ray/data/_internal/datasource/torch_datasource.py
{ "start": 308, "end": 2199 }
class ____(Datasource): """Torch datasource, for reading from `Torch datasets <https://pytorch.org/docs/stable/data.html/>`_. This datasource implements a streaming read using a single read task. """ def __init__( self, dataset: "torch.utils.data.Dataset", ): self._datas...
TorchDatasource
python
django__django
tests/template_tests/test_partials.py
{ "start": 5527, "end": 7753 }
class ____(TestCase): def override_get_template(self, **kwargs): class TemplateWithCustomAttrs: def __init__(self, **kwargs): for k, v in kwargs.items(): setattr(self, k, v) def render(self, context): return "rendered content" ...
RobustPartialHandlingTests
python
dateutil__dateutil
tests/test_rrule.py
{ "start": 214327, "end": 216396 }
class ____(unittest.TestCase): def testInvalidNthWeekday(self): with self.assertRaises(ValueError): FR(0) def testWeekdayCallable(self): # Calling a weekday instance generates a new weekday instance with the # value of n changed. from dateutil.rrule import weekday ...
WeekdayTest
python
python__mypy
test-data/unit/plugins/add_overloaded_method.py
{ "start": 236, "end": 1447 }
class ____(Plugin): def get_base_class_hook(self, fullname: str) -> Callable[[ClassDefContext], None] | None: if "AddOverloadedMethod" in fullname: return add_overloaded_method_hook return None def add_overloaded_method_hook(ctx: ClassDefContext) -> None: add_overloaded_method_to_c...
OverloadedMethodPlugin
python
getsentry__sentry
tests/sentry/users/models/test_user.py
{ "start": 8218, "end": 20825 }
class ____(BackupTestCase, HybridCloudTestMixin): def verify_model_existence_by_user( self, models: list[type[Model]], *, present: list[User], absent: list[User] ) -> None: for model in sorted(models, key=lambda x: get_model_name(x)): model_relations = dependencies()[get_model_name(m...
UserMergeToTest
python
readthedocs__readthedocs.org
readthedocs/projects/validators.py
{ "start": 1141, "end": 8148 }
class ____: disallow_relative_url = True # Pattern for ``git@github.com:user/repo`` pattern re_git_user = re.compile(r"^[\w]+@.+") def __call__(self, value): public_schemes = ["https", "http", "git", "ftps", "ftp"] private_schemes = ["ssh", "ssh+git"] local_schemes = ["file"] ...
RepositoryURLValidator
python
Pylons__pyramid
tests/test_predicates.py
{ "start": 5517, "end": 6862 }
class ____(unittest.TestCase): def _makeOne(self, val): from pyramid.predicates import MatchParamPredicate return MatchParamPredicate(val, None) def test___call___true_single(self): inst = self._makeOne('abc=1') request = Dummy() request.matchdict = {'abc': '1'} ...
TestMatchParamPredicate
python
astropy__astropy
astropy/cosmology/_src/tests/flrw/test_flrw.py
{ "start": 589, "end": 3834 }
class ____(FLRWTest): """Test :class:`astropy.cosmology.FLRW`.""" abstract_w = True def setup_class(self): """ Setup for testing. FLRW is abstract, so tests are done on a subclass. """ super().setup_class(self) # make sure SubCosmology is known _COS...
TestFLRW
python
dagster-io__dagster
python_modules/libraries/dagster-shared/dagster_shared/yaml_utils/source_position.py
{ "start": 294, "end": 460 }
class ____(NamedTuple): filename: str start: LineCol end: LineCol def __str__(self): return f"{self.filename}:{self.start.line}"
SourcePosition
python
davidhalter__parso
parso/python/tree.py
{ "start": 15795, "end": 19347 }
class ____(ClassOrFunc): """ Used to store the parsed contents of a python function. Children:: 0. <Keyword: def> 1. <Name> 2. parameter list (including open-paren and close-paren <Operator>s) 3. or 5. <Operator: :> 4. or 6. Node() representing function body ...
Function
python
facebook__pyre-check
tools/generate_taint_models/model.py
{ "start": 1204, "end": 5133 }
class ____(Model): callable_name: str parameters: List[Parameter] annotations: AnnotationSpecification whitelist: WhitelistSpecification returns: Optional[str] = None def __init__( self, parameter_annotation: Optional[ParameterAnnotation] = None, returns: Optional[str] =...
RawCallableModel
python
huggingface__transformers
tests/models/exaone4/test_modeling_exaone4.py
{ "start": 1224, "end": 1357 }
class ____(CausalLMModelTester): if is_torch_available(): base_model_class = Exaone4Model @require_torch
Exaone4ModelTester
python
openai__openai-python
src/openai/types/audio/transcription_word.py
{ "start": 155, "end": 367 }
class ____(BaseModel): end: float """End time of the word in seconds.""" start: float """Start time of the word in seconds.""" word: str """The text content of the word."""
TranscriptionWord
python
google__pytype
pytype/overlays/special_builtins.py
{ "start": 2879, "end": 3909 }
class ____(abstract.PyTDFunction): """Implementation of functions in builtins.pytd.""" _NAME: str = None @classmethod def make(cls, ctx): assert cls._NAME return super().make(cls._NAME, ctx, "builtins") @classmethod def make_alias(cls, name, ctx, module): return super().make(name, ctx, module...
BuiltinFunction
python
django__django
tests/custom_lookups/tests.py
{ "start": 27442, "end": 27974 }
class ____(TestCase): def test_subquery_usage(self): with register_lookup(models.IntegerField, Div3Transform): Author.objects.create(name="a1", age=1) a2 = Author.objects.create(name="a2", age=2) Author.objects.create(name="a3", age=3) Author.objects.create(na...
SubqueryTransformTests
python
nedbat__coveragepy
tests/test_json.py
{ "start": 452, "end": 27739 }
class ____(UsingModulesMixin, CoverageTest): """Tests of the JSON reports from coverage.py.""" def _assert_expected_json_report( self, cov: Coverage, expected_result: dict[str, Any], ) -> None: """ Helper that creates an example file for most tests. """ ...
JsonReportTest
python
walkccc__LeetCode
solutions/1792. Maximum Average Pass Ratio/1792.py
{ "start": 0, "end": 681 }
class ____: def maxAverageRatio( self, classes: list[list[int]], extraStudents: int, ) -> float: def extraPassRatio(pas: int, total: int) -> float: """Returns the extra pass ratio if a brilliant student joins.""" return (pas + 1) / (total + 1) - pas / total maxHeap = [(-extraP...
Solution
python
spack__spack
lib/spack/spack/package_base.py
{ "start": 19802, "end": 19929 }
class ____: def __init__(self, source, binary): self.source = source self.binary = binary
DisableRedistribute
python
keras-team__keras
keras/src/ops/numpy_test.py
{ "start": 334232, "end": 339331 }
class ____(testing.TestCase): def test_histogram_default_args(self): hist_op = knp.histogram input_tensor = np.random.rand(8) # Expected output expected_counts, expected_edges = np.histogram(input_tensor) counts, edges = hist_op(input_tensor) self.assertEqual(count...
HistogramTest
python
tornadoweb__tornado
tornado/test/web_test.py
{ "start": 26064, "end": 26450 }
class ____(RequestHandler): def prepare(self): if self.get_argument("source", None) == "query": method = self.get_query_argument elif self.get_argument("source", None) == "body": method = self.get_body_argument else: method = self.get_argument # type: ign...
GetArgumentHandler
python
allegroai__clearml
clearml/backend_api/services/v2_9/projects.py
{ "start": 88259, "end": 90634 }
class ____(Response): """ Response of projects.update endpoint. :param updated: Number of projects updated (0 or 1) :type updated: int :param fields: Updated fields names and values :type fields: dict """ _service = "projects" _action = "update" _version = "2.9" _schema = {...
UpdateResponse
python
joke2k__faker
faker/providers/person/el_GR/__init__.py
{ "start": 44, "end": 47359 }
class ____(PersonProvider): formats_male = ( "{{first_name_male}} {{last_name_male}}", "{{first_name_male}} {{last_name_male}}", "{{first_name_male}} {{last_name_male}}", "{{first_name_male}} {{last_name_male}}", "{{first_name_male}} {{last_name_male}}", "{{first_name...
Provider
python
run-llama__llama_index
llama-index-core/llama_index/core/schema.py
{ "start": 5850, "end": 6351 }
class ____(BaseComponent, DispatcherSpanMixin): """Base class for transform components.""" model_config = ConfigDict(arbitrary_types_allowed=True) @abstractmethod def __call__(self, nodes: Sequence[BaseNode], **kwargs: Any) -> Sequence[BaseNode]: """Transform nodes.""" async def acall( ...
TransformComponent
python
astropy__astropy
astropy/utils/masked/tests/test_function_helpers.py
{ "start": 33558, "end": 34626 }
class ____(MaskedArraySetup): def test_outer(self): result = np.outer(self.ma, self.mb) expected_data = np.outer(self.a.ravel(), self.b.ravel()) expected_mask = np.logical_or.outer(self.mask_a.ravel(), self.mask_b.ravel()) assert_array_equal(result.unmasked, expected_data) as...
TestOuterLikeFunctions
python
python__mypy
mypyc/test-data/fixtures/ir.py
{ "start": 1299, "end": 1640 }
class ____: __class__: type def __new__(cls) -> Self: pass def __init__(self) -> None: pass def __eq__(self, x: object) -> bool: pass def __ne__(self, x: object) -> bool: pass def __str__(self) -> str: pass def __setattr__(self, k: str, v: object) -> None: pass def __delattr__(self, k: s...
object
python
walkccc__LeetCode
solutions/3413. Maximum Coins From K Consecutive Bags/3413.py
{ "start": 0, "end": 903 }
class ____: def maximumCoins(self, coins: list[list[int]], k: int) -> int: return max(self._slide(coins, k), self._slide([[-r, -l, c] for l, r, c in coins], k)) def _slide(self, coins: list[list[int]], k: int) -> int: coins.sort() res = 0 windowSum = 0 j = 0 for li, ri, ci in...
Solution
python
instagram__MonkeyType
monkeytype/typing.py
{ "start": 16079, "end": 16385 }
class ____(TypeRewriter): """Returns an Iterator, if the send_type and return_type of a Generator is None""" def rewrite_Generator(self, typ): args = typ.__args__ if args[1] is NoneType and args[2] is NoneType: return Iterator[args[0]] return typ
RewriteGenerator
python
kamyu104__LeetCode-Solutions
Python/divide-an-array-into-subarrays-with-minimum-cost-ii.py
{ "start": 1724, "end": 3851 }
class ____(object): def minimumCost(self, nums, k, dist): """ :type nums: List[int] :type k: int :type dist: int :rtype: int """ def get_top(heap, cnt, total): while heap[0] in cnt: x = heapq.heappop(heap) cnt[x] -= ...
Solution2
python
apache__airflow
airflow-core/src/airflow/models/crypto.py
{ "start": 1019, "end": 1365 }
class ____(Protocol): """This class is only used for TypeChecking (for IDEs, mypy, etc).""" is_encrypted: bool def decrypt(self, msg: bytes | str, ttl: int | None = None) -> bytes: """Decrypt with Fernet.""" ... def encrypt(self, msg: bytes) -> bytes: """Encrypt with Fernet.""...
FernetProtocol
python
PrefectHQ__prefect
src/prefect/server/services/late_runs.py
{ "start": 1154, "end": 5053 }
class ____(LoopService): """ Finds flow runs that are later than their scheduled start time A flow run is defined as "late" if has not scheduled within a certain amount of time after its scheduled start time. The exact amount is configurable in Prefect REST API Settings. """ @classmethod ...
MarkLateRuns
python
encode__django-rest-framework
rest_framework/exceptions.py
{ "start": 4085, "end": 4802 }
class ____(APIException): status_code = status.HTTP_400_BAD_REQUEST default_detail = _('Invalid input.') default_code = 'invalid' def __init__(self, detail=None, code=None): if detail is None: detail = self.default_detail if code is None: code = self.default_code...
ValidationError
python
pyca__cryptography
tests/hazmat/primitives/test_sm4.py
{ "start": 698, "end": 1182 }
class ____: test_ecb = generate_encrypt_test( load_nist_vectors, os.path.join("ciphers", "SM4"), ["draft-ribose-cfrg-sm4-10-ecb.txt"], lambda key, **kwargs: algorithms.SM4(binascii.unhexlify(key)), lambda **kwargs: modes.ECB(), ) @pytest.mark.supported( only_if=lamb...
TestSM4ModeECB
python
ansible__ansible
test/lib/ansible_test/_internal/cli/argparsing/parsers.py
{ "start": 6849, "end": 7180 }
class ____(enum.Flag): """Acceptable condition(s) for matching user input to available choices.""" CHOICE = enum.auto() """Match any choice.""" ANY = enum.auto() """Match any non-empty string.""" NOTHING = enum.auto() """Match an empty string which is not followed by a boundary match."""
MatchConditions
python
apache__airflow
task-sdk/src/airflow/sdk/definitions/connection.py
{ "start": 3329, "end": 13443 }
class ____: """ A connection to an external data source. :param conn_id: The connection ID. :param conn_type: The connection type. :param description: The connection description. :param host: The host. :param login: The login. :param password: The password. :param schema: The schema...
Connection
python
huggingface__transformers
src/transformers/models/lfm2_moe/modular_lfm2_moe.py
{ "start": 1808, "end": 1870 }
class ____(Lfm2RotaryEmbedding): pass
Lfm2MoeRotaryEmbedding
python
pydantic__pydantic
pydantic-core/tests/validators/test_is_instance.py
{ "start": 2062, "end": 2388 }
class ____(type): def __instancecheck__(self, instance) -> bool: if 'error' in repr(instance): # an error here comes from a problem in the schema, not in the input value, so raise as internal error raise TypeError('intentional error') return 'true' in repr(instance)
HasIsInstanceMeta
python
pyca__cryptography
tests/hazmat/primitives/test_hashes.py
{ "start": 2281, "end": 2538 }
class ____: test_sha384 = generate_base_hash_test( hashes.SHA384(), digest_size=48, ) @pytest.mark.supported( only_if=lambda backend: backend.hash_supported(hashes.SHA512()), skip_message="Does not support SHA512", )
TestSHA384
python
sympy__sympy
sympy/physics/quantum/tests/test_state.py
{ "start": 966, "end": 1086 }
class ____(Ket): @classmethod def default_args(self): return ("r", "theta", "phi")
CustomKetMultipleLabels
python
google__pytype
pytype/module_utils_test.py
{ "start": 160, "end": 1907 }
class ____(unittest.TestCase): """Test module utilities.""" def test_get_absolute_name(self): test_cases = [ ("x.y", "a.b", "x.y.a.b"), ("", "a.b", "a.b"), ("x.y", ".a.b", "x.y.a.b"), ("x.y", "..a.b", "x.a.b"), ("x.y", "...a.b", None), ] for prefix, name, expecte...
ModuleUtilsTest
python
PrefectHQ__prefect
src/prefect/client/schemas/sorting.py
{ "start": 1925, "end": 2184 }
class ____(AutoEnum): """Defines artifact collection sorting options.""" CREATED_DESC = AutoEnum.auto() UPDATED_DESC = AutoEnum.auto() ID_DESC = AutoEnum.auto() KEY_DESC = AutoEnum.auto() KEY_ASC = AutoEnum.auto()
ArtifactCollectionSort
python
ray-project__ray
python/ray/dashboard/modules/reporter/tests/test_gpu_providers.py
{ "start": 18806, "end": 24856 }
class ____(unittest.TestCase): """Test GpuMetricProvider class.""" def setUp(self): """Set up test fixtures.""" self.provider = GpuMetricProvider() def test_init(self): """Test GpuMetricProvider initialization.""" self.assertIsNone(self.provider._provider) self.asse...
TestGpuMetricProvider
python
python-openxml__python-docx
tests/image/test_png.py
{ "start": 546, "end": 1980 }
class ____: def it_can_construct_from_a_png_stream(self, stream_, _PngParser_, png_parser_, Png__init__): px_width, px_height, horz_dpi, vert_dpi = 42, 24, 36, 63 png_parser_.px_width = px_width png_parser_.px_height = px_height png_parser_.horz_dpi = horz_dpi png_parser_.ver...
DescribePng
python
PyCQA__pylint
tests/functional/a/alternative/alternative_union_syntax_error.py
{ "start": 2293, "end": 2385 }
class ____(TypedDict): my_var: int | str # [unsupported-binary-operation]
CustomTypedDict3
python
python-poetry__poetry
src/poetry/utils/helpers.py
{ "start": 4514, "end": 12442 }
class ____: def __init__( self, url: str, dest: Path, session: Authenticator | Session | None = None, max_retries: int = 0, ): self._dest = dest self._max_retries = max_retries self._session = session or get_default_authenticator() self._ur...
Downloader
python
allegroai__clearml
clearml/backend_api/services/v2_23/tasks.py
{ "start": 528199, "end": 533787 }
class ____(Request): """ Update task's runtime parameters :param task: ID of the task :type task: str :param name: Task name Unique within the company. :type name: str :param tags: User-defined tags list :type tags: Sequence[str] :param system_tags: System tags list. This field is r...
UpdateRequest
python
hynek__structlog
src/structlog/processors.py
{ "start": 8390, "end": 10124 }
class ____: """ Render the ``event_dict`` using ``serializer(event_dict, **dumps_kw)``. Args: dumps_kw: Are passed unmodified to *serializer*. If *default* is passed, it will disable support for ``__structlog__``-based serialization. serializer: A :func...
JSONRenderer
python
PyCQA__pylint
tests/functional/a/arguments.py
{ "start": 2500, "end": 2769 }
class ____: """ Regression """ if sys.version_info > (3,): def __new__(cls): """ empty """ return object.__new__(cls) else: def __new__(cls): """ empty """ return object.__new__(cls) Text()
Text
python
keras-team__keras
keras/src/legacy/layers.py
{ "start": 1923, "end": 4673 }
class ____(Layer): """DEPRECATED.""" def __init__(self, factor, interpolation="bilinear", seed=None, **kwargs): super().__init__(**kwargs) self.seed_generator = backend.random.SeedGenerator(seed) self.factor = factor if isinstance(factor, (tuple, list)): self.height_...
RandomHeight
python
django__django
django/db/models/expressions.py
{ "start": 64351, "end": 68314 }
class ____(Expression): template = "%(expression)s %(ordering)s" conditional = False constraint_validation_compatible = False allows_composite_expressions = True def __init__(self, expression, descending=False, nulls_first=None, nulls_last=None): if nulls_first and nulls_last: r...
OrderBy
python
streamlit__streamlit
lib/streamlit/runtime/caching/cached_message_replay.py
{ "start": 1968, "end": 2145 }
class ____: message: Block id_of_dg_called_on: str returned_dgs_id: str MsgData: TypeAlias = ElementMsgData | BlockMsgData R = TypeVar("R") @dataclass
BlockMsgData
python
ray-project__ray
rllib/env/vector_env.py
{ "start": 8349, "end": 14448 }
class ____(VectorEnv): """Internal wrapper to translate any gym.Envs into a VectorEnv object.""" def __init__( self, make_env: Optional[Callable[[int], EnvType]] = None, existing_envs: Optional[List[gym.Env]] = None, num_envs: int = 1, *, observation_space: Optio...
_VectorizedGymEnv
python
spyder-ide__spyder
spyder/plugins/console/widgets/main_widget.py
{ "start": 2151, "end": 2243 }
class ____: Run = 'run_section' Quit = 'quit_section'
ConsoleWidgetOptionsMenuSections
python
mlflow__mlflow
mlflow/genai/labeling/stores.py
{ "start": 7491, "end": 10361 }
class ____: """ Scheme-based registry for labeling store implementations. This class allows the registration of a function or class to provide an implementation for a given scheme of `store_uri` through the `register` methods. Implementations declared though the entrypoints `mlflow.labeling_sto...
LabelingStoreRegistry
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/operators/test_sagemaker_base.py
{ "start": 2022, "end": 7928 }
class ____: ERROR_WHEN_RESOURCE_NOT_FOUND = ClientError({"Error": {"Code": "ValidationException"}}, "op") def setup_method(self): self.sagemaker = SageMakerBaseOperator(task_id="test_sagemaker_operator", config=CONFIG) self.sagemaker.aws_conn_id = "aws_default" def test_parse_integer(self)...
TestSageMakerBaseOperator
python
pytorch__pytorch
test/torch_np/test_basic.py
{ "start": 11932, "end": 12745 }
class ____(TestCase): def test_copyto_basic(self): dst = w.empty(4) src = w.arange(4) w.copyto(dst, src) assert (dst == src).all() def test_copytobcast(self): dst = w.empty((4, 2)) src = w.arange(4) # cannot broadcast => error out with assert_rai...
TestCopyTo
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_bar08.py
{ "start": 315, "end": 1491 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_bar08.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got_f...
TestCompareXLSXFiles
python
dagster-io__dagster
python_modules/dagster/dagster/_core/errors.py
{ "start": 8771, "end": 11363 }
class ____(DagsterError): """Indicates that previous step outputs required for an execution step to proceed are not available. """ def __init__(self, *args, **kwargs): self.step_key = check.str_param(kwargs.pop("step_key"), "step_key") self.output_name = check.str_param(kwargs.pop("outp...
DagsterStepOutputNotFoundError
python
django__django
django/forms/widgets.py
{ "start": 1366, "end": 1437 }
class ____(RuntimeWarning): pass @html_safe
MediaOrderConflictWarning
python
spack__spack
lib/spack/spack/test/database.py
{ "start": 20735, "end": 47562 }
class ____: """Provide a function which can execute in a separate process that removes a spec from the database. """ def __call__(self): # check that other process can read DB _check_db_sanity(spack.store.STORE.db) with spack.store.STORE.db.write_transaction(): _mock...
ReadModify
python
cython__cython
Cython/Compiler/ExprNodes.py
{ "start": 298219, "end": 298747 }
class ____(ExprNode): subexprs = [] def __init__(self, pos, py_name, cname, func_type, utility_code = None): ExprNode.__init__(self, pos, name=py_name, cname=cname, type=func_type, utility_code=utility_code) def analyse_types(self, env): return self def gener...
PythonCapiFunctionNode
python
prabhupant__python-ds
data_structures/heap/kth_largest_element_in_stream.py
{ "start": 837, "end": 1794 }
class ____: def __init__(self, k): self.heap = [] self.stream = [] self.k = k self.curr_min = None heapify(self.heap) def insert(self, x): self.stream.append(x) if len(self.heap) < self.k: # when the heap is empty or size is less than K hea...
Stream
python
pytorch__pytorch
test/torch_np/test_basic.py
{ "start": 4640, "end": 5977 }
class ____(TestCase): """Smoke test of functions (array_like, shape_like) -> array_like""" def setUp(self): self.shape = (2, 3) self.shape_arg_name = { w.reshape: "newshape", } # reshape expects `newshape` @parametrize("func", arr_shape_funcs) def test_andshape_ten...
TestOneArrAndShape
python
tensorflow__tensorflow
tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py
{ "start": 79748, "end": 86269 }
class ____(test_util.TensorFlowTestCase): @test_util.run_deprecated_v1 def testBroadcastToBasic(self): for dtype in [np.uint8, np.uint16, np.int8, np.int16, np.int32, np.int64]: with self.session(use_gpu=True): x = np.array([1, 2, 3], dtype=dtype) v_tf = array_ops.broadcast_to(constant_op...
BroadcastToTest
python
fluentpython__example-code-2e
24-class-metaprog/tinyenums/nanoenum_demo.py
{ "start": 163, "end": 221 }
class ____(NanoEnum): cocoa coconut vanilla
Flavor
python
scikit-learn__scikit-learn
asv_benchmarks/benchmarks/decomposition.py
{ "start": 270, "end": 811 }
class ____(Transformer, Estimator, Benchmark): """ Benchmarks for PCA. """ param_names = ["svd_solver"] params = (["full", "arpack", "randomized"],) def setup_cache(self): super().setup_cache() def make_data(self, params): return _mnist_dataset() def make_estimator(se...
PCABenchmark
python
django-import-export__django-import-export
tests/core/admin.py
{ "start": 3211, "end": 4801 }
class ____(ExportActionModelAdmin, ImportExportModelAdmin): """Example usage of custom import / export forms""" resource_classes = [EBookResource] import_form_class = CustomImportForm confirm_form_class = CustomConfirmImportForm export_form_class = CustomExportForm def get_confirm_form_initial...
CustomBookAdmin
python
python-markdown__markdown
markdown/inlinepatterns.py
{ "start": 36481, "end": 36776 }
class ____(ImageReferenceInlineProcessor): """ Short form of image reference: `![ref]`. """ def evalId(self, data: str, index: int, text: str) -> tuple[str, int, bool]: """Evaluate the id of `[ref]`. """ return text.lower(), index, True
ShortImageReferenceInlineProcessor
python
huggingface__transformers
src/transformers/models/blt/modular_blt.py
{ "start": 11537, "end": 11691 }
class ____(MllamaTextSelfAttention): def __init__(self, config: BltConfig, layer_idx: int): super().__init__(config, layer_idx)
BltSelfAttention
python
realpython__materials
solid-principles-python/printers_isp.py
{ "start": 987, "end": 1067 }
class ____(ABC): @abstractmethod def fax(self, document): pass
Fax
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/runs.py
{ "start": 2936, "end": 3139 }
class ____(graphene.Union): class Meta: types = launch_pipeline_run_result_types + pipeline_execution_error_types name = "LaunchRunReexecutionResult"
GrapheneLaunchRunReexecutionResult
python
wandb__wandb
wandb/automations/_filters/operators.py
{ "start": 5367, "end": 5550 }
class ____(BaseOp): val: Scalar = Field(alias="$gte") @override def __invert__(self) -> Lt: """Implements `~Gte(a) -> Lt(a)`.""" return Lt(val=self.val)
Gte
python
vyperlang__vyper
tests/evm_backends/base_env.py
{ "start": 752, "end": 863 }
class ____: is_success: bool logs: list[LogEntry] gas_refunded: int gas_used: int
ExecutionResult
python
huggingface__transformers
src/transformers/models/glm4v_moe/modular_glm4v_moe.py
{ "start": 11217, "end": 13740 }
class ____(Glm4vConfig): r""" This is the configuration class to store the configuration of a [`Glm4vMoeModel`]. It is used to instantiate a GLM-4.5V model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configur...
Glm4vMoeConfig
python
wntrblm__nox
nox/sessions.py
{ "start": 4763, "end": 33687 }
class ____: """The Session object is passed into each user-defined session function. This is your primary means for installing package and running commands in your Nox session. """ __slots__ = ("_runner",) def __init__(self, runner: SessionRunner) -> None: self._runner = runner @...
Session
python
spyder-ide__spyder
spyder/plugins/updatemanager/container.py
{ "start": 816, "end": 4107 }
class ____(PluginMainContainer): def __init__(self, name, plugin, parent=None): super().__init__(name, plugin, parent) self.install_on_close = False # ---- PluginMainContainer API # ------------------------------------------------------------------------- def setup(self): self...
UpdateManagerContainer
python
astropy__astropy
astropy/utils/decorators.py
{ "start": 35117, "end": 45419 }
class ____(classmethod): """ This is a method decorator that allows both an instance method and a `classmethod` to share the same name. When using `sharedmethod` on a method defined in a class's body, it may be called on an instance, or on a class. In the former case it behaves like a normal i...
sharedmethod