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
dask__dask
dask/rewrite.py
{ "start": 1998, "end": 2472 }
class ____: """A token object. Used to express certain objects in the traversal of a task or pattern.""" def __init__(self, name): self.name = name def __repr__(self): return self.name # A variable to represent *all* variables in a discrimination net VAR = Token("?") # Represents th...
Token
python
sphinx-doc__sphinx
sphinx/addnodes.py
{ "start": 16473, "end": 16579 }
class ____(nodes.reference): """Node for number references, similar to pending_xref."""
number_reference
python
apache__airflow
providers/fab/tests/unit/fab/auth_manager/api_endpoints/test_role_and_permission_endpoint.py
{ "start": 2518, "end": 2708 }
class ____: @pytest.fixture(autouse=True) def setup_attrs(self, configured_app) -> None: self.app = configured_app self.client = self.app.test_client()
TestRoleEndpoint
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/conditional_variant_pkg/package.py
{ "start": 217, "end": 1077 }
class ____(Package): """This package is used to test conditional variants.""" homepage = "http://www.example.com/conditional-variant-pkg" url = "http://www.unit-test-should-replace-this-url/conditional-variant-1.0.tar.gz" version("1.0", md5="0123456789abcdef0123456789abcdef") version("2.0", md5="a...
ConditionalVariantPkg
python
tensorflow__tensorflow
tensorflow/python/framework/tensor_util_test.py
{ "start": 45045, "end": 50788 }
class ____(test.TestCase): @test_util.run_in_graph_and_eager_modes def testConstant(self): np_val = np.random.rand(3).astype(np.int32) tf_val = constant_op.constant(np_val) self.assertEqual( tensor_shape.TensorShape(np_val), tensor_util.constant_value_as_shape(tf_val)) tf_val = con...
ConstantValueAsShapeTest
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/dataproc_metastore.py
{ "start": 35468, "end": 39394 }
class ____(GoogleCloudBaseOperator): """ List backups in a service. :param project_id: Required. The ID of the Google Cloud project that the backup belongs to. :param region: Required. The ID of the Google Cloud region that the backup belongs to. :param service_id: Required. The ID of the metastore...
DataprocMetastoreListBackupsOperator
python
django__django
tests/utils_tests/test_http.py
{ "start": 19581, "end": 20636 }
class ____(unittest.TestCase): def test_basic(self): tests = ( ((False, None), None), ((False, "example"), 'inline; filename="example"'), ((True, None), "attachment"), ((True, "example"), 'attachment; filename="example"'), ( (True, ...
ContentDispositionHeaderTests
python
kamyu104__LeetCode-Solutions
Python/longest-balanced-subarray-ii.py
{ "start": 75, "end": 2972 }
class ____(object): def longestBalanced(self, nums): """ :type nums: List[int] :rtype: int """ class SegmentTree(object): def __init__(self, N): self.min = [0]*(1<<((N-1).bit_length()+1)) self.max = [0]*(1<<((N-1).bit_length()+1)) ...
Solution
python
encode__starlette
starlette/middleware/gzip.py
{ "start": 238, "end": 1028 }
class ____: def __init__(self, app: ASGIApp, minimum_size: int = 500, compresslevel: int = 9) -> None: self.app = app self.minimum_size = minimum_size self.compresslevel = compresslevel async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"...
GZipMiddleware
python
great-expectations__great_expectations
tests/integration/test_utils/data_source_config/snowflake.py
{ "start": 3578, "end": 7528 }
class ____(SQLBatchTestSetup[SnowflakeDatasourceTestConfig]): @property @override def connection_string(self) -> str: return self.snowflake_connection_config.connection_string @property def private_key(self) -> Optional[str]: return self.snowflake_connection_config.private_key ...
SnowflakeBatchTestSetup
python
ray-project__ray
python/ray/tests/test_task_events_2.py
{ "start": 11587, "end": 32280 }
class ____: def fail_parent(self, pid_actor): ray.get(pid_actor.report_pid.remote("fail_parent", os.getpid(), "FAILED")) ray.get(task_finish_child.options(name="task_finish_child").remote(pid_actor)) task_sleep_child.options(name="task_sleep_child").remote(pid_actor) # Wait til chil...
Actor
python
django__django
django/contrib/gis/forms/fields.py
{ "start": 4111, "end": 4196 }
class ____(GeometryField): geom_type = "GEOMETRYCOLLECTION"
GeometryCollectionField
python
walkccc__LeetCode
solutions/23. Merge k Sorted Lists/23.py
{ "start": 34, "end": 466 }
class ____: def mergeKLists(self, lists: list[ListNode]) -> ListNode: dummy = ListNode(0) curr = dummy pq = PriorityQueue() for i, lst in enumerate(lists): if lst: pq.put((lst.val, i, lst)) while not pq.empty(): _, i, minNode = pq.get() if minNode.next: pq.put((...
Solution
python
joke2k__faker
faker/providers/address/ru_RU/__init__.py
{ "start": 45, "end": 35161 }
class ____(AddressProvider): city_suffixes = ("ск", "вль", "град", "поль", "ин", "ов", "бург") street_suffixes = ("ул.", "алл.", "наб.", "пр.", "пер.", "бул.", "ш.") region_suffixes = ("респ.", "обл.", "край", "АО") city_formats = ("{{city_prefix}} {{city_name}}",) street_address_formats = ( ...
Provider
python
joke2k__faker
tests/providers/test_geo.py
{ "start": 145, "end": 777 }
class ____(unittest.TestCase): """Tests geographic locations regardless of locale""" def setUp(self): self.fake = Faker() # No locale specified, gets global for this provider Faker.seed(0) def test_local_latlng(self): loc = self.fake.local_latlng(country_code="US") assert ...
TestGlobal
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1203385, "end": 1208909 }
class ____(sgqlc.types.Type, Node): """A label for categorizing Issues, Pull Requests, Milestones, or Discussions with a given Repository. """ __schema__ = github_schema __field_names__ = ( "color", "created_at", "description", "is_default", "issues", ...
Label
python
ray-project__ray
python/ray/tests/authentication/conftest.py
{ "start": 749, "end": 3506 }
class ____(reporter_pb2_grpc.ReporterServiceServicer): """Simple asynchronous test service for testing auth interceptors.""" async def HealthCheck(self, request, context): """Simple health check endpoint (async version).""" return reporter_pb2.HealthCheckReply() def _create_test_server_base( ...
AsyncReporterService
python
huggingface__transformers
src/transformers/models/altclip/configuration_altclip.py
{ "start": 10668, "end": 17927 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`AltCLIPModel`]. It is used to instantiate an AltCLIP model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar conf...
AltCLIPConfig
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 99812, "end": 100109 }
class ____(sgqlc.types.Enum): """Properties by which security vulnerability connections can be ordered. Enumeration Choices: * `UPDATED_AT`: Order vulnerability by update time """ __schema__ = github_schema __choices__ = ("UPDATED_AT",)
SecurityVulnerabilityOrderField
python
modin-project__modin
modin/core/computation/ops.py
{ "start": 1997, "end": 5180 }
class ____: def __new__(cls, name, env, side=None, encoding=None): klass = Constant if not isinstance(name, str) else cls # error: Argument 2 for "super" not an instance of argument 1 supr_new = super(Term, klass).__new__ # type: ignore[misc] return supr_new(klass) is_local: bo...
Term
python
tiangolo__fastapi
fastapi/_compat/v2.py
{ "start": 1864, "end": 1917 }
class ____(Exception): pass @dataclass
ErrorWrapper
python
getsentry__sentry
tests/sentry/api/endpoints/test_broadcast_details.py
{ "start": 818, "end": 2733 }
class ____(APITestCase): def test_regular_user(self) -> None: broadcast1 = Broadcast.objects.create(message="bar", is_active=True) broadcast2 = Broadcast.objects.create(message="foo", is_active=False) self.add_user_permission(user=self.user, permission="broadcasts.admin") self.login...
BroadcastUpdateTest
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/matchClass1.py
{ "start": 10888, "end": 12155 }
class ____(TypedDict): x: int def func12(subj: int, flt_cls: type[float], union_val: float | int): match subj: # This should generate an error because int doesn't accept two arguments. case int(1, 2): pass match subj: # This should generate an error because float doesn...
TD1
python
huggingface__transformers
src/transformers/models/depth_pro/modeling_depth_pro.py
{ "start": 17542, "end": 18877 }
class ____(nn.Module): def __init__( self, config: DepthProConfig, input_dims: int, intermediate_dims: int, output_dims: int, n_upsample_layers: int, use_proj: bool = True, bias: bool = False, ): super().__init__() self.config = con...
DepthProFeatureUpsampleBlock
python
tensorflow__tensorflow
tensorflow/python/eager/forwardprop_util.py
{ "start": 903, "end": 2658 }
class ____( collections.namedtuple("TangentInfo", ["indices", "tangents"])): """Packed forward accumulator state. The return value of `pack_tangents`.""" def __new__(cls, indices=None, tangents=None): if indices is None: indices = () if tangents is None: tangents = [] return super(Tange...
TangentInfo
python
python__mypy
mypy/test/data.py
{ "start": 1008, "end": 10420 }
class ____(NamedTuple): module: str path: str FileOperation: _TypeAlias = UpdateFile | DeleteFile def _file_arg_to_module(filename: str) -> str: filename, _ = os.path.splitext(filename) parts = filename.split("/") # not os.sep since it comes from test data if parts[-1] == "__init__": pa...
DeleteFile
python
oauthlib__oauthlib
oauthlib/oauth2/rfc6749/errors.py
{ "start": 6690, "end": 6914 }
class ____(InvalidRequestError): """ The request to the token endpoint, when PKCE is enabled, has the parameter `code_verifier` REQUIRED. """ description = 'Code verifier required.'
MissingCodeVerifierError
python
crytic__slither
slither/slithir/operations/new_array.py
{ "start": 438, "end": 1143 }
class ____(Call, OperationWithLValue): def __init__( self, array_type: "ArrayType", lvalue: Union["TemporaryVariableSSA", "TemporaryVariable"], ) -> None: super().__init__() assert isinstance(array_type, ArrayType) self._array_type = array_type self._lval...
NewArray
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1016299, "end": 1016783 }
class ____(sgqlc.types.Type): """Autogenerated return type of UpdateDiscussionComment""" __schema__ = github_schema __field_names__ = ("client_mutation_id", "comment") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the client performing th...
UpdateDiscussionCommentPayload
python
apache__airflow
providers/standard/src/airflow/providers/standard/operators/weekday.py
{ "start": 1168, "end": 4957 }
class ____(BaseBranchOperator): """ Branches into one of two lists of tasks depending on the current day. For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:BranchDayOfWeekOperator` **Example** (with single day): .. code-block:: python fr...
BranchDayOfWeekOperator
python
huggingface__transformers
src/transformers/models/textnet/modeling_textnet.py
{ "start": 6972, "end": 7949 }
class ____(nn.Module): def __init__(self, config: TextNetConfig): super().__init__() stages = [] num_stages = len(config.conv_layer_kernel_sizes) for stage_ix in range(num_stages): stages.append(TextNetStage(config, stage_ix)) self.stages = nn.ModuleList(stages)...
TextNetEncoder
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_compat.py
{ "start": 1184, "end": 1395 }
class ____: __signature__ = Signature( parameters=[Parameter(name="args", kind=Parameter.VAR_POSITIONAL)] ) def test_no_type_hints(): assert get_type_hints(WeirdSig) == {} @dataclass
WeirdSig
python
wandb__wandb
wandb/integration/diffusers/resolvers/multimodal.py
{ "start": 17678, "end": 29990 }
class ____: """Resolver for request and responses from [HuggingFace Diffusers](https://huggingface.co/docs/diffusers/index) multi-modal Diffusion Pipelines, providing necessary data transformations, formatting, and logging. This resolver is internally involved in the `__call__` for `wandb.integration.diff...
DiffusersMultiModalPipelineResolver
python
tensorflow__tensorflow
tensorflow/python/distribute/cluster_resolver/gce_cluster_resolver_test.py
{ "start": 1031, "end": 11768 }
class ____(test.TestCase): def _verifyClusterSpecEquality(self, cluster_spec, expected_proto): self.assertProtoEquals(expected_proto, cluster_spec.as_cluster_def()) self.assertProtoEquals( expected_proto, server_lib.ClusterSpec(cluster_spec).as_cluster_def()) self.assertProtoEquals( expec...
GCEClusterResolverTest
python
keras-team__keras
keras/src/ops/core.py
{ "start": 23189, "end": 24642 }
class ____(Operation): def __init__(self, lower, upper, body_fun, *, name=None): super().__init__(name=name) self.lower = lower self.upper = upper self.body_fun = body_fun def call(self, init_val): return backend.core.fori_loop( self.lower, self.u...
ForiLoop
python
ansible__ansible
test/lib/ansible_test/_internal/core_ci.py
{ "start": 3331, "end": 13082 }
class ____: """Client for Ansible Core CI services.""" DEFAULT_ENDPOINT = 'https://ansible-core-ci.testing.ansible.com' def __init__( self, args: EnvironmentConfig, resource: Resource, load: bool = True, ) -> None: self.args = args self.resource = resour...
AnsibleCoreCI
python
kubernetes-client__python
kubernetes/client/models/v1_limit_range_spec.py
{ "start": 383, "end": 3725 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1LimitRangeSpec
python
google__jax
tests/lax_numpy_operators_test.py
{ "start": 21990, "end": 22182 }
class ____: pass for rec in JAX_OPERATOR_OVERLOADS + JAX_RIGHT_OPERATOR_OVERLOADS: if rec.nargs == 2: setattr(_OverrideEverything, rec.name, lambda self, other: self)
_OverrideEverything
python
pypa__pipenv
pipenv/patched/pip/_internal/metadata/base.py
{ "start": 21545, "end": 25025 }
class ____: """An environment containing distributions to introspect.""" @classmethod def default(cls) -> "BaseEnvironment": raise NotImplementedError() @classmethod def from_paths(cls, paths: Optional[List[str]]) -> "BaseEnvironment": raise NotImplementedError() def get_distr...
BaseEnvironment
python
numpy__numpy
numpy/_core/tests/test_numerictypes.py
{ "start": 6357, "end": 6550 }
class ____(CreateValues): """Check the creation of heterogeneous arrays (nested, single row)""" _descr = Ndescr multiple_rows = 0 _buffer = NbufferT[0]
TestCreateValuesNestedSingle
python
ray-project__ray
rllib/examples/_old_api_stack/models/shared_weights_model.py
{ "start": 5311, "end": 6969 }
class ____(TorchModelV2, nn.Module): """Example of weight sharing between two different TorchModelV2s. The shared (single) layer is simply defined outside of the two Models, then used by both Models in their forward pass. """ def __init__( self, observation_space, action_space, num_outputs...
TorchSharedWeightsModel
python
getsentry__sentry
src/sentry/integrations/bitbucket_server/utils.py
{ "start": 44, "end": 1254 }
class ____: """ project is the short key of the project repo is the fully qualified slug """ repository = "/rest/api/1.0/projects/{project}/repos/{repo}" repositories = "/rest/api/1.0/repos" repository_hook = "/rest/api/1.0/projects/{project}/repos/{repo}/webhooks/{id}" repository_hooks...
BitbucketServerAPIPath
python
ipython__ipython
tests/test_pretty.py
{ "start": 4591, "end": 4616 }
class ____(SA): pass
SB
python
pydata__xarray
xarray/core/resample_cftime.py
{ "start": 2437, "end": 19460 }
class ____: """This is a simple container for the grouping parameters that implements a single method, the only one required for resampling in xarray. It cannot be used in a call to groupby like a pandas.Grouper object can.""" freq: BaseCFTimeOffset closed: SideOptions label: SideOptions l...
CFTimeGrouper
python
pytorch__pytorch
torch/ao/quantization/fx/quantize_handler.py
{ "start": 6802, "end": 6882 }
class ____(QuantizeHandler): pass # TODO: remove
FixedQParamsOpQuantizeHandler
python
pandas-dev__pandas
pandas/tests/indexes/test_engines.py
{ "start": 1716, "end": 2746 }
class ____: @pytest.mark.parametrize( "scalar", [ pd.Timestamp(pd.Timedelta(days=42).asm8.view("datetime64[ns]")), pd.Timedelta(days=42)._value, pd.Timedelta(days=42).to_pytimedelta(), pd.Timedelta(days=42).to_timedelta64(), ], ) def te...
TestTimedeltaEngine
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/input/vt100_parser.py
{ "start": 1927, "end": 8407 }
class ____: """ Parser for VT100 input stream. Data can be fed through the `feed` method and the given callback will be called with KeyPress objects. :: def callback(key): pass i = Vt100Parser(callback) i.feed('data\x01...') :attr feed_key_callback: Functio...
Vt100Parser
python
scrapy__scrapy
tests/test_pipeline_crawl.py
{ "start": 1502, "end": 8055 }
class ____: pipeline_class = "scrapy.pipelines.files.FilesPipeline" store_setting_key = "FILES_STORE" media_key = "files" media_urls_key = "file_urls" expected_checksums: set[str] | None = { "5547178b89448faf0015a13f904c936e", "c2281c83670e31d8aaab7cb642b824db", "ed3f6538dc15...
TestFileDownloadCrawl
python
astropy__astropy
astropy/io/registry/tests/test_registries.py
{ "start": 38734, "end": 40183 }
class ____(TestUnifiedInputRegistry, TestUnifiedOutputRegistry): def setup_class(self): """Setup class. This is called 1st by pytest.""" self._cls = UnifiedIORegistry # =========================================== @pytest.mark.skip("TODO!") def test_get_formats(self, registry): ...
TestUnifiedIORegistry
python
spyder-ide__spyder
spyder/config/user.py
{ "start": 22079, "end": 25428 }
class ____(UserConfig): def get_previous_config_fpath(self): """ Override method. Return the last configuration file used if found. """ fpath = self.get_config_fpath() # We don't need to add the contents of the old spyder.ini to # the configuration of exter...
SpyderUserConfig
python
django__django
tests/prefetch_related/tests.py
{ "start": 76898, "end": 78521 }
class ____(TestCase): @classmethod def setUpTestData(cls): cls.book1 = Book.objects.create(title="Les confessions Volume I") cls.book2 = Book.objects.create(title="Candide") cls.author1 = AuthorWithAge.objects.create( name="Rousseau", first_book=cls.book1, age=70 ) ...
ReadPrefetchedObjectsCacheTests
python
huggingface__transformers
src/transformers/models/poolformer/modeling_poolformer.py
{ "start": 3245, "end": 3479 }
class ____(nn.GroupNorm): """ Group Normalization with 1 group. Input: tensor in shape [B, C, H, W] """ def __init__(self, num_channels, **kwargs): super().__init__(1, num_channels, **kwargs)
PoolFormerGroupNorm
python
realpython__materials
python-sqlite-sqlalchemy/project/examples/example_3/app/tracks/routes.py
{ "start": 1328, "end": 3477 }
class ____(FlaskForm): artist = HiddenField("artist") album = HiddenField("album") name = StringField( label="Track's Name", validators=[InputRequired(), does_track_exist] ) media_type = SelectField(label="Media Type", validators=[InputRequired()]) genre = SelectField(label="Genre", vali...
CreateTrackForm
python
wandb__wandb
wandb/integration/keras/callbacks/tables_builder.py
{ "start": 173, "end": 8881 }
class ____(Callback, abc.ABC): """Abstract base class to build Keras callbacks for model prediction visualization. You can build callbacks for visualizing model predictions `on_epoch_end` that can be passed to `model.fit()` for classification, object detection, segmentation, etc. tasks. To use thi...
WandbEvalCallback
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/translate.py
{ "start": 29894, "end": 32815 }
class ____(GoogleCloudBaseOperator): """ Delete translation dataset and all of its contents. Deletes the translation dataset and it's data, using API V3. For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:TranslateDeleteDatasetOperator`. :param dat...
TranslateDeleteDatasetOperator
python
PyCQA__pylint
tests/functional/p/protocol_classes_abstract.py
{ "start": 248, "end": 473 }
class ____(Protocol): """Foo Protocol""" @abstractmethod def foo(self) -> Literal["foo"]: """foo method""" def foo_no_abstract(self) -> Literal["foo"]: """foo not abstract method"""
FooProtocol
python
more-itertools__more-itertools
tests/test_more.py
{ "start": 136846, "end": 138191 }
class ____(TestCase): def test_types(self): for iterable in ['abcd', ['a', 'b', 'c', 'd'], ('a', 'b', 'c', 'd')]: with self.subTest(iterable=iterable): actual = list(mi.partitions(iterable)) expected = [ [['a', 'b', 'c', 'd']], ...
PartitionsTest
python
apache__airflow
airflow-core/tests/unit/models/test_xcom.py
{ "start": 1889, "end": 4014 }
class ____(BaseXCom): ... @pytest.fixture(autouse=True) def reset_db(): """Reset XCom entries.""" clear_db_dags() clear_db_runs() clear_db_xcom() clear_db_dag_bundles() @pytest.fixture def task_instance_factory(request, session: Session): def func(*, dag_id, task_id, logical_date, run_after=...
CustomXCom
python
python-openxml__python-docx
src/docx/shared.py
{ "start": 4194, "end": 9845 }
class ____(Generic[T]): """Decorator like @property, but evaluated only on first access. Like @property, this can only be used to decorate methods having only a `self` parameter, and is accessed like an attribute on an instance, i.e. trailing parentheses are not used. Unlike @property, the decorated me...
lazyproperty
python
kamyu104__LeetCode-Solutions
Python/make-three-strings-equal.py
{ "start": 57, "end": 450 }
class ____(object): def findMinimumOperations(self, s1, s2, s3): """ :type s1: str :type s2: str :type s3: str :rtype: int """ for i, (a, b, c) in enumerate(itertools.izip(s1, s2, s3)): if not a == b == c: break else: ...
Solution
python
huggingface__transformers
src/transformers/models/nemotron/modeling_nemotron.py
{ "start": 8564, "end": 9793 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.config = config self.hidden_size = config.hidden_size self.intermediate_size = config.intermediate_size self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.mlp_bias) ...
NemotronMLP
python
pytorch__pytorch
test/inductor/test_codecache.py
{ "start": 87952, "end": 106180 }
class ____(TestCase): def test_parameter_constants(self): """ Test the hashing of parameter constants. """ small = torch.nn.Parameter(torch.rand(8)) large = torch.nn.Parameter(torch.rand(32)) self.assertTrue(GraphLowering.can_inline_constant(small)) self.asse...
TestFxGraphCacheHashing
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_default_row03.py
{ "start": 315, "end": 961 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("default_row03.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got...
TestCompareXLSXFiles
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/data_loss_prevention.py
{ "start": 3535, "end": 3760 }
class ____(BaseGoogleLink): """Helper class for constructing Cloud Data Loss Prevention link.""" name = "Cloud DLP Jobs List" key = "cloud_dlp_jobs_list_key" format_str = DLP_JOBS_LIST_LINK
CloudDLPJobsListLink
python
pytorch__pytorch
torch/distributed/fsdp/_fully_shard/_fsdp_param_group.py
{ "start": 1873, "end": 4453 }
class ____: """This has the communication state shared across FSDP states/parameter groups.""" def lazy_init(self, device: torch.device): self.device_handle = _get_device_handle(device.type) # Setting the all-gather/reduce-scatter streams to be higher priority # can help avoid some issu...
FSDPCommContext
python
networkx__networkx
networkx/algorithms/tests/test_cuts.py
{ "start": 1409, "end": 2191 }
class ____: """Unit tests for the :func:`~networkx.volume` function.""" def test_graph(self): G = nx.cycle_graph(4) assert nx.volume(G, {0, 1}) == 4 def test_digraph(self): G = nx.DiGraph([(0, 1), (1, 2), (2, 3), (3, 0)]) assert nx.volume(G, {0, 1}) == 2 def test_multi...
TestVolume
python
apache__airflow
airflow-core/src/airflow/api_fastapi/common/parameters.py
{ "start": 25802, "end": 26890 }
class ____(BaseParam[str]): """Filter Dags by specific asset dependencies.""" def to_orm(self, select: Select) -> Select: if self.value is None and self.skip_none: return select asset_dag_subquery = ( sql_select(DagScheduleAssetReference.dag_id) .join(AssetM...
_AssetDependencyFilter
python
Unity-Technologies__ml-agents
ml-agents/mlagents/trainers/subprocess_env_manager.py
{ "start": 1591, "end": 1784 }
class ____(enum.Enum): STEP = 1 BEHAVIOR_SPECS = 2 ENVIRONMENT_PARAMETERS = 3 RESET = 4 CLOSE = 5 ENV_EXITED = 6 CLOSED = 7 TRAINING_STARTED = 8
EnvironmentCommand
python
tornadoweb__tornado
tornado/test/websocket_test.py
{ "start": 4604, "end": 4771 }
class ____(TestWebSocketHandler): def on_message(self, message): self.write_message(self.render_string("message.html", message=message))
RenderMessageHandler
python
pypa__pip
tests/unit/test_base_command.py
{ "start": 1919, "end": 7262 }
class ____: def call_main(self, capsys: pytest.CaptureFixture[str], args: list[str]) -> str: """ Call command.main(), and return the command's stderr. """ def raise_broken_stdout() -> NoReturn: raise BrokenStdoutLoggingError() cmd = FakeCommand(run_func=raise_br...
TestCommand
python
pypa__pipenv
pipenv/patched/pip/_internal/vcs/bazaar.py
{ "start": 457, "end": 3588 }
class ____(VersionControl): name = "bzr" dirname = ".bzr" repo_name = "branch" schemes = ( "bzr+http", "bzr+https", "bzr+ssh", "bzr+sftp", "bzr+ftp", "bzr+lp", "bzr+file", ) @staticmethod def get_base_rev_args(rev: str) -> List[str]: ...
Bazaar
python
astropy__astropy
astropy/coordinates/tests/test_representation_methods.py
{ "start": 10156, "end": 12187 }
class ____(ShapeSetup): def test_shape_setting(self): # Shape-setting should be on the object itself, since copying removes # zero-strides due to broadcasting. Hence, this should be the only # test in this class. self.s0.shape = (2, 3, 7) assert self.s0.shape == (2, 3, 7) ...
TestSetShape
python
facelessuser__pymdown-extensions
tests/test_extensions/test_superfences.py
{ "start": 38182, "end": 39214 }
class ____(util.MdCase): """Test custom Arithmatex format.""" extension = ['pymdownx.superfences'] extension_configs = { 'pymdownx.superfences': { 'custom_fences': [ { 'name': 'math', 'class': 'arithmatex', 'for...
TestSuperFencesCustomArithmatex
python
pandas-dev__pandas
pandas/tests/api/test_api.py
{ "start": 10899, "end": 11091 }
class ____(Base): def test_errors(self): ignored = ["_CurrentDeprecationWarning", "abc", "ctypes", "cow"] self.check(pd.errors, pd.errors.__all__, ignored=ignored)
TestErrors
python
dagster-io__dagster
python_modules/dagster/dagster/_core/errors.py
{ "start": 1794, "end": 2037 }
class ____(DagsterError): """Indicates that a subset of a pipeline is invalid because either: - One or more ops in the specified subset do not exist on the job.' - The subset produces an invalid job. """
DagsterInvalidSubsetError
python
huggingface__transformers
src/transformers/models/swiftformer/modeling_swiftformer.py
{ "start": 5633, "end": 6542 }
class ____(nn.Module): """ MLP layer with 1*1 convolutions. Input: tensor of shape `[batch_size, channels, height, width]` Output: tensor of shape `[batch_size, channels, height, width]` """ def __init__(self, config: SwiftFormerConfig, in_features: int): super().__init__() hi...
SwiftFormerMlp
python
aio-libs__aiohttp
aiohttp/tracing.py
{ "start": 9339, "end": 9473 }
class ____: """Parameters sent by the `on_dns_cache_hit` signal""" host: str @frozen_dataclass_decorator
TraceDnsCacheHitParams
python
apache__airflow
providers/snowflake/tests/unit/snowflake/utils/test_sql_api_generate_jwt.py
{ "start": 1433, "end": 2343 }
class ____: @pytest.mark.parametrize( ("account_name", "expected_account_name"), [("test.us-east-1", "TEST"), ("test.global", "TEST.GLOBAL"), ("test", "TEST")], ) def test_prepare_account_name_for_jwt(self, account_name, expected_account_name): """ Test prepare_account_name_f...
TestJWTGenerator
python
tensorflow__tensorflow
tensorflow/python/eager/wrap_function.py
{ "start": 18612, "end": 28028 }
class ____(object): """Class for wrapping multiple TF 1.X functions in a single graph. Maintains a dictionary mapping names to wrapped functions. See `tf.compat.v1.wrap_function` to learn more about wrapping V1 functions. Functions wrapped using this class have access to variables and collections created in...
WrappedGraph
python
MongoEngine__mongoengine
mongoengine/fields.py
{ "start": 29322, "end": 31457 }
class ____(BaseField): """A truly dynamic field type capable of handling different and varying types of data. Used by :class:`~mongoengine.DynamicDocument` to handle dynamic data""" def to_mongo(self, value, use_db_field=True, fields=None): """Convert a Python type to a MongoDB compatible type...
DynamicField
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_default_date_format02.py
{ "start": 346, "end": 1506 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("default_date_format02.xlsx") def test_create_file_user_date_format(self): """Test write_datetime with explicit date format.""" wor...
TestCompareXLSXFiles
python
pandas-dev__pandas
pandas/tests/indexes/period/methods/test_insert.py
{ "start": 132, "end": 482 }
class ____: @pytest.mark.parametrize("na", [np.nan, NaT, None]) def test_insert(self, na): # GH#18295 (test missing) expected = PeriodIndex(["2017Q1", NaT, "2017Q2", "2017Q3", "2017Q4"], freq="Q") result = period_range("2017Q1", periods=4, freq="Q").insert(1, na) tm.assert_index_...
TestInsert
python
numba__numba
numba/cuda/tests/cudapy/test_warning.py
{ "start": 309, "end": 4265 }
class ____(CUDATestCase): def test_inefficient_launch_configuration(self): @cuda.jit def kernel(): pass with override_config('CUDA_LOW_OCCUPANCY_WARNINGS', 1): with warnings.catch_warnings(record=True) as w: kernel[1, 1]() self.assertEqual(w[...
TestWarnings
python
tensorflow__tensorflow
tensorflow/python/tpu/tests/tpu_embedding_v2_correctness_sparse_training_test.py
{ "start": 954, "end": 1440 }
class ____( tpu_embedding_v2_correctness_base_test.TPUEmbeddingCorrectnessBaseTest): @parameterized.parameters( ['sgd', 'adagrad', 'adam', 'ftrl', 'adagrad_momentum']) def test_embedding(self, optimizer_name): if optimizer_name != 'sgd': self.skip_if_oss() self._test_embedding( opti...
TPUEmbeddingCorrectnessTest
python
has2k1__plotnine
plotnine/themes/theme_classic.py
{ "start": 122, "end": 923 }
class ____(theme_bw): """ A classic-looking theme, with x & y axis lines and no gridlines Parameters ---------- base_size : int Base font size. All text sizes are a scaled versions of the base font size. base_family : str Base font family. If `None`, use [](`plotnine.opt...
theme_classic
python
mlflow__mlflow
tests/resources/data/dataset_source.py
{ "start": 272, "end": 1522 }
class ____(DatasetSource): def __init__(self, uri): self._uri = uri @property def uri(self): return self._uri @staticmethod def _get_source_type() -> str: return "test" def load(self) -> str: # Ignore the "test" URI scheme and download the local path pa...
SampleDatasetSource
python
PrefectHQ__prefect
src/prefect/server/schemas/filters.py
{ "start": 80756, "end": 81310 }
class ____(PrefectFilterBaseModel): """Filter by `ArtifactCollection.task_run_id`.""" any_: Optional[list[UUID]] = Field( default=None, description="A list of task run IDs to include" ) def _get_filter_list( self, db: "PrefectDBInterface" ) -> Iterable[sa.ColumnExpressionArgument[b...
ArtifactCollectionFilterTaskRunId
python
getsentry__sentry
tests/sentry/sentry_apps/api/endpoints/test_sentry_app_interaction.py
{ "start": 1813, "end": 2779 }
class ____(SentryAppInteractionTest): def setUp(self) -> None: super().setUp() self.login_as(self.user) def test_user_sees_owned_interactions(self) -> None: response = self.get_success_response(self.published_app.slug) assert len(response.data["views"]) > 0 assert "issu...
GetSentryAppInteractionTest
python
wandb__wandb
wandb/_pydantic/base.py
{ "start": 4495, "end": 4793 }
class ____(JsonableModel, ABC): model_config = ConfigDict( validate_default=True, revalidate_instances="always", protected_namespaces=(), # Some GraphQL fields may begin with "model_" ) # Base class for GraphQL result types, i.e. parsed GraphQL response data.
GQLBase
python
Lightning-AI__lightning
src/lightning/pytorch/_graveyard/hpu.py
{ "start": 1638, "end": 2400 }
class ____: def __init__(self, *_: Any, **__: Any) -> None: raise NotImplementedError( "The `HPUPrecisionPlugin` class has been removed. Please contact developer@lightning.ai" ) def _patch_classes() -> None: setattr(pl.accelerators, "HPUAccelerator", HPUAccelerator) setattr(pl....
HPUPrecisionPlugin
python
django__django
tests/admin_utils/models.py
{ "start": 1417, "end": 1497 }
class ____(models.Model): date = models.DateTimeField(auto_now_add=True)
Event
python
huggingface__transformers
src/transformers/generation/logits_process.py
{ "start": 128739, "end": 147147 }
class ____(LogitsProcessor): r""" Logits processor that implements watermarking techniques for text generation models. This class facilitates the application of SynthID text watermarking, a method for embedding imperceptible signals into generated text to aid in detecting synthetic content. It operates ...
SynthIDTextWatermarkLogitsProcessor
python
vyperlang__vyper
vyper/builtins/functions.py
{ "start": 88702, "end": 88820 }
class ____(_MinMaxValue): _id = "max_value" def _eval(self, type_): return type_.ast_bounds[1]
MaxValue
python
google__jax
tests/pjit_test.py
{ "start": 52170, "end": 172529 }
class ____(jtu.JaxTestCase): @parameterized.named_parameters( ('fully_sharded_output', P('x', 'y'), (2, 4)), ('fully_replicated_output', P(None), (8, 8)), ) def test_pjit_array_single_output(self, out_axis_resources, shard_shape): global_input_shape = (8, 2) global_mesh = jtu.create_mesh((4, 2), ...
ArrayPjitTest
python
pandas-dev__pandas
pandas/errors/__init__.py
{ "start": 33194, "end": 34592 }
class ____(Exception): """ Exception is raised by _validate_comparison_value to indicate an invalid comparison. Notes ----- This is an internal error. """ __all__ = [ "AbstractMethodError", "AttributeConflictWarning", "CSSWarning", "CategoricalConversionWarning", "ChainedA...
InvalidComparison
python
pypa__setuptools
setuptools/_vendor/autocommand/errors.py
{ "start": 728, "end": 886 }
class ____(Exception): '''Base class for autocommand exceptions''' pass # Individual modules will define errors specific to that module.
AutocommandError
python
huggingface__transformers
src/transformers/models/modernbert_decoder/modular_modernbert_decoder.py
{ "start": 19697, "end": 22389 }
class ____(ModernBertPreTrainedModel): _skip_keys_device_placement = ["past_key_values"] _no_split_modules = ["ModernBertDecoderLayer"] _supports_flex_attn = True _supports_attention_backend = True _can_record_outputs = { "hidden_states": ModernBertDecoderLayer, "attentions": ModernB...
ModernBertDecoderPreTrainedModel
python
pytorch__pytorch
torch/_inductor/codegen/simd_kernel_features.py
{ "start": 1126, "end": 1345 }
class ____(NodeScheduleMarker): """ Marker to invoke `kernel.disable_reduction()`. This closes a reduction loop and allows for pointwise ops to occur on the output of a reduction. """
DisableReduction
python
py-pdf__pypdf
pypdf/_crypt_providers/_fallback.py
{ "start": 2422, "end": 3334 }
class ____(CryptBase): def __init__(self, key: bytes) -> None: pass def encrypt(self, data: bytes) -> bytes: raise DependencyError(_DEPENDENCY_ERROR_STR) def decrypt(self, data: bytes) -> bytes: raise DependencyError(_DEPENDENCY_ERROR_STR) def rc4_encrypt(key: bytes, data: bytes)...
CryptAES
python
fastapi__sqlmodel
docs_src/tutorial/delete/tutorial002_py310.py
{ "start": 71, "end": 2872 }
class ____(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str = Field(index=True) secret_name: str age: int | None = Field(default=None, index=True) sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" engine = create_engine(sqlite_url, ec...
Hero