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
apache__airflow
airflow-core/src/airflow/api_fastapi/execution_api/versions/v2025_09_23.py
{ "start": 949, "end": 1198 }
class ____(VersionChange): """Add the `dag_version_id` field to the TaskInstance model.""" description = __doc__ instructions_to_migrate_to_previous_version = (schema(TaskInstance).field("dag_version_id").didnt_exist,)
AddDagVersionIdField
python
pytorch__pytorch
torch/ao/quantization/observer.py
{ "start": 58941, "end": 59825 }
class ____(ObserverBase): r""" The module is mainly for debug and records the tensor values during runtime. Args: dtype: Quantized data type qscheme: Quantization scheme to be used reduce_range: Reduces the range of the quantized data type by 1 bit """ __annotations__ = {"t...
RecordingObserver
python
pypa__warehouse
warehouse/captcha/hcaptcha.py
{ "start": 2005, "end": 5289 }
class ____: def __init__(self, *, request, script_src_url, site_key, secret_key): self.request = request self.script_src_url = script_src_url self.site_key = site_key self.secret_key = secret_key self.class_name = "h-captcha" @classmethod def create_service(cls, cont...
Service
python
pytorch__pytorch
torch/testing/_internal/common_device_type.py
{ "start": 61357, "end": 62414 }
class ____: def __init__(self, *args, device_type="all"): if len(args) > 0 and isinstance(args[0], (list, tuple)): for arg in args: assert isinstance(arg, (list, tuple)), ( "When one dtype variant is a tuple or list, " "all dtype variants m...
dtypes
python
django-haystack__django-haystack
haystack/routers.py
{ "start": 47, "end": 113 }
class ____: # Reserved for future extension. pass
BaseRouter
python
mlflow__mlflow
mlflow/tracking/registry.py
{ "start": 1024, "end": 3524 }
class ____: """ Abstract class defining a scheme-based registry for store implementations. This class allows the registration of a function or class to provide an implementation for a given scheme of `store_uri` through the `register` methods. Implementations declared though the entrypoints can be ...
StoreRegistry
python
readthedocs__readthedocs.org
readthedocs/integrations/migrations/0006_set-default-value-provider-data.py
{ "start": 145, "end": 540 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("integrations", "0005_change_default_integration_secret"), ] operations = [ migrations.AlterField( model_name="integration", name="provider_data", field=jsonfield.fields.JS...
Migration
python
pytorch__pytorch
torch/_dynamo/variables/iter.py
{ "start": 19199, "end": 21926 }
class ____(IteratorVariable): """ Represents filter(fn, iterable) """ _nonvar_fields = { "index", *IteratorVariable._nonvar_fields, } def __init__( self, fn: VariableTracker, iterable: list[VariableTracker], **kwargs: Any, ) -> None: ...
FilterVariable
python
catalyst-team__catalyst
catalyst/settings.py
{ "start": 10370, "end": 14000 }
class ____: """Encapsulate the logic for finding and reading config files. Adapted from: - https://gitlab.com/pwoolvett/flake8 (MIT License) - https://github.com/python/mypy (MIT License) """ def __init__(self, program_name: str) -> None: """Initialize object to find config files. ...
ConfigFileFinder
python
ray-project__ray
rllib/utils/actors.py
{ "start": 240, "end": 9964 }
class ____: """Helper class for tracking the status of many in-flight actor tasks.""" def __init__(self): self._tasks = {} self._objects = {} self._fetching = deque() def add(self, worker, all_obj_refs): if isinstance(all_obj_refs, list): obj_ref = all_obj_refs[...
TaskPool
python
django-extensions__django-extensions
tests/test_dumpscript.py
{ "start": 243, "end": 3574 }
class ____(TestCase): def setUp(self): sys.stdout = StringIO() sys.stderr = StringIO() def test_runs(self): # lame test...does it run? n = Name(name="Gabriel") n.save() call_command("dumpscript", "django_extensions") self.assertTrue("Gabriel" in sys.stdou...
DumpScriptTests
python
google__pytype
pytype/pyi/function.py
{ "start": 1571, "end": 1677 }
class ____: abstract: bool coroutine: bool final: bool overload: bool is_async: bool
SigProperties
python
ethereum__web3.py
tests/core/providers/test_base_provider.py
{ "start": 100, "end": 219 }
class ____(BaseProvider): def is_connected(self, show_traceback: bool = False): return True
ConnectedProvider
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/matchClass1.py
{ "start": 14272, "end": 14309 }
class ____(Protocol): x: int
Proto1
python
facebook__pyre-check
client/tests/find_directories_test.py
{ "start": 10444, "end": 15486 }
class ____(testslide.TestCase): def assert_find_parent_directory_containing_directory( self, files: Iterable[str], base: str, target: str, expected: Optional[str] ) -> None: depth = len(base.split("/")) with tempfile.TemporaryDirectory() as outer_root: with tempfile.Temporary...
FindParentDirectoryContainingDirectoryTest
python
lazyprogrammer__machine_learning_examples
nlp_class2/rntn_tensorflow_rnn.py
{ "start": 671, "end": 10990 }
class ____: def __init__(self, V, D, K, activation=tf.tanh): self.V = V self.D = D self.K = K self.f = activation def fit(self, trees, test_trees, reg=1e-3, epochs=8, train_inner_nodes=False): D = self.D V = self.V K = self.K N = len(trees) ...
RecursiveNN
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/repository_definition/repository_definition.py
{ "start": 2187, "end": 4553 }
class ____( NamedTuple( "_RepositoryLoadData", [ ("cacheable_asset_data", Mapping[str, Sequence[AssetsDefinitionCacheableData]]), # reconstruction metadata contains all of the serialized metadata for a given # key using it. it is recomputed from scratch every time...
RepositoryLoadData
python
pypa__pipenv
pipenv/patched/pip/_vendor/rich/screen.py
{ "start": 288, "end": 1606 }
class ____: """A renderable that fills the terminal screen and crops excess. Args: renderable (RenderableType): Child renderable. style (StyleType, optional): Optional background style. Defaults to None. """ renderable: "RenderableType" def __init__( self, *rendera...
Screen
python
pallets__jinja
src/jinja2/utils.py
{ "start": 23239, "end": 24080 }
class ____: """A namespace object that can hold arbitrary attributes. It may be initialized from a dictionary or with keyword arguments.""" def __init__(*args: t.Any, **kwargs: t.Any) -> None: # noqa: B902 self, args = args[0], args[1:] self.__attrs = dict(*args, **kwargs) def __geta...
Namespace
python
getsentry__sentry
src/sentry/discover/models.py
{ "start": 7240, "end": 7923 }
class ____(Model): __relocation_scope__ = RelocationScope.Excluded # max_length here is based on the maximum for transactions in relay transaction = models.CharField(max_length=200) project_team = FlexibleForeignKey("sentry.ProjectTeam", db_constraint=False) organization = FlexibleForeignKey("sentr...
TeamKeyTransaction
python
scipy__scipy
scipy/stats/tests/test_stats.py
{ "start": 267413, "end": 269242 }
class ____: @pytest.mark.parametrize("alternative", ['two-sided', 'less', 'greater']) def test_against_R(self, alternative, xp): # testa against R `dagoTest` from package `fBasics` # library(fBasics) # options(digits=16) # x = c(-2, -1, 0, 1, 2, 3)**2 # x = rep(x, times=...
NormalityTests
python
getsentry__sentry
tests/sentry/auth/test_password_validation.py
{ "start": 854, "end": 3535 }
class ____(TestCase): def test_user_attribute_similarity(self) -> None: user = User(username="hello@example.com") with raises(ValidationError, match="The password is too similar to the username."): validate_password("hallo@example.com", user=user) def test_minimum_length(self) -> No...
PasswordValidationTestCase
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-oci-data-science/llama_index/embeddings/oci_data_science/client.py
{ "start": 11550, "end": 15992 }
class ____(BaseClient): """ Synchronous HTTP client for invoking models with retry logic. This client sends HTTP requests to a specified endpoint and handles retries, timeouts, and authentication. Attributes: _client (httpx.Client): The underlying HTTPX client used for sending requests. "...
Client
python
viewflow__viewflow
tests/workflow/test_token.py
{ "start": 106, "end": 1327 }
class ____(TestCase): def test_token_equals_succeed(self): token1 = Token('start/1') token2 = Token('start/1') self.assertEqual(token1, token2) def test_token_api(self): token = Token('start/1_2/3_4') self.assertTrue(token.is_split_token()) self.assertEqual(toke...
Test
python
sanic-org__sanic
tests/asyncmock.py
{ "start": 58, "end": 1227 }
class ____(Mock): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.await_count = 0 def __call__(self, *args, **kwargs): self.call_count += 1 parent = super() async def dummy(): self.await_count += 1 return parent.__call...
AsyncMock
python
django__django
tests/template_tests/test_nodelist.py
{ "start": 141, "end": 918 }
class ____(SimpleTestCase): @classmethod def setUpClass(cls): cls.engine = Engine() super().setUpClass() def test_for(self): template = self.engine.from_string("{% for i in 1 %}{{ a }}{% endfor %}") vars = template.nodelist.get_nodes_by_type(VariableNode) self.assert...
NodelistTest
python
getsentry__sentry
src/sentry/roles/manager.py
{ "start": 383, "end": 1372 }
class ____(abc.ABC): parent: RoleManager priority: int id: str name: str desc: str scopes: frozenset[str] is_retired: bool = False is_team_roles_allowed: bool = True def __post_init__(self) -> None: assert len(self.id) <= 32, "Role id must be no more than 32 characters" ...
Role
python
joke2k__faker
faker/providers/lorem/es_AR/__init__.py
{ "start": 50, "end": 183 }
class ____(SpanishProvider): """Implement lorem provider for ``es_AR`` locale. Using the same as in ```es_ES```. """
Provider
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_set.py
{ "start": 55744, "end": 56037 }
class ____(_TestOnlySetsInBinaryOps, __TestCase): def setUp(self): self.set = set((1, 2, 3)) self.other = {1:2, 3:4} self.otherIsIterable = True super().setUp() #------------------------------------------------------------------------------
TestOnlySetsDict
python
pyca__cryptography
src/cryptography/hazmat/primitives/ciphers/algorithms.py
{ "start": 1386, "end": 1605 }
class ____(BlockCipherAlgorithm): name = "AES" block_size = 128 key_sizes = frozenset([128]) key_size = 128 def __init__(self, key: utils.Buffer): self.key = _verify_key_size(self, key)
AES128
python
sqlalchemy__sqlalchemy
test/orm/test_session.py
{ "start": 69983, "end": 76641 }
class ____(_fixtures.FixtureTest): run_setup_mappers = "once" run_inserts = "once" run_deletes = None @classmethod def setup_mappers(cls): cls._setup_stock_mapping() @testing.combinations( ("close", testing.requires.cursor_works_post_rollback), ("expunge_all",), ) ...
NewStyleExecutionTest
python
huggingface__transformers
tests/models/mbart/test_modeling_mbart.py
{ "start": 15897, "end": 19243 }
class ____(AbstractSeq2SeqIntegrationTest): checkpoint_name = "facebook/mbart-large-en-ro" src_text = [ " UN Chief Says There Is No Military Solution in Syria", """ Secretary-General Ban Ki-moon says his response to Russia's stepped up military support for Syria is that "there is no military sol...
MBartEnroIntegrationTest
python
pytest-dev__pytest
testing/python/fixtures.py
{ "start": 112105, "end": 120758 }
class ____: def test_funcarg_compat(self, pytester: Pytester) -> None: config = pytester.parseconfigure("--funcargs") assert config.option.showfixtures def test_show_help(self, pytester: Pytester) -> None: result = pytester.runpytest("--fixtures", "--help") assert not result.ret...
TestShowFixtures
python
getsentry__sentry
tests/snuba/api/endpoints/test_organization_events_trends.py
{ "start": 1864, "end": 14668 }
class ____(OrganizationEventsTrendsBase): def setUp(self) -> None: super().setUp() self.url = reverse( "sentry-api-0-organization-events-trends", kwargs={"organization_id_or_slug": self.project.organization.slug}, ) self.features = {"organizations:performance-...
OrganizationEventsTrendsEndpointTest
python
explosion__spaCy
spacy/pipeline/entity_linker.py
{ "start": 1323, "end": 24189 }
class ____(TrainablePipe): """Pipeline component for named entity linking. DOCS: https://spacy.io/api/entitylinker """ NIL = "NIL" # string used to refer to a non-existing link def __init__( self, vocab: Vocab, model: Model, name: str = "entity_linker", *,...
EntityLinker
python
spack__spack
lib/spack/spack/vendor/macholib/mach_o.py
{ "start": 27861, "end": 28252 }
class ____(Structure): _fields_ = ( ("symoff", p_uint32), ("nsyms", p_uint32), ("stroff", p_uint32), ("strsize", p_uint32), ) def describe(self): s = {} s["symoff"] = int(self.symoff) s["nsyms"] = int(self.nsyms) s["stroff"] = int(self.stroff)...
symtab_command
python
django__django
tests/schema/models.py
{ "start": 4544, "end": 4749 }
class ____(models.Model): when = models.CharField(max_length=1, primary_key=True) class Meta: apps = new_apps db_table = "drop" def __str__(self): return self.when
Thing
python
tiangolo__fastapi
docs_src/custom_request_and_route/tutorial002.py
{ "start": 196, "end": 932 }
class ____(APIRoute): def get_route_handler(self) -> Callable: original_route_handler = super().get_route_handler() async def custom_route_handler(request: Request) -> Response: try: return await original_route_handler(request) except RequestValidationError a...
ValidationErrorLoggingRoute
python
pytorch__pytorch
test/nn/test_module_hooks.py
{ "start": 2758, "end": 3265 }
class ____(nn.Module): def __init__(self) -> None: super().__init__() self.net1 = Net() self.net2 = Net() def forward(self, x: torch.Tensor, bias: torch.Tensor = None) -> torch.Tensor: if bias is not None: x = x + bias return x def internal_forward_hook(...
KwargModel
python
getsentry__sentry
tests/sentry/integrations/slack/utils/test_channel.py
{ "start": 787, "end": 9507 }
class ____(TestCase): def setUp(self) -> None: self.integration = install_slack(self.event.project.organization) self.response_json = { "ok": True, "members": [ { "id": "UXXXXXXX1", "name": "patrick-jane", ...
GetChannelIdTest
python
huggingface__transformers
src/transformers/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.py
{ "start": 1175, "end": 9862 }
class ____(SequenceFeatureExtractor): r""" Constructs a Audio Spectrogram Transformer (AST) feature extractor. This feature extractor inherits from [`~feature_extraction_sequence_utils.SequenceFeatureExtractor`] which contains most of the main methods. Users should refer to this superclass for more inf...
ASTFeatureExtractor
python
html5lib__html5lib-python
html5lib/html5parser.py
{ "start": 105628, "end": 108189 }
class ____(Phase): __slots__ = tuple() def processEOF(self): pass def processComment(self, token): self.tree.insertComment(token, self.tree.document) def processSpaceCharacters(self, token): return self.parser.phases["inBody"].processSpaceCharacters(token) def processChar...
AfterAfterFramesetPhase
python
getsentry__sentry
src/sentry/integrations/slack/actions/form.py
{ "start": 714, "end": 6286 }
class ____(forms.Form): workspace = forms.ChoiceField(choices=(), widget=forms.Select()) channel = forms.CharField(widget=forms.TextInput()) channel_id = forms.CharField(required=False, widget=forms.TextInput()) tags = forms.CharField(required=False, widget=forms.TextInput()) def __init__(self, *ar...
SlackNotifyServiceForm
python
pennersr__django-allauth
allauth/socialaccount/providers/figma/views.py
{ "start": 181, "end": 998 }
class ____(OAuth2Adapter): provider_id = "figma" authorize_url = "https://www.figma.com/oauth" access_token_url = "https://www.figma.com/api/oauth/token" # nosec userinfo_url = "https://api.figma.com/v1/me" def complete_login(self, request, app, token, **kwargs): resp = ( get_...
FigmaOAuth2Adapter
python
kamyu104__LeetCode-Solutions
Python/delete-duplicate-folders-in-system.py
{ "start": 2454, "end": 3666 }
class ____(object): def deleteDuplicateFolder(self, paths): """ :type paths: List[List[str]] :rtype: List[List[str]] """ def mark(node, lookup): serialized_tree = "(" + "".join(subfolder + mark(child, lookup) for subfolder, child in sorted(node.iteritems()) if chi...
Solution2
python
milvus-io__pymilvus
pymilvus/client/abstract.py
{ "start": 13809, "end": 14134 }
class ____(BaseRanker): def __init__( self, k: int = 60, ): self._strategy = RANKER_TYPE_RRF self._k = k def dict(self): params = { "k": self._k, } return { "strategy": self._strategy, "params": params, }
RRFRanker
python
pyca__cryptography
tests/hazmat/primitives/test_hashes.py
{ "start": 465, "end": 1516 }
class ____: def test_hash_reject_unicode(self, backend): m = hashes.Hash(hashes.SHA1(), backend=backend) with pytest.raises(TypeError): m.update("\u00fc") # type: ignore[arg-type] def test_hash_algorithm_instance(self, backend): with pytest.raises(TypeError): ha...
TestHashContext
python
agronholm__apscheduler
src/apscheduler/serializers/json.py
{ "start": 413, "end": 2653 }
class ____(Serializer): """ Serializes objects using JSON. Can serialize types not normally CBOR serializable, if they implement ``__getstate__()`` and ``__setstate__()``. These objects are serialized into dicts that contain the necessary information for deserialization in ``magic_key``. :para...
JSONSerializer
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/translate.py
{ "start": 59833, "end": 64610 }
class ____(GoogleCloudBaseOperator): """ Creates a Google Cloud Translation Glossary. Creates a translation glossary, using API V3. For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:TranslateCreateGlossaryOperator`. :param glossary_id: User-specif...
TranslateCreateGlossaryOperator
python
tensorflow__tensorflow
tensorflow/python/keras/saving/saved_model/layer_serialization.py
{ "start": 5913, "end": 6932 }
class ____(LayerSavedModelSaver): """RNN layer serialization.""" @property def object_identifier(self): return constants.RNN_LAYER_IDENTIFIER def _get_serialized_attributes_internal(self, serialization_cache): objects, functions = ( super(RNNSavedModelSaver, self)._get_serialized_attributes_in...
RNNSavedModelSaver
python
pypa__warehouse
tests/unit/organizations/test_views.py
{ "start": 244, "end": 1317 }
class ____: def test_redirects_name(self, db_request): org = OrganizationFactory.create() db_request.current_route_path = pretend.call_recorder( lambda organization: "/user/the-redirect/" ) db_request.matchdict = {"organization": org.name.swapcase()} result = vi...
TestOrganizationProfile
python
huggingface__transformers
src/transformers/models/sam/image_processing_sam.py
{ "start": 1710, "end": 2189 }
class ____(ImagesKwargs, total=False): r""" mask_size (`dict[str, int]`, *optional*): The size `{"longest_edge": int}` to resize the segmentation maps to. mask_pad_size (`dict[str, int]`, *optional*): The size `{"height": int, "width": int}` to pad the segmentation maps to. Must be larger th...
SamImageProcessorKwargs
python
fsspec__filesystem_spec
fsspec/implementations/cached.py
{ "start": 19134, "end": 26296 }
class ____(CachingFileSystem): """Caches whole remote files on first access This class is intended as a layer over any other file system, and will make a local copy of each file accessed, so that all subsequent reads are local. This is similar to ``CachingFileSystem``, but without the block-wise fu...
WholeFileCacheFileSystem
python
django-crispy-forms__django-crispy-forms
crispy_forms/layout.py
{ "start": 23227, "end": 25512 }
class ____(LayoutObject): """ Layout object. It wraps fields in a ``<div>``. Attributes ---------- template : str The default template which this Layout Object will be rendered with. css_class : str, optional CSS classes to be applied to the ``<div>``. By default None. ...
Div
python
openai__openai-python
src/openai/types/fine_tuning/job_create_params.py
{ "start": 577, "end": 3729 }
class ____(TypedDict, total=False): model: Required[Union[str, Literal["babbage-002", "davinci-002", "gpt-3.5-turbo", "gpt-4o-mini"]]] """The name of the model to fine-tune. You can select one of the [supported models](https://platform.openai.com/docs/guides/fine-tuning#which-models-can-be-fine-tuned)....
JobCreateParams
python
pytorch__pytorch
torch/testing/_internal/distributed/multi_threaded_pg.py
{ "start": 19152, "end": 19617 }
class ____: default_pg: dist.ProcessGroup pg_map: dict[dist.ProcessGroup, tuple[str, Optional[Store]]] pg_names: dict[dist.ProcessGroup, str] pg_group_ranks: dict[dist.ProcessGroup, dict[int, int]] pg_backend_config: dict[dist.ProcessGroup, str] group_count: int tags_to_pg: dict[str, list[di...
WorldData
python
lepture__authlib
authlib/oauth2/rfc8414/models.py
{ "start": 144, "end": 17594 }
class ____(dict): """Define Authorization Server Metadata via `Section 2`_ in RFC8414_. .. _RFC8414: https://tools.ietf.org/html/rfc8414 .. _`Section 2`: https://tools.ietf.org/html/rfc8414#section-2 """ REGISTRY_KEYS = [ "issuer", "authorization_endpoint", "token_endpoint"...
AuthorizationServerMetadata
python
Pylons__pyramid
tests/test_config/test_views.py
{ "start": 147449, "end": 148155 }
class ____: def __init__(self, token): self.token = token def __call__(self, request, subpath, kw): kw['x'] = self.token return subpath, kw def parse_httpdate(s): import datetime # cannot use %Z, must use literal GMT; Jython honors timezone # but CPython does not retu...
DummyCacheBuster
python
walkccc__LeetCode
solutions/1954. Minimum Garden Perimeter to Collect Enough Apples/1954.py
{ "start": 0, "end": 1078 }
class ____: def minimumPerimeter(self, neededApples: int) -> int: def numApples(k: int) -> int: """Returns the number of apples at the k-th level. k := the level making perimeter = 8k p(k) := the number of apples at the k-th level on the perimeter n(k) := the number of apples at the k-...
Solution
python
django-extensions__django-extensions
tests/collisions/apps.py
{ "start": 36, "end": 123 }
class ____(AppConfig): name = "tests.collisions" app_label = "collisions"
FooConfig
python
pyqtgraph__pyqtgraph
pyqtgraph/flowchart/library/Data.py
{ "start": 244, "end": 2646 }
class ____(Node): """Select named columns from a record array.""" nodeName = "ColumnSelect" def __init__(self, name): Node.__init__(self, name, terminals={'In': {'io': 'in'}}) self.columns = set() self.columnList = QtWidgets.QListWidget() self.axis = 0 self.columnList...
ColumnSelectNode
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/hooks/test_batch_client.py
{ "start": 1382, "end": 17914 }
class ____: MAX_RETRIES = 2 STATUS_RETRIES = 3 @mock.patch.dict("os.environ", AWS_DEFAULT_REGION=AWS_REGION) @mock.patch.dict("os.environ", AWS_ACCESS_KEY_ID=AWS_ACCESS_KEY_ID) @mock.patch.dict("os.environ", AWS_SECRET_ACCESS_KEY=AWS_SECRET_ACCESS_KEY) @mock.patch("airflow.providers.amazon.aws....
TestBatchClient
python
tensorflow__tensorflow
tensorflow/python/feature_column/feature_column_v2_test.py
{ "start": 94100, "end": 97519 }
class ____(test.TestCase): @test_util.run_in_graph_and_eager_modes def test_retrieving_input(self): features = {'a': [0.]} input_layer = fc_old.InputLayer(fc.numeric_column('a')) inputs = self.evaluate(input_layer(features)) self.assertAllClose([[0.]], inputs) def test_reuses_variables(self): ...
InputLayerTest
python
streamlit__streamlit
lib/tests/streamlit/runtime/state/widgets_test.py
{ "start": 13095, "end": 23470 }
class ____(DeltaGeneratorTestCase): """Enforce that new arguments added to the signature of a widget function are taken into account when computing element IDs unless explicitly excluded. """ def signature_to_expected_kwargs(self, sig): kwargs = { kwarg: ANY for kwarg in...
ComputeElementIdTests
python
simonw__datasette
datasette/utils/__init__.py
{ "start": 27702, "end": 28423 }
class ____(click.ParamType): name = "mount:directory" def convert(self, value, param, ctx): if ":" not in value: self.fail( f'"{value}" should be of format mountpoint:directory', param, ctx, ) path, dirpath = value.split(":...
StaticMount
python
graphql-python__graphene
graphene/relay/node.py
{ "start": 1520, "end": 2226 }
class ____(Field): def __init__(self, node, type_=False, **kwargs): assert issubclass(node, Node), "NodeField can only operate in Nodes" self.node_type = node self.field_type = type_ global_id_type = node._meta.global_id_type super(NodeField, self).__init__( # If...
NodeField
python
python-attrs__attrs
tests/test_dunders.py
{ "start": 12574, "end": 12691 }
class ____: foo_value = attr.ib() @attr.attrs(unsafe_hash=True, cache_hash=True)
HashCacheSerializationTestUncached
python
dagster-io__dagster
examples/docs_projects/project_atproto_dashboard/src/project_atproto_dashboard/defs/dashboard.py
{ "start": 593, "end": 1507 }
class ____(DagsterPowerBITranslator): def get_report_spec(self, data: PowerBITranslatorData) -> dg.AssetSpec: return ( super() .get_report_spec(data) .replace_attributes( group_name="reporting", ) ) def get_semantic_model_spec(self...
CustomDagsterPowerBITranslator
python
keon__algorithms
algorithms/tree/bst/num_empty.py
{ "start": 1325, "end": 1799 }
class ____(unittest.TestCase): def setUp(self): self.tree = bst() self.tree.insert(9) self.tree.insert(6) self.tree.insert(12) self.tree.insert(3) self.tree.insert(8) self.tree.insert(10) self.tree.insert(15) self.tree.insert(7) self.tr...
TestSuite
python
spyder-ide__spyder
spyder/plugins/outlineexplorer/editor.py
{ "start": 370, "end": 2245 }
class ____(OutlineExplorerProxy): def __init__(self, editor, fname): super().__init__() self._editor = editor self.fname = fname editor.sig_cursor_position_changed.connect( self.sig_cursor_position_changed) # This saves the symbols info that comes from the server...
OutlineExplorerProxyEditor
python
huggingface__transformers
src/transformers/models/mobilebert/modeling_mobilebert.py
{ "start": 13784, "end": 16024 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.key_query_shared_bottleneck = config.key_query_shared_bottleneck self.use_bottleneck_attention = config.use_bottleneck_attention self.input = BottleneckLayer(config) if self.key_query_shared_bottleneck...
Bottleneck
python
Lightning-AI__lightning
src/lightning/pytorch/callbacks/lr_monitor.py
{ "start": 1194, "end": 15251 }
class ____(Callback): r"""Automatically monitor and logs learning rate for learning rate schedulers during training. Args: logging_interval: set to ``'epoch'`` or ``'step'`` to log ``lr`` of all optimizers at the same interval, set to ``None`` to log at individual interval accor...
LearningRateMonitor
python
allegroai__clearml
clearml/backend_api/services/v2_23/events.py
{ "start": 75956, "end": 76200 }
class ____(Response): """ Response of events.download_task_log endpoint. """ _service = "events" _action = "download_task_log" _version = "2.23" _schema = {"definitions": {}, "type": "string"}
DownloadTaskLogResponse
python
getsentry__sentry
src/sentry/monitors/validators.py
{ "start": 28420, "end": 31776 }
class ____(BaseDetectorTypeValidator): """ Validator for monitor incident detection configuration. This is a lightweight validator that delegates Monitor creation/update to the data_source field (MonitorDataSourceValidator). """ enforce_single_datasource = True data_sources = MonitorDataSo...
MonitorIncidentDetectorValidator
python
sqlalchemy__sqlalchemy
test/sql/test_insert_exec.py
{ "start": 1525, "end": 1672 }
class ____: def __init__(self, element): self.element = element def __clause_element__(self): return self.element
ExpectExpr
python
google__pytype
pytype/tools/xref/testdata/docstrings.py
{ "start": 101, "end": 453 }
class ____: #- ClassDoc documents ClassA #- ClassDoc.node/kind doc #- ClassDoc.text "Class docstring" """Class docstring""" #- @foo defines/binding FnFoo #- FnFoo.node/kind function def foo(self, x): #- MethodDoc documents FnFoo #- MethodDoc.node/kind doc #- MethodDoc.text "Method docstring" ...
A
python
PrefectHQ__prefect
tests/test_context.py
{ "start": 12292, "end": 19964 }
class ____: def test_empty(self): serialized = serialize_context() assert serialized == { "flow_run_context": {}, "task_run_context": {}, "tags_context": {}, "settings_context": SettingsContext.get().serialize(), "asset_context": {}, ...
TestSerializeContext
python
tensorflow__tensorflow
tensorflow/python/keras/initializers/initializers_v2.py
{ "start": 22626, "end": 23911 }
class ____(VarianceScaling): """The Glorot uniform initializer, also called Xavier uniform initializer. Also available via the shortcut function `tf.keras.initializers.glorot_uniform`. Draws samples from a uniform distribution within `[-limit, limit]`, where `limit = sqrt(6 / (fan_in + fan_out))` (`fan_in` ...
GlorotUniform
python
PrefectHQ__prefect
tests/runtime/test_flow_run.py
{ "start": 11231, "end": 13893 }
class ____: async def test_parent_flow_run_id_is_attribute(self): assert "parent_flow_run_id" in dir(flow_run) async def test_parent_flow_run_id_is_empty_when_not_set(self): assert flow_run.parent_flow_run_id is None async def test_parent_flow_run_id_returns_parent_flow_run_id_when_present...
TestParentFlowRunId
python
ray-project__ray
rllib/policy/dynamic_tf_policy_v2.py
{ "start": 1494, "end": 40728 }
class ____(TFPolicy): """A TFPolicy that auto-defines placeholders dynamically at runtime. This class is intended to be used and extended by sub-classing. """ def __init__( self, obs_space: gym.spaces.Space, action_space: gym.spaces.Space, config: AlgorithmConfigDict, ...
DynamicTFPolicyV2
python
matplotlib__matplotlib
lib/matplotlib/table.py
{ "start": 7800, "end": 28171 }
class ____(Artist): """ A table of cells. .. note:: ``table()`` has some fundamental design limitations and will not be developed further. If you need more functionality, consider `blume <https://github.com/swfiua/blume>`__. The table consists of a grid of cells, which are in...
Table
python
getsentry__sentry
tests/sentry/integrations/slack/test_notifications.py
{ "start": 733, "end": 4753 }
class ____(SlackActivityNotificationTest): def setUp(self) -> None: super().setUp() self.notification = DummyNotification(self.organization) def test_additional_attachment(self) -> None: with ( patch.dict( manager.attachment_generators, {Exter...
SlackNotificationsTest
python
HypothesisWorks__hypothesis
hypothesis-python/tests/array_api/conftest.py
{ "start": 1595, "end": 4847 }
class ____(UserWarning): """Custom warning so we can bypass our global capturing""" name_to_entry_point = installed_array_modules() xp_and_xps_pairs: list[tuple[ModuleType, SimpleNamespace]] = [] with warnings.catch_warnings(): # We ignore all warnings here as many array modules warn on import. Ideally # ...
InvalidArgumentWarning
python
huggingface__transformers
src/transformers/generation/configuration_utils.py
{ "start": 64281, "end": 66945 }
class ____(ABC): """Generic watermarking config""" @classmethod def from_dict(cls, config_dict, **kwargs): """ Constructs a BaseWatermarkingConfig instance from a dictionary of parameters. Args: config_dict (dict[str, Any]): Dictionary containing configuration parameter...
BaseWatermarkingConfig
python
tensorflow__tensorflow
tensorflow/python/distribute/distribute_lib.py
{ "start": 35084, "end": 37375 }
class ____(object): """A class wrapping information needed by a distribute function. This is a context class that is passed to the `value_fn` in `strategy.experimental_distribute_values_from_function` and contains information about the compute replicas. The `num_replicas_in_sync` and `replica_id` can be used...
ValueContext
python
tensorflow__tensorflow
tensorflow/python/util/dispatch.py
{ "start": 6864, "end": 50220 }
class ____(OpDispatcher): """Dispatcher that handles op if any arguments have a specified type. Checks the types of the arguments and keyword arguments (including elements of lists or tuples), and if any argument values have the indicated type(s), then delegates to an override function. """ def __init__(s...
_TypeBasedDispatcher
python
huggingface__transformers
tests/models/musicgen_melody/test_modeling_musicgen_melody.py
{ "start": 22782, "end": 43272 }
class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (MusicgenMelodyForConditionalGeneration,) if is_torch_available() else () # Doesn't run generation tests. See `greedy_sample_model_classes` below all_generative_model_classes = () greedy_samp...
MusicgenMelodyTest
python
dagster-io__dagster
examples/google_drive_factory/google_drive_factory/definitions.py
{ "start": 292, "end": 391 }
class ____(BaseModel): id: str name: str createdTime: str modifiedTime: str
DriveFile
python
getsentry__sentry
tests/sentry/issues/endpoints/test_group_tombstone_details.py
{ "start": 184, "end": 3260 }
class ____(APITestCase): def test_delete(self) -> None: self.user = self.create_user("foo@example.com") self.org = self.create_organization(owner=self.user, name="Rowdy Tiger") self.team = self.create_team(organization=self.org, name="Mariachi Band") self.project = self.create_projec...
GroupTombstoneDetailsTest
python
automl__auto-sklearn
test/test_pipeline/components/classification/test_qda.py
{ "start": 163, "end": 823 }
class ____(BaseClassificationComponentTest): __test__ = True res = dict() res["default_iris"] = 1.0 res["default_iris_iterative"] = -1 res["default_iris_proba"] = 0.56124476634783993 res["default_iris_sparse"] = -1 res["default_digits"] = 0.18882817243472982 res["default_digits_iterati...
QDAComponentTest
python
getsentry__sentry
src/sentry/core/endpoints/organization_member_utils.py
{ "start": 2165, "end": 6840 }
class ____(OrganizationPermission): scope_map = { "GET": ["member:read", "member:write", "member:admin"], "POST": ["member:write", "member:admin"], "PUT": ["member:invite", "member:write", "member:admin"], # DELETE checks for role comparison as you can either remove a member ...
RelaxedMemberPermission
python
huggingface__transformers
src/transformers/models/beit/modeling_beit.py
{ "start": 46357, "end": 48637 }
class ____(nn.Module): """ Fully Convolution Networks for Semantic Segmentation. This head is implemented of [FCNNet](https://huggingface.co/papers/1411.4038>). Args: config (BeitConfig): Configuration. in_channels kernel_size (int): The kernel size for convs in the head. Defaul...
BeitFCNHead
python
huggingface__transformers
tests/models/flava/test_modeling_flava.py
{ "start": 43184, "end": 44188 }
class ____(unittest.TestCase): @slow def test_inference(self): model_name = "facebook/flava-full" model = FlavaModel.from_pretrained(model_name).to(torch_device) processor = FlavaProcessor.from_pretrained(model_name) image = prepare_img() inputs = processor( ...
FlavaModelIntegrationTest
python
mlflow__mlflow
mlflow/models/evaluation/artifacts.py
{ "start": 2614, "end": 3568 }
class ____(EvaluationArtifact): def _save(self, output_artifact_path): with open(output_artifact_path, "wb") as f: pickle.dump(self._content, f) def _load_content_from_file(self, local_artifact_path): with open(local_artifact_path, "rb") as f: self._content = pickle.load...
PickleEvaluationArtifact
python
spyder-ide__spyder
spyder/plugins/completion/providers/snippets/widgets/snippetsconfig.py
{ "start": 5894, "end": 9054 }
class ____: """Convenience class to store user snippets.""" def __init__(self, language=None, trigger_text="", description="", snippet_text="", remove_trigger=False, get_option=None, set_option=None): self.index = 0 self.language = language if self.lang...
Snippet
python
huggingface__transformers
benchmark_v2/framework/hardware_metrics.py
{ "start": 2593, "end": 3634 }
class ____: """A class to get statistics about the GPU. It serves as a wrapper that holds the GPU total memory and its name, which is used to call the right function to get the utilization and memory used.""" def __init__(self) -> None: self.device_name, self.device_memory_total = get_device_name_a...
GPUStatsCollector
python
huggingface__transformers
tests/models/t5/test_tokenization_t5.py
{ "start": 933, "end": 2739 }
class ____(TokenizerTesterMixin, unittest.TestCase): from_pretrained_id = "google-t5/t5-small" tokenizer_class = T5Tokenizer integration_expected_tokens = ['▁This', '▁is', '▁', 'a', '▁test', '▁', '😊', '▁I', '▁was', '▁born', '▁in', '▁9', '2000', ',', '▁and', '▁this', '▁is', '▁fal', 's', 'é', '.', '▁', '生活的...
T5TokenizationTest
python
django__django
tests/timezones/forms.py
{ "start": 116, "end": 188 }
class ____(forms.Form): dt = forms.SplitDateTimeField()
EventSplitForm
python
mlflow__mlflow
mlflow/semantic_kernel/autolog.py
{ "start": 3379, "end": 4582 }
class ____(SimpleSpanProcessor): def __init__(self): # NB: Dummy NoOp exporter, because OTel span processor requires an exporter self.span_exporter = SpanExporter() def on_start(self, span: OTelSpan, parent_context: Context | None = None): # Trigger MLflow's span processor trace...
SemanticKernelSpanProcessor
python
apache__airflow
providers/slack/src/airflow/providers/slack/transfers/sql_to_slack_webhook.py
{ "start": 1236, "end": 6843 }
class ____(BaseSqlToSlackOperator): """ Executes an SQL statement in a given SQL connection and sends the results to Slack Incoming Webhook. The results of the query are rendered into the 'slack_message' parameter as a Pandas dataframe using a JINJA variable called '{{ results_df }}'. The 'results_df' ...
SqlToSlackWebhookOperator