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
huggingface__transformers
tests/models/gpt_bigcode/test_modeling_gpt_bigcode.py
{ "start": 23010, "end": 25540 }
class ____(unittest.TestCase): def get_attention(self, multi_query): config = GPTBigCodeConfig.from_pretrained( "bigcode/gpt_bigcode-santacoder", multi_query=multi_query, attn_pdrop=0, resid_pdrop=0, ) # We need to set it here as it's normally ...
GPTBigCodeMQATest
python
jazzband__django-model-utils
tests/models.py
{ "start": 5974, "end": 6090 }
class ____(models.Model): content = SplitField() class Meta: abstract = True
SplitFieldAbstractParent
python
pallets__werkzeug
examples/shorty/application.py
{ "start": 463, "end": 1535 }
class ____: def __init__(self, db_uri): local.application = self self.database_engine = create_engine(db_uri, convert_unicode=True) self.dispatch = SharedDataMiddleware(self.dispatch, {"/static": STATIC_PATH}) def init_database(self): metadata.create_all(self.database_engine) ...
Shorty
python
pypa__pip
src/pip/_vendor/urllib3/exceptions.py
{ "start": 5582, "end": 5783 }
class ____(HTTPError): """ Body should be :class:`http.client.HTTPResponse` like (have an fp attribute which returns raw chunks) for read_chunked(). """ pass
BodyNotHttplibCompatible
python
getsentry__sentry
src/sentry/preprod/api/models/launchpad.py
{ "start": 710, "end": 1169 }
class ____(BaseModel): model_config = ConfigDict() state: Literal[PreprodArtifactSizeMetrics.SizeAnalysisState.PENDING] = ( PreprodArtifactSizeMetrics.SizeAnalysisState.PENDING ) # Missing SizeAnalysisState.COMPLETED is on purpose. The only way to mark # a size metrics as successful is via the ass...
PutSizePending
python
sqlalchemy__sqlalchemy
test/orm/inheritance/test_polymorphic_rel.py
{ "start": 79454, "end": 80166 }
class ____( _PolymorphicTestBase, _PolymorphicAliasedJoins ): @testing.skip_if( lambda: True, "join condition doesn't work w/ this mapping" ) def test_lazyload_related_w_cache_check(self): pass def test_with_polymorphic_two_future_default_wp(self): """test #7262 com...
PolymorphicAliasedJoinsTest
python
plotly__plotly.py
plotly/graph_objs/scattercarpet/selected/_marker.py
{ "start": 233, "end": 3615 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scattercarpet.selected" _path_str = "scattercarpet.selected.marker" _valid_props = {"color", "opacity", "size"} @property def color(self): """ Sets the marker color of selected points. The 'color' property is a color ...
Marker
python
getsentry__sentry
src/sentry/grouping/component.py
{ "start": 10423, "end": 10526 }
class ____(BaseGroupingComponent[str]): id: str = "uri" # Top-level components
URIGroupingComponent
python
python__mypy
mypy/nodes.py
{ "start": 55190, "end": 55753 }
class ____(Statement): """Operator assignment statement such as x += 1""" __slots__ = ("op", "lvalue", "rvalue") __match_args__ = ("lvalue", "op", "rvalue") op: str # TODO: Enum? lvalue: Lvalue rvalue: Expression def __init__(self, op: str, lvalue: Lvalue, rvalue: Expression) -> None: ...
OperatorAssignmentStmt
python
anthropics__anthropic-sdk-python
src/anthropic/lib/streaming/_beta_types.py
{ "start": 1480, "end": 1772 }
class ____(BaseModel): type: Literal["input_json"] partial_json: str """A partial JSON string delta e.g. `'"San Francisco,'` """ snapshot: object """The currently accumulated parsed object. e.g. `{'location': 'San Francisco, CA'}` """
BetaInputJsonEvent
python
sqlalchemy__sqlalchemy
test/base/test_result.py
{ "start": 30886, "end": 38658 }
class ____(fixtures.TestBase): """the chunkediterator supports "non tuple mode", where we bypass the expense of generating rows when we have only scalar values. """ @testing.fixture def no_tuple_fixture(self): data = [(1, 1, 1), (2, 1, 2), (1, 1, 1), (1, 3, 2), (4, 1, 2)] def chun...
OnlyScalarsTest
python
coleifer__peewee
tests/regressions.py
{ "start": 55662, "end": 58771 }
class ____(ModelTestCase): requires = [DF, DFC, DFGC] def test_django_filter_regression(self): a, b, c = [DF.create(name=n, value=i) for i, n in enumerate('abc')] ca1 = DFC.create(df=a, name='a1', value=11) ca2 = DFC.create(df=a, name='a2', value=12) cb1 = DFC.create(df=b, name=...
TestDjangoFilterRegression
python
spack__spack
lib/spack/spack/vendor/pyrsistent/_checked_types.py
{ "start": 738, "end": 4941 }
class ____(Exception): """ Exception raised from a :py:class:`CheckedType` when invariant tests fail or when a mandatory field is missing. Contains two fields of interest: invariant_errors, a tuple of error data for the failing invariants missing_fields, a tuple of strings specifying the missin...
InvariantException
python
kamyu104__LeetCode-Solutions
Python/sequential-grid-path-cover.py
{ "start": 64, "end": 1170 }
class ____(object): def findPath(self, grid, k): """ :type grid: List[List[int]] :type k: int :rtype: List[List[int]] """ DIRECTIONS = ((1, 0), (0, 1), (-1, 0), (0, -1)) def backtracking(i, j, curr): v = grid[i][j] if v and v != curr: ...
Solution
python
plotly__plotly.py
plotly/graph_objs/streamtube/_legendgrouptitle.py
{ "start": 233, "end": 2960 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "streamtube" _path_str = "streamtube.legendgrouptitle" _valid_props = {"font", "text"} @property def font(self): """ Sets this legend group's title font. The 'font' property is an instance of Font that may be s...
Legendgrouptitle
python
jmcnamara__XlsxWriter
xlsxwriter/test/worksheet/test_sparkline11.py
{ "start": 345, "end": 8987 }
class ____(unittest.TestCase): """ Test assembling a complete Worksheet file. """ def test_assemble_xml_file(self): """Test writing a worksheet with no cell data.""" self.maxDiff = None fh = StringIO() worksheet = Worksheet() worksheet._set_filehandle(fh) ...
TestAssembleWorksheet
python
apache__airflow
airflow-core/src/airflow/models/dagwarning.py
{ "start": 1421, "end": 3567 }
class ____(Base): """ A table to store DAG warnings. DAG warnings are problems that don't rise to the level of failing the DAG parse but which users should nonetheless be warned about. These warnings are recorded when parsing DAG and displayed on the Webserver in a flash message. """ dag_i...
DagWarning
python
huggingface__transformers
tests/models/idefics/test_modeling_idefics.py
{ "start": 1673, "end": 11911 }
class ____: def __init__( self, parent, batch_size=1, seq_length=7, image_size=30, patch_size=2, num_channels=3, is_training=True, use_input_mask=True, use_token_type_ids=True, use_labels=True, vocab_size=99, hid...
IdeficsModelTester
python
wandb__wandb
wandb/integration/keras/callbacks/model_checkpoint.py
{ "start": 397, "end": 8529 }
class ____(callbacks.ModelCheckpoint): """A checkpoint that periodically saves a Keras model or model weights. Saved weights are uploaded to W&B as a `wandb.Artifact`. Since this callback is subclassed from `tf.keras.callbacks.ModelCheckpoint`, the checkpointing logic is taken care of by the parent ca...
WandbModelCheckpoint
python
pydata__xarray
asv_bench/benchmarks/dataset.py
{ "start": 441, "end": 703 }
class ____: def setup(self): requires_dask() self.ds = Dataset() array = np.ones(1000) for i in range(250): self.ds[f"var{i}"] = ("x", array) def time_chunk(self): self.ds.chunk(x=(1,) * 1000)
DatasetChunk
python
Netflix__metaflow
metaflow/_vendor/click/types.py
{ "start": 10641, "end": 12481 }
class ____(FloatParamType): """A parameter that works similar to :data:`click.FLOAT` but restricts the value to fit into a range. The default behavior is to fail if the value falls outside the range, but it can also be silently clamped between the two edges. See :ref:`ranges` for an example. "...
FloatRange
python
huggingface__transformers
src/transformers/models/mobilenet_v2/modeling_mobilenet_v2.py
{ "start": 12939, "end": 15086 }
class ____(MobileNetV2PreTrainedModel): def __init__(self, config: MobileNetV2Config) -> None: super().__init__(config) self.num_labels = config.num_labels self.mobilenet_v2 = MobileNetV2Model(config) last_hidden_size = self.mobilenet_v2.conv_1x1.convolution.out_channels #...
MobileNetV2ForImageClassification
python
tiangolo__fastapi
docs_src/generate_clients/tutorial002.py
{ "start": 159, "end": 212 }
class ____(BaseModel): message: str
ResponseMessage
python
pytorch__pytorch
test/distributed/_composable/test_composability/test_pp_composability.py
{ "start": 2610, "end": 28413 }
class ____(MultiProcessTestCase): @classmethod def backend_str(cls) -> str: # Testing with NCCL backend return backend def setUp(self): super().setUp() self._spawn_processes() def tearDown(self): super().tearDown() try: os.remove(self.file_na...
ComposabilityTest
python
marshmallow-code__apispec
tests/test_ext_marshmallow.py
{ "start": 13708, "end": 48348 }
class ____: @pytest.fixture def make_pet_callback_spec(self, spec_fixture): def _make_pet_spec(operations): spec_fixture.spec.path( path="/pet", operations={ "post": {"callbacks": {"petEvent": {"petCallbackUrl": operations}}} ...
TestOperationHelper
python
redis__redis-py
redis/commands/search/reducers.py
{ "start": 1524, "end": 1798 }
class ____(FieldOnlyReducer): """ Calculate the number of distinct values contained in all the results in the group for the given field """ NAME = "COUNT_DISTINCT" def __init__(self, field: str) -> None: super().__init__(field)
count_distinct
python
Netflix__metaflow
metaflow/plugins/debug_logger.py
{ "start": 115, "end": 265 }
class ____(NullEventLogger): TYPE = "debugLogger" @classmethod def get_worker(cls): return DebugEventLoggerSidecar
DebugEventLogger
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/module_setenv_raw/package.py
{ "start": 217, "end": 555 }
class ____(Package): homepage = "http://www.spack.llnl.gov" url = "http://www.spack.llnl.gov/module-setenv-raw-1.0.tar.gz" version("1.0", "0123456789abcdef0123456789abcdef") def setup_run_environment(self, env: EnvironmentModifications) -> None: env.set("FOO", "{{name}}, {name}, {{}}, {}", raw...
ModuleSetenvRaw
python
automl__auto-sklearn
test/test_pipeline/components/regression/test_support_vector_regression.py
{ "start": 160, "end": 722 }
class ____(BaseRegressionComponentTest): __test__ = True res = dict() res["default_boston"] = -0.030006883949312613 res["default_boston_iterative"] = None res["default_boston_sparse"] = -0.062749211736050192 res["default_boston_iterative_sparse"] = None res["default_diabetes"] = 0.128495918...
SupportVectorComponentTest
python
run-llama__llama_index
llama-index-core/llama_index/core/base/base_selector.py
{ "start": 531, "end": 1973 }
class ____(BaseModel): """A multi-selection of choices.""" selections: List[SingleSelection] @property def ind(self) -> int: if len(self.selections) != 1: raise ValueError( f"There are {len(self.selections)} selections, please use .inds." ) retur...
MultiSelection
python
django__django
django/db/models/fields/related_lookups.py
{ "start": 6036, "end": 6094 }
class ____(RelatedLookupMixin, IsNull): pass
RelatedIsNull
python
pytorch__pytorch
torchgen/model.py
{ "start": 78745, "end": 79251 }
class ____(Type): elem: Type def __str__(self) -> str: return f"{self.elem}?" def is_base_ty_like(self, base_ty: BaseTy) -> bool: return self.elem.is_base_ty_like(base_ty) def is_symint_like(self) -> bool: return self.elem.is_symint_like() def is_nullable(self) -> bool: ...
OptionalType
python
numba__numba
numba/core/callconv.py
{ "start": 1530, "end": 5525 }
class ____(object): def __init__(self, context): self.context = context def return_optional_value(self, builder, retty, valty, value): if valty == types.none: # Value is none self.return_native_none(builder) elif retty == valty: # Value is an option...
BaseCallConv
python
neetcode-gh__leetcode
python/0023-merge-k-sorted-lists.py
{ "start": 151, "end": 1030 }
class ____: def mergeKLists(self, lists: List[ListNode]) -> ListNode: if not lists or len(lists) == 0: return None while len(lists) > 1: mergedLists = [] for i in range(0, len(lists), 2): l1 = lists[i] l2 = lists[i + 1] if (i + 1) ...
Solution
python
getsentry__sentry
src/sentry/preprod/pull_request/types.py
{ "start": 1207, "end": 1980 }
class ____(BaseModel): """ Represents pull request details, normalized across SCM providers. """ id: str | None = None # Provider-specific ID number: int # PR/MR number title: str | None = None description: str | None = None state: PullRequestState author: PullRequestAuthor so...
PullRequestDetails
python
PrefectHQ__prefect
src/prefect/server/schemas/filters.py
{ "start": 45926, "end": 46535 }
class ____(PrefectOperatorFilterBaseModel): """Filter for deployments. Only deployments matching all criteria will be returned.""" active: Optional[DeploymentScheduleFilterActive] = Field( default=None, description="Filter criteria for `DeploymentSchedule.active`" ) def _get_filter_list( ...
DeploymentScheduleFilter
python
encode__django-rest-framework
tests/test_filters.py
{ "start": 32133, "end": 32333 }
class ____(serializers.ModelSerializer): username = serializers.CharField() class Meta: model = SensitiveOrderingFilterModel fields = ('id', 'username')
SensitiveDataSerializer1
python
huggingface__transformers
tests/models/seggpt/test_image_processing_seggpt.py
{ "start": 1130, "end": 3543 }
class ____: def __init__( self, parent, batch_size=7, num_channels=3, image_size=18, min_resolution=30, max_resolution=400, do_resize=True, size=None, do_normalize=True, image_mean=[0.5, 0.5, 0.5], image_std=[0.5, 0.5, 0...
SegGptImageProcessingTester
python
huggingface__transformers
tests/models/vitmatte/test_image_processing_vitmatte.py
{ "start": 3124, "end": 17672 }
class ____(ImageProcessingTestMixin, unittest.TestCase): image_processing_class = VitMatteImageProcessor if is_vision_available() else None fast_image_processing_class = VitMatteImageProcessorFast if is_torchvision_available() else None def setUp(self): super().setUp() self.image_processor_...
VitMatteImageProcessingTest
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/operators/test_eks.py
{ "start": 19126, "end": 23536 }
class ____: def setup_method(self) -> None: self.create_nodegroup_params = CreateNodegroupParams( cluster_name=CLUSTER_NAME, nodegroup_name=NODEGROUP_NAME, nodegroup_subnets=SUBNET_IDS, nodegroup_role_arn=NODEROLE_ARN[1], ) @pytest.mark.parametriz...
TestEksCreateNodegroupOperator
python
google__jax
jax/_src/error_check.py
{ "start": 2561, "end": 8774 }
class ____: """Redefine the internal error state based on the mesh in the context. When using JAX in multi-device environments in explicit mode, error tracking needs to be properly aligned with the device mesh. This context manager ensures that the internal error state is correctly initialized based on the c...
error_checking_context
python
ansible__ansible
lib/ansible/errors/__init__.py
{ "start": 8123, "end": 8565 }
class ____(AnsibleRuntimeError, _error_utils.ContributesToTaskResult): """ The transport / connection_plugin had a fatal error. This exception provides a result dictionary via the ContributesToTaskResult mixin. """ @property def result_contribution(self) -> t.Mapping[str, object]: retu...
AnsibleConnectionFailure
python
sphinx-doc__sphinx
sphinx/ext/autosummary/__init__.py
{ "start": 3814, "end": 5743 }
class ____(nodes.comment): pass def autosummary_table_visit_html( self: HTML5Translator, node: autosummary_table ) -> None: """Make the first column of the table non-breaking.""" try: table = cast('nodes.table', node[0]) tgroup = cast('nodes.tgroup', table[0]) tbody = cast('nod...
autosummary_table
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_dataplex.py
{ "start": 20940, "end": 21939 }
class ____: @mock.patch(HOOK_STR) def test_execute(self, hook_mock): op = DataplexDeleteAssetOperator( task_id=TASK_ID, project_id=PROJECT_ID, region=REGION, lake_id=LAKE_ID, zone_id=ZONE_ID, asset_id=ASSET_ID, api_versi...
TestDataplexDeleteAssetOperator
python
huggingface__transformers
src/transformers/models/roberta_prelayernorm/modeling_roberta_prelayernorm.py
{ "start": 14835, "end": 15358 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.dropout = nn.Dropout(config.hidden_dropout_prob) def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor: ...
RobertaPreLayerNormSelfOutput
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1031164, "end": 1031723 }
class ____(sgqlc.types.Type): """Autogenerated return type of UpdateIpAllowListForInstalledAppsEnabledSetting """ __schema__ = github_schema __field_names__ = ("client_mutation_id", "owner") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifi...
UpdateIpAllowListForInstalledAppsEnabledSettingPayload
python
spyder-ide__spyder
external-deps/python-lsp-server/pylsp/lsp.py
{ "start": 674, "end": 745 }
class ____: Text = 1 Read = 2 Write = 3
DocumentHighlightKind
python
django__django
tests/fixtures_regress/models.py
{ "start": 8423, "end": 8639 }
class ____(BaseNKModel): def natural_key(self): return (self.data,) # Fake the dependency for a circularity natural_key.dependencies = ["fixtures_regress.M2MComplexCircular2A"]
M2MComplexCircular2B
python
ray-project__ray
python/ray/train/huggingface/transformers/_transformers_utils.py
{ "start": 3431, "end": 5861 }
class ____(IterableDataset): """Wrapper class for ray data iterables.""" def __init__(self, data_iterable) -> None: super().__init__() self.data_iterable = data_iterable def __iter__(self) -> Iterator: return iter(self.data_iterable) @PublicAPI(stability="beta") def prepare_train...
RayTorchIterableDataset
python
catalyst-team__catalyst
catalyst/contrib/datasets/cifar.py
{ "start": 1565, "end": 3554 }
class ____(data.Dataset): _repr_indent = 4 def __init__( self, root: str, transforms: Optional[Callable] = None, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, ) -> None: if isinstance(root, torch._six.string_classes): ...
VisionDataset
python
huggingface__transformers
tests/models/cohere2_vision/test_modeling_cohere2_vision.py
{ "start": 5775, "end": 17675 }
class ____(unittest.TestCase): def setUp(self): self.model_checkpoint = "CohereLabs/command-a-vision-07-2025" def tearDown(self): cleanup(torch_device, gc_collect=True) def get_model(self, dummy=True): device_type, major, _ = get_device_properties() dtype = torch.float16 ...
Cohere2IntegrationTest
python
pytorch__pytorch
torch/cuda/__init__.py
{ "start": 55162, "end": 55711 }
class ____(_LegacyStorage): @classmethod def from_buffer(cls, *args, **kwargs): _warn_typed_storage_removal() raise RuntimeError("from_buffer: Not available for CUDA storage") @classmethod def _new_with_weak_ptr(cls, *args, **kwargs): raise RuntimeError("_new_with_weak_ptr: Not ...
_CudaLegacyStorage
python
wandb__wandb
wandb/vendor/pygments/lexers/c_like.py
{ "start": 6453, "end": 10577 }
class ____(RegexLexer): """ For Vala source code with preprocessor directives. .. versionadded:: 1.1 """ name = 'Vala' aliases = ['vala', 'vapi'] filenames = ['*.vala', '*.vapi'] mimetypes = ['text/x-vala'] tokens = { 'whitespace': [ (r'^\s*#if\s+0', Comment.Pre...
ValaLexer
python
pyca__cryptography
src/cryptography/hazmat/decrepit/ciphers/algorithms.py
{ "start": 2618, "end": 2884 }
class ____(BlockCipherAlgorithm): name = "RC2" block_size = 64 key_sizes = frozenset([128]) def __init__(self, key: bytes): self.key = _verify_key_size(self, key) @property def key_size(self) -> int: return len(self.key) * 8
RC2
python
pypa__warehouse
warehouse/utils/crypto.py
{ "start": 674, "end": 796 }
class ____(_TimestampSigner): default_digest_method = hashlib.sha512 default_key_derivation = "hmac"
TimestampSigner
python
plotly__plotly.py
plotly/graph_objs/scatterternary/hoverlabel/_font.py
{ "start": 233, "end": 17179 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scatterternary.hoverlabel" _path_str = "scatterternary.hoverlabel.font" _valid_props = { "color", "colorsrc", "family", "familysrc", "lineposition", "linepositionsrc", "shadow", "shadowsr...
Font
python
dagster-io__dagster
examples/docs_snippets/docs_snippets/guides/operate/configuration/run_config/op_example/resources.py
{ "start": 23, "end": 202 }
class ____(dg.Config): person_name: str @dg.definitions def resources() -> dg.Definitions: return dg.Definitions(resources={"config": MyOpConfig(person_name="")})
MyOpConfig
python
FactoryBoy__factory_boy
factory/base.py
{ "start": 22748, "end": 23223 }
class ____(Factory): """Factory for dictionary-like classes.""" class Meta: abstract = True @classmethod def _build(cls, model_class, *args, **kwargs): if args: raise ValueError( "DictFactory %r does not support Meta.inline_args." % cls) return model_...
BaseDictFactory
python
HypothesisWorks__hypothesis
hypothesis-python/tests/typing_extensions/test_backported_types.py
{ "start": 7770, "end": 9198 }
class ____(TypedDict): a: ReadOnly[Required[int]] b: NotRequired[Annotated[ReadOnly[int], "metadata"]] c: Annotated[ReadOnly[NotRequired[str]], "metadata"] @pytest.mark.parametrize( "check,condition", [ pytest.param( assert_all_examples, lambda novel: "a" in novel, ...
DeeplyNestedQualifiers
python
dask__dask
dask/tests/test_core.py
{ "start": 5030, "end": 7771 }
class ____: hit_eq = 0 def __eq__(self, other): self.hit_eq += 1 return False def test_subs_no_key_data_eq(): # Numpy throws a deprecation warning on bool(array == scalar), which # pollutes the terminal. This test checks that `subs` never tries to # compare keys (scalars) with val...
MutateOnEq
python
pypa__twine
twine/package.py
{ "start": 3078, "end": 4238 }
class ____(TypedDict, total=False): # Metadata 1.0 - PEP 241 metadata_version: str name: str version: str platform: List[str] summary: str description: str keywords: List[str] home_page: str author: str author_email: str license: str # Metadata 1.1 - PEP 314 sup...
PackageMetadata
python
pandas-dev__pandas
pandas/tests/tseries/offsets/test_quarter.py
{ "start": 958, "end": 4889 }
class ____: def test_repr(self): expected = "<QuarterBegin: startingMonth=3>" assert repr(QuarterBegin()) == expected expected = "<QuarterBegin: startingMonth=3>" assert repr(QuarterBegin(startingMonth=3)) == expected expected = "<QuarterBegin: startingMonth=1>" asser...
TestQuarterBegin
python
streamlit__streamlit
lib/streamlit/runtime/state/session_state_proxy.py
{ "start": 2623, "end": 5585 }
class ____(MutableMapping[Key, Any]): """A stateless singleton that proxies `st.session_state` interactions to the current script thread's SessionState instance. The proxy API differs slightly from SessionState: it does not allow callers to get, set, or iterate over "keyless" widgets (that is, widgets ...
SessionStateProxy
python
anthropics__anthropic-sdk-python
src/anthropic/types/beta/beta_clear_thinking_20251015_edit_param.py
{ "start": 502, "end": 779 }
class ____(TypedDict, total=False): type: Required[Literal["clear_thinking_20251015"]] keep: Keep """Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed. """
BetaClearThinking20251015EditParam
python
PyCQA__pylint
tests/functional/n/non/non_iterator_returned.py
{ "start": 2097, "end": 2243 }
class ____: """__iter__ returns a class.""" def __iter__(self): # [non-iterator-returned] return ThirdBadIterator
FourthBadIterator
python
django__django
tests/test_client_regress/tests.py
{ "start": 29899, "end": 31218 }
class ____(SimpleTestCase): def test_simple_argument_get(self): "Get a view that has a simple string argument" response = self.client.get(reverse("arg_view", args=["Slartibartfast"])) self.assertEqual(response.status_code, 200) self.assertEqual(response.content, b"Howdy, Slartibartfa...
URLEscapingTests
python
wandb__wandb
wandb/vendor/pygments/lexers/lisp.py
{ "start": 16554, "end": 78343 }
class ____(RegexLexer): """ Lexer for `Racket <http://racket-lang.org/>`_ source code (formerly known as PLT Scheme). .. versionadded:: 1.6 """ name = 'Racket' aliases = ['racket', 'rkt'] filenames = ['*.rkt', '*.rktd', '*.rktl'] mimetypes = ['text/x-racket', 'application/x-racket'...
RacketLexer
python
psf__black
tests/data/cases/ignore_pyi.py
{ "start": 190, "end": 315 }
class ____: ... def g(): # hi ... def h(): ... # bye # output def f(): # type: ignore ...
z
python
pytorch__pytorch
test/inductor/test_aot_inductor_custom_ops.py
{ "start": 15445, "end": 16202 }
class ____(LoggingTestCase): @make_logging_test(dynamic=logging.DEBUG) def test_shape_env_reuse(self, records): # make sure ShapeEnv is only created once and reused afterwards class Foo(torch.nn.Module): def forward(self, x): return x + 2 inputs = (torch.rand...
AOTInductorLoggingTest
python
tensorflow__tensorflow
tensorflow/python/debug/cli/command_parser_test.py
{ "start": 15941, "end": 21677 }
class ____(test_util.TensorFlowTestCase): def testParseTimeInterval(self): self.assertEqual( command_parser.Interval(10, True, 1e3, True), command_parser.parse_time_interval("[10us, 1ms]")) self.assertEqual( command_parser.Interval(10, False, 1e3, False), command_parser.parse_...
ParseInterval
python
keras-team__keras
keras/src/layers/preprocessing/data_layer_test.py
{ "start": 1223, "end": 3169 }
class ____(testing.TestCase): @pytest.mark.requires_trainable_backend def test_layer(self): self.run_layer_test( RandomRGBToHSVLayer, init_kwargs={ "seed": 1337, "data_format": "channels_last", }, input_shape=(1, 2, 2, 3), ...
DataLayerTest
python
networkx__networkx
networkx/readwrite/tests/test_graph6.py
{ "start": 646, "end": 980 }
class ____: def test_n_data_n_conversion(self): for i in [0, 1, 42, 62, 63, 64, 258047, 258048, 7744773, 68719476735]: assert g6.data_to_n(g6.n_to_data(i))[0] == i assert g6.data_to_n(g6.n_to_data(i))[1] == [] assert g6.data_to_n(g6.n_to_data(i) + [42, 43])[1] == [42, 43]...
TestGraph6Utils
python
wntrblm__nox
nox/_decorators.py
{ "start": 1896, "end": 4684 }
class ____(FunctionDecorator): """This is a function decorator that adds additional Nox-specific metadata.""" def __init__( self, func: Callable[..., Any], python: _typing.Python = None, reuse_venv: bool | None = None, # noqa: FBT001 name: str | None = None, ven...
Func
python
getsentry__sentry
src/sentry/workflow_engine/endpoints/validators/base/data_condition_group.py
{ "start": 431, "end": 3061 }
class ____(CamelSnakeSerializer): id = serializers.CharField(required=False) logic_type = serializers.ChoiceField([(t.value, t.value) for t in DataConditionGroup.Type]) conditions = serializers.ListField(required=False) def validate_conditions(self, value: list[dict[str, Any]]) -> list[dict[str, Any]]:...
BaseDataConditionGroupValidator
python
tensorflow__tensorflow
tensorflow/python/data/kernel_tests/range_test.py
{ "start": 6519, "end": 7351 }
class ____(checkpoint_test_base.CheckpointTestBase, parameterized.TestCase): def _build_range_dataset(self, start, stop, options=None): dataset = dataset_ops.Dataset.range(start, stop) if options: dataset = dataset.with_options(options) return dataset @combinations.gene...
RangeCheckpointTest
python
astropy__astropy
astropy/modeling/projections.py
{ "start": 13135, "end": 13437 }
class ____(Sky2PixProjection, Zenithal): r""" Gnomonic Projection - sky to pixel. Corresponds to the ``TAN`` projection in FITS WCS. See `Zenithal` for a definition of the full transformation. .. math:: R_\theta = \frac{180^{\circ}}{\pi}\cot \theta """
Sky2Pix_Gnomonic
python
coleifer__peewee
tests/regressions.py
{ "start": 24557, "end": 24695 }
class ____(TestModel): id = CharField() color = CharField() class Meta: primary_key = CompositeKey('id', 'color')
Product
python
great-expectations__great_expectations
great_expectations/self_check/sqlalchemy_connection_manager.py
{ "start": 318, "end": 1295 }
class ____: def __init__(self) -> None: self.lock = threading.Lock() self._connections: Dict[str, sqlalchemy.Connection] = {} def get_connection(self, connection_string): if sa is not None: with self.lock: if connection_string not in self._connections: ...
SqlAlchemyConnectionManager
python
mlflow__mlflow
dev/clint/tests/rules/test_implicit_optional.py
{ "start": 273, "end": 337 }
class ____: x: str = None # Good good: Optional[int] = None
Bad
python
ray-project__ray
python/ray/tune/search/sample.py
{ "start": 4294, "end": 4545 }
class ____: def sample( self, domain: Domain, config: Optional[Union[List[Dict], Dict]] = None, size: int = 1, random_state: "RandomState" = None, ): raise NotImplementedError @DeveloperAPI
Sampler
python
doocs__leetcode
solution/2400-2499/2404.Most Frequent Even Element/Solution.py
{ "start": 0, "end": 280 }
class ____: def mostFrequentEven(self, nums: List[int]) -> int: cnt = Counter(x for x in nums if x % 2 == 0) ans, mx = -1, 0 for x, v in cnt.items(): if v > mx or (v == mx and ans > x): ans, mx = x, v return ans
Solution
python
apache__airflow
devel-common/src/tests_common/test_utils/mock_operators.py
{ "start": 3592, "end": 4520 }
class ____(BaseOperatorLink): """Custom Operator with Link for Google Custom Search.""" name = "Google Custom" def get_link(self, operator, *, ti_key): if AIRFLOW_V_3_0_PLUS: search_query = XCom.get_many( task_ids=ti_key.task_id, dag_ids=ti_key.dag_id, ...
CustomOpLink
python
uqfoundation__dill
dill/tests/test_nested.py
{ "start": 741, "end": 977 }
class ____(object): def __init__(self, augend): self.augend = augend self.zero = [0] def __call__(self, addend): return addend + self.augend + self.zero[0] # rewrite again, but as an old-style class
cadder
python
PyCQA__pylint
tests/functional/p/postponed/postponed_evaluation_pep585.py
{ "start": 896, "end": 1128 }
class ____(typing.NamedTuple): my_var: list[int] # Check typing.TypedDict CustomTypedDict = TypedDict("CustomTypedDict", my_var=list[int]) CustomTypedDict2 = TypedDict("CustomTypedDict2", {"my_var": list[int]})
CustomNamedTuple3
python
dagster-io__dagster
python_modules/dagster/dagster/_core/execution/step_dependency_config.py
{ "start": 427, "end": 924 }
class ____: require_upstream_step_success: bool @staticmethod def default() -> "StepDependencyConfig": return StepDependencyConfig(require_upstream_step_success=True) @staticmethod def from_config(config_value: Optional[dict[str, bool]]) -> "StepDependencyConfig": return StepDepend...
StepDependencyConfig
python
tensorflow__tensorflow
tensorflow/python/training/saver_test.py
{ "start": 116068, "end": 116166 }
class ____(CheckpointReaderTest): _WRITE_VERSION = saver_pb2.SaverDef.V2
CheckpointReaderForV2Test
python
ansible__ansible
lib/ansible/cli/doc.py
{ "start": 3073, "end": 17321 }
class ____(object): """A mixin containing all methods relevant to role argument specification functionality. Note: The methods for actual display of role data are not present here. """ # Potential locations of the role arg spec file in the meta subdir, with main.yml # having the lowest priority. ...
RoleMixin
python
getsentry__sentry
tests/sentry/api/endpoints/test_project_servicehook_details.py
{ "start": 111, "end": 650 }
class ____(APITestCase): def test_simple(self) -> None: project = self.create_project() hook = ServiceHook.objects.get_or_create( project_id=project.id, actor_id=self.user.id, url="http://example.com" )[0] self.login_as(user=self.user) path = f"/api/0/projects/{pr...
ProjectServiceHookDetailsTest
python
huggingface__transformers
src/transformers/models/speecht5/modeling_speecht5.py
{ "start": 20786, "end": 21441 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.layer_norm = nn.LayerNorm(config.conv_dim[-1], eps=config.layer_norm_eps) self.projection = nn.Linear(config.conv_dim[-1], config.hidden_size) self.dropout = nn.Dropout(config.feat_proj_dropout) def forwa...
SpeechT5FeatureProjection
python
faif__python-patterns
patterns/structural/mvc.py
{ "start": 1425, "end": 1976 }
class ____(ABC): """The View is the presentation layer of the application.""" @abstractmethod def show_item_list(self, item_type: str, item_list: list) -> None: pass @abstractmethod def show_item_information( self, item_type: str, item_name: str, item_info: dict ) -> None: ...
View
python
django__django
tests/validation/test_error_messages.py
{ "start": 113, "end": 4379 }
class ____(TestCase): def _test_validation_messages(self, field, value, expected): with self.assertRaises(ValidationError) as cm: field.clean(value, None) self.assertEqual(cm.exception.messages, expected) def test_autofield_field_raises_error_message(self): f = models.AutoFi...
ValidationMessagesTest
python
sympy__sympy
sympy/physics/quantum/tests/test_anticommutator.py
{ "start": 820, "end": 915 }
class ____(Operator): def _eval_anticommutator_Bar(self, bar): return Integer(0)
Foo
python
dagster-io__dagster
python_modules/libraries/dagster-dg-cli/dagster_dg_cli/cli/scaffold/branch/models.py
{ "start": 1466, "end": 1692 }
class ____: """Record of context gathering operations.""" correlation_id: str timestamp: str files_analyzed: list[str] patterns_detected: list[str] decisions_made: dict[str, Any] @record
ContextGathering
python
apache__airflow
airflow-core/src/airflow/lineage/hook.py
{ "start": 12505, "end": 13310 }
class ____(LoggingMixin): """Class used to retrieve the hook lineage information collected by HookLineageCollector.""" def __init__(self, **kwargs): super().__init__(**kwargs) self.lineage_collector = get_hook_lineage_collector() def retrieve_hook_lineage(self) -> HookLineage: """R...
HookLineageReader
python
pandas-dev__pandas
doc/source/conf.py
{ "start": 20276, "end": 29453 }
class ____(Autosummary): """ This alternative autosummary class lets us override the table summary for Series.plot and DataFrame.plot in the API docs. """ def _replace_pandas_items(self, display_name, sig, summary, real_name): # this a hack: ideally we should extract the signature from the ...
PandasAutosummary
python
langchain-ai__langchain
libs/core/langchain_core/callbacks/base.py
{ "start": 6472, "end": 10890 }
class ____: """Mixin for callback manager.""" def on_llm_start( self, serialized: dict[str, Any], prompts: list[str], *, run_id: UUID, parent_run_id: UUID | None = None, tags: list[str] | None = None, metadata: dict[str, Any] | None = None, ...
CallbackManagerMixin
python
python__mypy
mypyc/test/test_optimizations.py
{ "start": 1870, "end": 2064 }
class ____(OptimizationSuite): files = ["opt-copy-propagation.test"] def do_optimizations(self, fn: FuncIR) -> None: do_copy_propagation(fn, CompilerOptions())
TestCopyPropagation
python
bokeh__bokeh
src/bokeh/models/expressions.py
{ "start": 7007, "end": 7341 }
class ____(ScalarExpression): """ Computes maximum value of a data source's column. """ # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) field = Required(String) initial = Nullable(Float, default=-inf) ...
Maximum
python
langchain-ai__langchain
libs/partners/fireworks/tests/integration_tests/test_standard.py
{ "start": 354, "end": 1013 }
class ____(ChatModelIntegrationTests): @property def chat_model_class(self) -> type[BaseChatModel]: return ChatFireworks @property def chat_model_params(self) -> dict: return { "model": "fireworks/kimi-k2-instruct-0905", "temperature": 0, } @pytest.m...
TestFireworksStandard
python
keras-team__keras
keras/src/utils/torch_utils_test.py
{ "start": 1844, "end": 12048 }
class ____(testing.TestCase): @parameterized.parameters( {"use_batch_norm": False, "num_torch_layers": 1}, {"use_batch_norm": True, "num_torch_layers": 1}, ) def test_basic_usage(self, use_batch_norm, num_torch_layers): model = Classifier(use_batch_norm, num_torch_layers) sel...
TorchUtilsTest