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
pennersr__django-allauth
allauth/headless/account/views.py
{ "start": 10423, "end": 12525 }
class ____(APIView): input_class = ResetPasswordInput def handle_invalid_input(self, input: ResetPasswordInput): if self.process and "key" in input.errors: self.process.record_invalid_attempt() return super().handle_invalid_input(input) def handle(self, request, *args, **kwargs...
ResetPasswordView
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/triggers/vertex_ai.py
{ "start": 6904, "end": 7899 }
class ____(BaseVertexAIJobTrigger): """ Make async calls to Vertex AI to check the state of a running custom training job. Return the job when it enters a completed state. """ job_type_verbose_name = "Custom Training Job" job_serializer_class = types.TrainingPipeline statuses_success = { ...
CustomTrainingJobTrigger
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/signal/fft_ops_test.py
{ "start": 1498, "end": 5666 }
class ____(test.TestCase): def _Compare_fftn( self, x, fft_length=None, axes=None, norm=None, use_placeholder=False, rtol=1e-4, atol=1e-4, ): self._CompareForward_fftn( x, fft_length, axes, norm, use_placeholder, rtol, atol ) self._CompareBackward...
BaseFFTOpsTest
python
pypa__pip
src/pip/_vendor/pyproject_hooks/_in_process/_in_process.py
{ "start": 2201, "end": 10093 }
class ____: """Implements the MetaPathFinder interface to locate modules in ``backend-path``. Since the environment provided by the frontend can contain all sorts of MetaPathFinders, the only way to ensure the backend is loaded from the right place is to prepend our own. """ def __init__(self,...
_BackendPathFinder
python
getsentry__sentry-python
tests/test_tracing_utils.py
{ "start": 307, "end": 5067 }
class ____: id: str is_sentry_sdk_frame: bool namespace: Optional[str] = None in_app_include: Optional[List[str]] = None in_app_exclude: Optional[List[str]] = None abs_path: Optional[str] = None project_root: Optional[str] = None @pytest.mark.parametrize( "test_case, expected", [ ...
ShouldBeIncludedTestCase
python
realpython__materials
gemini-cli/todolist/src/todolist/database.py
{ "start": 335, "end": 474 }
class ____(Model): name = TextField(null=False, unique=True) class Meta: database = db table_name = "lists"
TaskList
python
dask__distributed
distributed/pytest_resourceleaks.py
{ "start": 8723, "end": 10414 }
class ____(ResourceChecker, name="tracemalloc"): # Report a leak if the traced memory increased by at least this many bytes LEAK_THRESHOLD = 2**20 # Report at most this many leaks NDIFF = 5 # Report less than NDIFF leaks if they amount to less than this many bytes MIN_SIZE_DIFF = 200 * 1024 ...
TracemallocMemoryChecker
python
django__django
tests/generic_views/views.py
{ "start": 5475, "end": 5546 }
class ____(BookConfig, generic.YearArchiveView): pass
BookYearArchive
python
numba__numba
numba/tests/doc_examples/test_llvm_pass_timings.py
{ "start": 160, "end": 953 }
class ____(unittest.TestCase): def test_pass_timings(self): with override_config('LLVM_PASS_TIMINGS', True): with captured_stdout() as stdout: # magictoken.ex_llvm_pass_timings.begin import numba @numba.njit def foo(n): ...
DocsLLVMPassTimings
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/logs/events.py
{ "start": 18610, "end": 18932 }
class ____(graphene.ObjectType): class Meta: interfaces = ( GrapheneMessageEvent, GrapheneDisplayableEvent, GrapheneStepEvent, GrapheneMarkerEvent, GrapheneErrorEvent, ) name = "ResourceInitFailureEvent"
GrapheneResourceInitFailureEvent
python
pypa__pip
src/pip/_internal/cli/parser.py
{ "start": 484, "end": 3417 }
class ____(optparse.IndentedHelpFormatter): """A prettier/less verbose help formatter for optparse.""" def __init__(self, *args: Any, **kwargs: Any) -> None: # help position must be aligned with __init__.parseopts.description kwargs["max_help_position"] = 30 kwargs["indent_increment"] =...
PrettyHelpFormatter
python
getsentry__sentry
src/sentry/integrations/bitbucket_server/webhook.py
{ "start": 2056, "end": 6136 }
class ____(BitbucketServerWebhook): @property def event_type(self) -> IntegrationWebhookEventType: return IntegrationWebhookEventType.PUSH def __call__(self, event: Mapping[str, Any], **kwargs) -> None: authors = {} if not ( (organization := kwargs.get("organization")) ...
PushEventWebhook
python
sphinx-doc__sphinx
sphinx/environment/collectors/toctree.py
{ "start": 797, "end": 17603 }
class ____(EnvironmentCollector): def clear_doc(self, app: Sphinx, env: BuildEnvironment, docname: str) -> None: env.tocs.pop(docname, None) env.toc_secnumbers.pop(docname, None) env.toc_fignumbers.pop(docname, None) env.toc_num_entries.pop(docname, None) env.toctree_includes...
TocTreeCollector
python
Unity-Technologies__ml-agents
ml-agents/mlagents/trainers/torch_entities/components/reward_providers/rnd_reward_provider.py
{ "start": 616, "end": 2110 }
class ____(BaseRewardProvider): """ Implementation of Random Network Distillation : https://arxiv.org/pdf/1810.12894.pdf """ def __init__(self, specs: BehaviorSpec, settings: RNDSettings) -> None: super().__init__(specs, settings) self._ignore_done = True self._random_network = ...
RNDRewardProvider
python
apache__thrift
test/py.twisted/test_suite.py
{ "start": 2705, "end": 5718 }
class ____(unittest.TestCase): @defer.inlineCallbacks def setUp(self): self.handler = TestHandler() self.processor = ThriftTest.Processor(self.handler) self.pfactory = TBinaryProtocol.TBinaryProtocolFactory() self.server = reactor.listenTCP( 0, TTwisted.ThriftServer...
ThriftTestCase
python
getsentry__sentry
src/sentry/api/serializers/models/group.py
{ "start": 29904, "end": 30248 }
class ____(Protocol): def __call__( self, project_ids: Sequence[int], group_id_list: Sequence[int], environment_ids: Sequence[int], key: str, value: str, tenant_ids: dict[str, str | int] | None = None, ) -> Mapping[int, GroupTagValue]: ... @register(Grou...
_EnvironmentSeenStatsFunc
python
python__mypy
test-data/unit/plugins/attrhook2.py
{ "start": 164, "end": 1165 }
class ____(Plugin): def get_attribute_hook(self, fullname: str) -> Callable[[AttributeContext], Type] | None: if fullname == "m.Magic.magic_field": return magic_field_callback if fullname == "m.Magic.nonexistent_field": return nonexistent_field_callback if fullname ==...
AttrPlugin
python
python-excel__xlwt
xlwt/antlr.py
{ "start": 21406, "end": 22100 }
class ____(CommonToken): def __init__(self,*args): CommonToken.__init__(self,*args) self.hiddenBefore = None self.hiddenAfter = None def getHiddenAfter(self): return self.hiddenAfter def getHiddenBefore(self): return self.hiddenBefore def setHiddenAfter(self,t...
CommonHiddenStreamToken
python
anthropics__anthropic-sdk-python
src/anthropic/types/beta/beta_text_editor_code_execution_view_result_block.py
{ "start": 247, "end": 548 }
class ____(BaseModel): content: str file_type: Literal["text", "image", "pdf"] num_lines: Optional[int] = None start_line: Optional[int] = None total_lines: Optional[int] = None type: Literal["text_editor_code_execution_view_result"]
BetaTextEditorCodeExecutionViewResultBlock
python
aio-libs__aiohttp
tests/test_multipart.py
{ "start": 2740, "end": 4274 }
class ____: def test_at_eof(self) -> None: m_resp = mock.create_autospec(aiohttp.ClientResponse, spec_set=True) m_stream = mock.create_autospec(MultipartReader, spec_set=True) wrapper = MultipartResponseWrapper(m_resp, m_stream) wrapper.at_eof() assert m_resp.content.at_eof.c...
TestMultipartResponseWrapper
python
altair-viz__altair
altair/vegalite/v6/schema/_config.py
{ "start": 65470, "end": 66460 }
class ____(TypedDict, total=False): """ :class:`altair.BindDirect` ``TypedDict`` wrapper. Parameters ---------- element An input element that exposes a *value* property and supports the `EventTarget <https://developer.mozilla.org/en-US/docs/Web/API/EventTarget>`__ interface, or a ...
BindDirectKwds
python
django__django
tests/forms_tests/tests/test_forms.py
{ "start": 208121, "end": 208277 }
class ____(DjangoTemplates): form_template_name = "forms_tests/form_snippet.html" field_template_name = "forms_tests/custom_field.html"
CustomRenderer
python
PrefectHQ__prefect
src/integrations/prefect-aws/tests/observers/test_ecs_observer.py
{ "start": 33759, "end": 41424 }
class ____: @pytest.fixture def sample_event(self): return { "detail": { "taskArn": "arn:aws:ecs:us-east-1:123456789:task/cluster/task-id", "containers": [ {"name": "prefect", "exitCode": 1}, {"name": "sidecar", "exitCod...
TestMarkRunsAsCrashed
python
ray-project__ray
python/ray/tune/tests/tutorial.py
{ "start": 491, "end": 6333 }
class ____(nn.Module): def __init__(self): super(ConvNet, self).__init__() # In this example, we don't change the model architecture # due to simplicity. self.conv1 = nn.Conv2d(1, 3, kernel_size=3) self.fc = nn.Linear(192, 10) def forward(self, x): x = F.relu(F.m...
ConvNet
python
scrapy__scrapy
tests/test_pipelines.py
{ "start": 772, "end": 1009 }
class ____: def open_spider(self, spider): pass def close_spider(self, spider): pass def process_item(self, item, spider): item["pipeline_passed"] = True return item
DeprecatedSpiderArgPipeline
python
encode__django-rest-framework
rest_framework/fields.py
{ "start": 51578, "end": 53695 }
class ____(Field): default_error_messages = { 'invalid_choice': _('"{input}" is not a valid choice.') } html_cutoff = None html_cutoff_text = _('More than {count} items...') def __init__(self, choices, **kwargs): self.choices = choices self.html_cutoff = kwargs.pop('html_cut...
ChoiceField
python
jina-ai__jina
jina/proto/docarray_v1/pb/jina_pb2_grpc.py
{ "start": 17788, "end": 18798 }
class ____(object): """* jina gRPC service to trigger a snapshot at the Executor Runtime. """ def snapshot(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not impl...
JinaExecutorSnapshotServicer
python
falconry__falcon
tests/_wsgi_test_app.py
{ "start": 108, "end": 739 }
class ____: def on_post(self, req, resp): parts = {} for part in req.media: # NOTE(vytas): SHA1 is no longer recommended for cryptographic # purposes, but here we are only using it for integrity checking. sha1 = hashlib.sha1() while True: ...
Forms
python
readthedocs__readthedocs.org
readthedocs/organizations/tests/test_filters.py
{ "start": 4962, "end": 10974 }
class ____(OrganizationFilterTestCase): def get_filterset_for_user(self, user, organization, data=None, **kwargs): self.client.force_login(user) url = reverse("organization_detail", kwargs={"slug": organization.slug}) resp = self.client.get(url, data=data) return resp.context_data.ge...
TestOrganizationProjectFilterSet
python
getsentry__sentry
src/sentry/integrations/slack/analytics.py
{ "start": 513, "end": 646 }
class ____(BaseNotificationSent): pass @analytics.eventclass("integrations.slack.identity_linked")
SlackIntegrationNotificationSent
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/array_ops/init_ops_test.py
{ "start": 12283, "end": 14176 }
class ____(test.TestCase): @test_util.run_deprecated_v1 def testInitializerIdentical(self): for dtype in [dtypes.float32, dtypes.float64]: init1 = init_ops.uniform_unit_scaling_initializer(seed=1, dtype=dtype) init2 = init_ops.uniform_unit_scaling_initializer(seed=1, dtype=dtype) self.assertT...
UniformUnitScalingInitializationTest
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/schedule_definition.py
{ "start": 3396, "end": 6028 }
class ____(Enum): RUNNING = "RUNNING" STOPPED = "STOPPED" def get_or_create_schedule_context( fn: Callable[..., Any], *args: Any, **kwargs: Any ) -> "ScheduleEvaluationContext": """Based on the passed resource function and the arguments passed to it, returns the user-passed ScheduleEvaluationConte...
DefaultScheduleStatus
python
pytorch__pytorch
test/jit/test_module_interface.py
{ "start": 960, "end": 22829 }
class ____(JitTestCase): def test_not_submodule_interface_call(self): @torch.jit.interface class ModuleInterface(nn.Module): def one(self, inp1: Tensor, inp2: Tensor) -> Tensor: pass class TestNotModuleInterfaceCall(nn.Module): proxy_mod: ModuleInterf...
TestModuleInterface
python
spack__spack
lib/spack/spack/vendor/attr/exceptions.py
{ "start": 33, "end": 369 }
class ____(AttributeError): """ A frozen/immutable instance or attribute have been attempted to be modified. It mirrors the behavior of ``namedtuples`` by using the same error message and subclassing `AttributeError`. .. versionadded:: 20.1.0 """ msg = "can't set attribute" args =...
FrozenError
python
getsentry__sentry
tests/sentry/users/models/test_user.py
{ "start": 2730, "end": 7534 }
class ____(TestCase): def setUp(self) -> None: super().setUp() self.user = self.create_user() self.user_id = self.user.id # Organization membership determines which regions the deletion will cascade to self.organization = self.create_organization(region=_TEST_REGIONS[0]) ...
UserHybridCloudDeletionTest
python
getsentry__sentry
src/sentry/audit_log/events.py
{ "start": 12782, "end": 13202 }
class ____(AuditLogEvent): def __init__(self) -> None: super().__init__( event_id=130, name="INTERNAL_INTEGRATION_ADD", api_name="internal-integration.create" ) def render(self, audit_log_entry: AuditLogEntry) -> str: integration_name = audit_log_entry.data.get("name") or ""...
InternalIntegrationAddAuditLogEvent
python
tiangolo__fastapi
docs_src/body_nested_models/tutorial007.py
{ "start": 384, "end": 581 }
class ____(BaseModel): name: str description: Union[str, None] = None price: float items: List[Item] @app.post("/offers/") async def create_offer(offer: Offer): return offer
Offer
python
getsentry__sentry
src/sentry/backup/findings.py
{ "start": 911, "end": 5044 }
class ____(FindingKind): Unknown = auto() # The instances of a particular model did not maintain total ordering of pks (that is, pks did not appear in ascending order, or appear multiple times). UnorderedInput = auto() # Multiple instances of the same custom ordinal signature exist in the input. D...
ComparatorFindingKind
python
python__mypy
mypy/test/testmodulefinder.py
{ "start": 328, "end": 5627 }
class ____(Suite): def setUp(self) -> None: self.search_paths = SearchPaths( python_path=(), mypy_path=( os.path.join(data_path, "nsx-pkg1"), os.path.join(data_path, "nsx-pkg2"), os.path.join(data_path, "nsx-pkg3"), os.p...
ModuleFinderSuite
python
Textualize__textual
tests/text_area/test_escape_binding.py
{ "start": 129, "end": 360 }
class ____(ModalScreen): BINDINGS = [("escape", "dismiss")] def compose(self) -> ComposeResult: yield TextArea( tab_behavior="focus", # the default ) yield Button("Submit")
TextAreaDialog
python
encode__django-rest-framework
tests/test_request.py
{ "start": 10422, "end": 13184 }
class ____(TestCase): def test_repr(self): http_request = factory.get('/path') request = Request(http_request) assert repr(request) == "<rest_framework.request.Request: GET '/path'>" def test_attribute_access_proxy(self): http_request = factory.get('/') request = Reques...
TestHttpRequest
python
huggingface__transformers
src/transformers/models/lfm2_moe/modeling_lfm2_moe.py
{ "start": 27082, "end": 29217 }
class ____(GradientCheckpointingLayer): def __init__(self, config: Lfm2MoeConfig, layer_idx: int): super().__init__() self.is_attention_layer = config.layer_types[layer_idx] == "full_attention" if self.is_attention_layer: self.self_attn = Lfm2MoeAttention(config, layer_idx) ...
Lfm2MoeDecoderLayer
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/event/registry.py
{ "start": 6130, "end": 11144 }
class ____(Generic[_ET]): """Represent :func:`.listen` arguments.""" __slots__ = ( "target", "identifier", "fn", "fn_key", "fn_wrap", "dispatch_target", ) target: _ET identifier: str fn: _ListenerFnType fn_key: _ListenerFnKeyType dispatch...
_EventKey
python
getsentry__sentry
src/sentry/issues/endpoints/project_user_issue.py
{ "start": 5253, "end": 5568 }
class ____(serializers.Serializer): transaction = serializers.CharField(required=True) issueType = serializers.ChoiceField(required=True, choices=ISSUE_TYPE_CHOICES) traceId = serializers.CharField(required=False) timestamp = serializers.DateTimeField(required=False)
ProjectUserIssueRequestSerializer
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/alloy_db.py
{ "start": 27934, "end": 33462 }
class ____(AlloyDBWriteBaseOperator): """ Update an Alloy DB instance. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:AlloyDBUpdateInstanceOperator` :param cluster_id: Required. ID of the cluster. :param instance_id: Re...
AlloyDBUpdateInstanceOperator
python
neetcode-gh__leetcode
python/0100-same-tree.py
{ "start": 164, "end": 479 }
class ____: def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool: if not p and not q: return True if p and q and p.val == q.val: return self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right) else: return False
Solution
python
pandas-dev__pandas
pandas/tests/indexing/test_iloc.py
{ "start": 841, "end": 1606 }
class ____: @pytest.mark.parametrize("key", [2, -1, [0, 1, 2]]) @pytest.mark.parametrize( "index", [ Index(list("abcd"), dtype=object), Index([2, 4, "null", 8], dtype=object), date_range("20130101", periods=4), Index(range(0, 8, 2), dtype=np.float6...
TestiLoc
python
pytorch__pytorch
test/functorch/test_control_flow.py
{ "start": 335354, "end": 338948 }
class ____(torch.nn.Module): def forward(self, x): x: "f32[s6, 3]"; x, = fx_pytree.tree_flatten_spec(([x], {}), self._in_spec) _guards_fn = self._guards_fn(x); _guards_fn = None sym_size_int_1: "Sym(s6)" = torch.ops.aten.sym_size.int(x, 0) sin: "f32[s6, 3]" = torch.ops.ate...
GraphModule
python
sqlalchemy__sqlalchemy
test/dialect/mysql/test_query.py
{ "start": 1198, "end": 2019 }
class ____(fixtures.TestBase): __only_on__ = "mysql", "mariadb" __backend__ = True def test_is_boolean_symbols_despite_no_native(self, connection): with expect_warnings("Datatype BOOL does not support CAST"): is_( connection.scalar(select(cast(true().is_(true()), Boolean...
IdiosyncrasyTest
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/translator.py
{ "start": 969, "end": 1308 }
class ____: RUNNING = AirbyteJobStatusType.RUNNING SUCCEEDED = AirbyteJobStatusType.SUCCEEDED CANCELLED = AirbyteJobStatusType.CANCELLED PENDING = AirbyteJobStatusType.PENDING FAILED = AirbyteJobStatusType.FAILED ERROR = AirbyteJobStatusType.ERROR INCOMPLETE = AirbyteJobStatusType.INCOMPLETE...
AirbyteState
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/ruff/RUF049.py
{ "start": 539, "end": 575 }
class ____(Enum): ... @attrs.mutable
E
python
spack__spack
lib/spack/spack/repo.py
{ "start": 70741, "end": 77867 }
class ____(Mapping[str, RepoDescriptor]): """A collection of repository descriptors.""" def __init__(self, descriptors: Dict[str, RepoDescriptor]) -> None: self.descriptors = descriptors def __getitem__(self, name: str) -> RepoDescriptor: return self.descriptors[name] def __iter__(sel...
RepoDescriptors
python
matplotlib__matplotlib
lib/matplotlib/text.py
{ "start": 59786, "end": 76107 }
class ____(Text, _AnnotationBase): """ An `.Annotation` is a `.Text` that can refer to a specific position *xy*. Optionally an arrow pointing from the text to *xy* can be drawn. Attributes ---------- xy The annotated position. xycoords The coordinate system for *xy*. arr...
Annotation
python
google__pytype
pytype/typegraph/typegraph_serializer.py
{ "start": 1884, "end": 2358 }
class ____: # Note that cfg_nodes and bindings contain all instances of their respective # types that are found in the program, while variables only contains the # Variables that have Bindings. This means lookups of variables should be # by using `find`, not by direct index access. cfg_nodes: list[SerializedC...
SerializedProgram
python
google__jax
jax/_src/numpy/indexing.py
{ "start": 27835, "end": 52827 }
class ____(NamedTuple): # The expected shape of the slice output. slice_shape: Sequence[int] # The slice shape to pass to lax.gather(). gather_slice_shape: Sequence[int] # The gather indices to use. gather_indices: ArrayLike # A GatherDimensionNumbers object describing the gather to perform. dnums: slic...
_Indexer
python
django__django
django/contrib/postgres/forms/ranges.py
{ "start": 3295, "end": 3484 }
class ____(BaseRangeField): default_error_messages = {"invalid": _("Enter two valid date/times.")} base_field = forms.DateTimeField range_type = DateTimeTZRange
DateTimeRangeField
python
huggingface__transformers
src/transformers/models/owlvit/modeling_owlvit.py
{ "start": 17283, "end": 22260 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config): super().__init__() self.config = config self.embed_dim = config.hidden_size self.num_heads = config.num_attention_heads self.head_dim = self.embed_dim /...
OwlViTAttention
python
django__django
django/db/models/fields/json.py
{ "start": 13954, "end": 17179 }
class ____(Transform): postgres_operator = "->" postgres_nested_operator = "#>" def __init__(self, key_name, *args, **kwargs): super().__init__(*args, **kwargs) self.key_name = str(key_name) def preprocess_lhs(self, compiler, connection): key_transforms = [self.key_name] ...
KeyTransform
python
getsentry__sentry
src/sentry/workflow_engine/migrations/0081_add_unique_constraint_to_detector_group.py
{ "start": 222, "end": 1711 }
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
huggingface__transformers
src/transformers/models/informer/modeling_informer.py
{ "start": 42910, "end": 52142 }
class ____(InformerPreTrainedModel): """ Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`InformerDecoderLayer`] Args: config: InformerConfig """ def __init__(self, config: InformerConfig): super().__init__(config) self.dropout = confi...
InformerDecoder
python
automl__auto-sklearn
test/test_pipeline/implementations/test_util.py
{ "start": 101, "end": 1861 }
class ____(unittest.TestCase): def test_softmax_binary(self): df = np.array( [ -40.00643897, 34.69754581, 23.71181359, -29.89724287, 27.06071791, -37.78334103, -40.15812461, ...
UtilTest
python
huggingface__transformers
src/transformers/models/sam/modeling_sam.py
{ "start": 2344, "end": 4368 }
class ____(ModelOutput): r""" iou_scores (`torch.FloatTensor` of shape `(batch_size, num_masks)`): The iou scores of the predicted masks. pred_masks (`torch.FloatTensor` of shape `(batch_size, num_masks, height, width)`): The predicted low resolutions masks. Needs to be post-processed by the...
SamImageSegmentationOutput
python
pydata__xarray
xarray/computation/rolling_exp.py
{ "start": 1460, "end": 9389 }
class ____(Generic[T_DataWithCoords]): """ Exponentially-weighted moving window object. Similar to EWM in pandas Parameters ---------- obj : Dataset or DataArray Object to window. windows : mapping of hashable to int (or float for alpha type) A mapping from the name of the d...
RollingExp
python
pandas-dev__pandas
pandas/core/arrays/integer.py
{ "start": 6264, "end": 6457 }
class ____(IntegerDtype): type = np.uint32 name: ClassVar[str] = "UInt32" __doc__ = _dtype_docstring.format(dtype="uint32") @register_extension_dtype @set_module("pandas")
UInt32Dtype
python
airbytehq__airbyte
airbyte-ci/connectors/connectors_insights/src/connectors_insights/pylint_plugins/cdk_deprecation_checkers.py
{ "start": 725, "end": 1157 }
class ____(BaseChecker): name = "forbidden-method-name-checker" msgs = { "C9001": ('Method name "%s" is forbidden', "forbidden-method-name", "Used when a forbidden method name is detected."), } def visit_functiondef(self, node: astroid.node) -> None: if node.name in FORBIDDEN_METHOD_NAM...
ForbiddenMethodNameChecker
python
huggingface__transformers
src/transformers/models/ijepa/modeling_ijepa.py
{ "start": 14554, "end": 15077 }
class ____(nn.Module): def __init__(self, config: IJepaConfig): super().__init__() self.config = config self.layer = nn.ModuleList([IJepaLayer(config) for _ in range(config.num_hidden_layers)]) self.gradient_checkpointing = False def forward(self, hidden_states: torch.Tensor) ->...
IJepaEncoder
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pycodestyle/E30.py
{ "start": 7523, "end": 8023 }
class ____: def a(self): pass # wrongly indented comment def b(self): pass # end # E303 def fn(): pass pass # end # E304 @decorator def function(): pass # end # E304 @decorator # comment E304 not expected def function(): pass # end # E304 @decorator # comment ...
Test
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/metadata/table.py
{ "start": 874, "end": 1526 }
class ____: other: PublicAttr[Sequence[str]] """Descriptor for "table-level" constraints. Presently only one property, `other` is supported. This contains strings describing arbitrary table-level constraints. A table-level constraint is a constraint defined in terms of multiple columns (e.g. col_A ...
TableConstraints
python
numba__llvmlite
llvmlite/ir/instructions.py
{ "start": 10724, "end": 11619 }
class ____(Instruction): def __init__(self, parent, cond, lhs, rhs, name='', flags=()): assert lhs.type == rhs.type super(SelectInstr, self).__init__(parent, lhs.type, "select", [cond, lhs, rhs], name=name, flags=fla...
SelectInstr
python
scipy__scipy
scipy/special/tests/test_orthogonal.py
{ "start": 8732, "end": 9998 }
class ____: def test_sh_jacobi(self): # G^(p,q)_n(x) = n! gamma(n+p)/gamma(2*n+p) * P^(p-q,q-1)_n(2*x-1) def conv(n, p): return gamma(n + 1) * gamma(n + p) / gamma(2 * n + p) psub = np.poly1d([2,-1]) q = 4 * np.random.random() p = q-1 + 2*np.random.random() ...
TestShJacobi
python
openai__openai-python
src/openai/resources/beta/assistants.py
{ "start": 23090, "end": 45007 }
class ____(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAssistantsWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www...
AsyncAssistants
python
kamyu104__LeetCode-Solutions
Python/find-the-first-player-to-win-k-games-in-a-row.py
{ "start": 42, "end": 464 }
class ____(object): def findWinningPlayer(self, skills, k): """ :type skills: List[int] :type k: int :rtype: int """ result = cnt = 0 for i in range(1, len(skills)): if skills[result] < skills[i]: result = i cnt = 0 ...
Solution
python
scikit-image__scikit-image
src/skimage/_shared/utils.py
{ "start": 6322, "end": 6663 }
class ____(metaclass=PatchClassRepr): """Signal value to help with deprecating parameters that use None. This is a proxy object, used to signal that a parameter has not been set. This is useful if ``None`` is already used for a different purpose or just to highlight a deprecated parameter in the signat...
DEPRECATED
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_observability.py
{ "start": 9620, "end": 23582 }
class ____(RuleBasedStateMachine): value = 0 @rule() def inc(self): self.value += 1 @rule() def dec(self): self.value -= 1 @invariant() def limits(self): assert abs(self.value) <= 100 @xfail_on_crosshair(Why.other, strict=False) def test_observability_captures_st...
UltraSimpleMachine
python
tensorflow__tensorflow
tensorflow/python/compiler/tensorrt/test/bool_test.py
{ "start": 1083, "end": 1987 }
class ____(trt_test.TfTrtIntegrationTestBase): """Test for boolean operations in TF-TRT.""" def GraphFn(self, x1, x2): x = math_ops.logical_and(x1, x2) x = math_ops.logical_or(x, x2) q = math_ops.not_equal(x, x2) q = math_ops.logical_not(q) return array_ops.identity(q, name="output_0") def G...
BoolTest
python
numba__numba
numba/tests/test_dispatcher.py
{ "start": 21929, "end": 22100 }
class ____(TestSignatureHandling): """ Sams as TestSignatureHandling, but in object mode. """ jit_args = dict(forceobj=True)
TestSignatureHandlingObjectMode
python
mlflow__mlflow
mlflow/types/llm.py
{ "start": 12021, "end": 13250 }
class ____(_BaseDataclass): """ Definition for function tools (currently the only supported type of tool). Args: name (str): The name of the tool. description (str): A description of what the tool does, and how it should be used. **Optional**, defaults to ``None`` parame...
FunctionToolDefinition
python
coleifer__peewee
examples/graph.py
{ "start": 116, "end": 575 }
class ____(Base): name = TextField(primary_key=True) def outgoing(self): return (Node .select(Node, Edge.weight) .join(Edge, on=Edge.dest) .where(Edge.src == self) .objects()) def incoming(self): return (Node ....
Node
python
graphql-python__graphene
graphene/utils/tests/test_dataloader.py
{ "start": 804, "end": 1115 }
class ____(ObjectType): skywalker_family = List(CharacterType) async def resolve_skywalker_family(_, info): return await info.context.character_loader.load_many(["1", "2", "3"]) mock_batch_load_fn = Mock( side_effect=lambda character_ids: [get_character(id) for id in character_ids] )
Query
python
huggingface__transformers
src/transformers/models/gemma2/modeling_gemma2.py
{ "start": 13924, "end": 16082 }
class ____(GradientCheckpointingLayer): def __init__(self, config: Gemma2Config, layer_idx: int): super().__init__() self.hidden_size = config.hidden_size self.config = config self.attention_type = config.layer_types[layer_idx] self.self_attn = Gemma2Attention(config=config, ...
Gemma2DecoderLayer
python
pypa__pipenv
pipenv/patched/pip/_internal/index/collector.py
{ "start": 8192, "end": 8817 }
class ____: """Represents one response (or page), along with its URL. :param encoding: the encoding to decode the given content. :param url: the URL from which the HTML was downloaded. :param cache_link_parsing: whether links parsed from this page's url should be cached. ...
IndexContent
python
openai__openai-python
src/openai/types/evals/run_cancel_response.py
{ "start": 6108, "end": 6798 }
class ____(BaseModel): content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent """Inputs to the model - can contain template strings.""" role: Literal["user", "assistant", "system", "developer"] """The role of the message input. One of `user`, `assistant`, `system`, or `developer`...
DataSourceResponsesInputMessagesTemplateTemplateEvalItem
python
django-extensions__django-extensions
django_extensions/db/fields/__init__.py
{ "start": 800, "end": 3122 }
class ____: def check_is_bool(self, attrname): if not isinstance(getattr(self, attrname), bool): raise ValueError("'{}' argument must be True or False".format(attrname)) @staticmethod def _get_fields(model_cls): return [ (f, f.model if f.model != model_cls else None)...
UniqueFieldMixin
python
sqlalchemy__sqlalchemy
test/typing/plain_files/orm/mapped_covariant.py
{ "start": 853, "end": 1254 }
class ____(Protocol): # Read-only for simplicity, mutable protocol members are complicated, # see https://mypy.readthedocs.io/en/latest/common_issues.html#covariant-subtyping-of-mutable-protocol-members-is-rejected @property def parent(self) -> Mapped[ParentProtocol]: ... def get_parent_name(child: Ch...
ChildProtocol
python
redis__redis-py
tests/test_asyncio/test_search.py
{ "start": 52604, "end": 53731 }
class ____(AsyncSearchTestsBase): @pytest.mark.redismod @pytest.mark.onlynoncluster @skip_ifmodversion_lt("2.2.0", "search") @skip_if_server_version_gte("7.9.0") async def test_config(self, decoded_r: redis.Redis): assert await decoded_r.ft().config_set("TIMEOUT", "100") with pytest....
TestConfig
python
plotly__plotly.py
plotly/graph_objs/layout/yaxis/_autorangeoptions.py
{ "start": 235, "end": 5864 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.yaxis" _path_str = "layout.yaxis.autorangeoptions" _valid_props = { "clipmax", "clipmin", "include", "includesrc", "maxallowed", "minallowed", } @property def clipmax(self): ...
Autorangeoptions
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/loop19.py
{ "start": 95, "end": 303 }
class ____: yyy: int def method1(self, results: list[Results]): abc = None for result in results: if abc is not None and abc.zzz < result.zzz: abc = result
Foo
python
pytorch__pytorch
torch/_inductor/fx_passes/misc_patterns.py
{ "start": 2764, "end": 5148 }
class ____: numpy_compat: dict[str, tuple[str, ...]] = { "dim": ("axis",), "keepdim": ("keepdims",), "input": ("x", "a", "x1"), "other": ("x2",), } inverse_mapping: dict[str, str] cache: dict["torch.fx.graph.Target", OrderedSet[str]] def __init__(self) -> None: ...
NumpyCompatNormalization
python
huggingface__transformers
src/transformers/models/smolvlm/modeling_smolvlm.py
{ "start": 6721, "end": 9180 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config): super().__init__() self.config = config self.embed_dim = config.hidden_size self.num_heads = config.num_attention_heads self.head_dim = self.embed_dim /...
SmolVLMVisionAttention
python
PrefectHQ__prefect
src/prefect/server/api/clients.py
{ "start": 903, "end": 2388 }
class ____: _http_client: PrefectHttpxAsyncClient def __init__(self, additional_headers: dict[str, str] | None = None): from prefect.server.api.server import create_app additional_headers = additional_headers or {} # create_app caches application instances, and invoking it with no arg...
BaseClient
python
huggingface__transformers
src/transformers/models/convbert/modeling_convbert.py
{ "start": 21600, "end": 26659 }
class ____(nn.Module): r""" Compute a single vector summary of a sequence hidden states. Args: config ([`ConvBertConfig`]): The config used by the model. Relevant arguments in the config class of the model are (refer to the actual config class of your model for the default v...
ConvBertSequenceSummary
python
pytorch__pytorch
torch/utils/benchmark/utils/compare.py
{ "start": 10712, "end": 13473 }
class ____: """Helper class for displaying the results of many measurements in a formatted table. The table format is based on the information fields provided in :class:`torch.utils.benchmark.Timer` (`description`, `label`, `sub_label`, `num_threads`, etc). The table can be directly printed us...
Compare
python
doocs__leetcode
lcof/面试题59 - II. 队列的最大值/Solution.py
{ "start": 0, "end": 707 }
class ____: def __init__(self): self.q1 = deque() self.q2 = deque() def max_value(self) -> int: return -1 if not self.q2 else self.q2[0] def push_back(self, value: int) -> None: while self.q2 and self.q2[-1] < value: self.q2.pop() self.q1.append(value) ...
MaxQueue
python
apache__airflow
airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/common.py
{ "start": 2437, "end": 2574 }
class ____(BaseModel, Generic[E, N]): """Base Graph serializer for responses.""" edges: list[E] nodes: list[N]
BaseGraphResponse
python
sqlalchemy__sqlalchemy
test/orm/test_transaction.py
{ "start": 76867, "end": 78335 }
class ____( CtxManagerJoinIntoAnExternalTransactionFixture, fixtures.MappedTest ): """2.0 only recipe for "join into an external transaction" that works without event handlers """ def setup_session(self): self.trans = self.connection.begin() if ( self.join_mode.conditi...
ReallyNewJoinIntoAnExternalTransactionTest
python
encode__django-rest-framework
tests/test_fields.py
{ "start": 57387, "end": 57673 }
class ____(FieldValues): """ Values for `TimeField` with a no output format. """ valid_inputs = {} invalid_inputs = {} outputs = { datetime.time(13, 00): datetime.time(13, 00) } field = serializers.TimeField(format=None)
TestNoOutputFormatTimeField
python
joke2k__faker
tests/providers/test_phone_number.py
{ "start": 15030, "end": 15500 }
class ____: """Test hu_HU phone number provider methods""" def test_phone_number(self, faker, num_samples): pattern: Pattern = re.compile( r"(?:" r"\+36 \d{2} |" r"\(06\)\d{2}/|" r"\(\d{2}\)/|" r"\d{2}/|" r"06-\d{1,2}/" r")\d{3}[- ]\d{4}", ) for _ in range(num_samples): ...
TestHuHu
python
pyqtgraph__pyqtgraph
tests/test_stability.py
{ "start": 1917, "end": 3340 }
class ____(pg.QtCore.QThread): '''Intended to give the gc an opportunity to run from a non-gui thread.''' def run(self): i = 0 while True: i += 1 if (i % 1000000) == 0: print('--worker--') def randItem(items): return items[randint(0, len(...
WorkThread
python
getsentry__sentry
tests/sentry/integrations/bitbucket_server/test_webhook.py
{ "start": 2799, "end": 2978 }
class ____(WebhookTestBase): def test_get_request_fails(self) -> None: self.get_error_response(self.organization.id, self.integration.id, status_code=405)
WebhookGetTest
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/job_base.py
{ "start": 1830, "end": 3098 }
class ____(IJob): def __init__( self, job_def: "JobDefinition", ): self._job_def = job_def def get_definition(self) -> "JobDefinition": return self._job_def def get_repository_definition(self) -> Optional["RepositoryDefinition"]: return None def get_subset(...
InMemoryJob