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
pytorch__pytorch
test/export/test_export.py
{ "start": 640391, "end": 663898 }
class ____(TestCase): def test_scaled_dot_product_attention_cpu(self): """ This test makes sure we are always getting the same decomposition result for SDPA. As of now _scaled_dot_product_flash_attention_for_cpu is expected to show up in export() result. Some downstream backend then ...
TestOneOffModelExportResult
python
spulec__freezegun
tests/test_class_decorator.py
{ "start": 174, "end": 1848 }
class ____: @pytest.fixture def ff(self) -> datetime: return datetime.now() @pytest.fixture def yield_ff(self) -> Iterator[datetime]: yield datetime.now() @pytest.fixture def func(self) -> Iterator[datetime]: yield datetime.now() def test_with_fixture(self, ff: dat...
TestClassDecoratorWithFixture
python
tensorflow__tensorflow
tensorflow/python/distribute/failure_handling/failure_handling.py
{ "start": 8940, "end": 9450 }
class ____(TerminationConfig): """Configurations for GCP CPU VM.""" def __init__( # pylint: disable=super-init-not-called self, termination_watcher_fn=None, exit_fn=None, grace_period=None, save_fn=None): self.termination_watcher_fn = termination_watcher_fn or failure_handling_ut...
GcpCpuTerminationConfig
python
getsentry__sentry
tests/sentry/lang/native/test_sources.py
{ "start": 1399, "end": 5296 }
class ____: @override_settings(SENTRY_BUILTIN_SOURCES=SENTRY_BUILTIN_SOURCES_TEST) @patch("sentry.lang.native.sources.get_gcp_token") @django_db_all def test_sources_gcp_bearer_authentication(self, mock_get_gcp_token, default_project) -> None: mock_get_gcp_token.return_value = "ya29.TOKEN" ...
TestGcpBearerAuthentication
python
apache__avro
lang/py/avro/test/test_protocol.py
{ "start": 12930, "end": 13749 }
class ____(unittest.TestCase): def test_inner_namespace_set(self): print("") print("TEST INNER NAMESPACE") print("===================") print("") proto = HELLO_WORLD.parse() self.assertEqual(proto.namespace, "com.acme") self.assertEqual(proto.fullname, "com.ac...
TestMisc
python
ray-project__ray
rllib/algorithms/algorithm_config.py
{ "start": 310942, "end": 319329 }
class ____(AlgorithmConfig): """An RLlib DifferentiableAlgorithmConfig builds a Meta algorithm from a given configuration .. testcode:: from ray.rllib.algorithm.algorithm_config import DifferentiableAlgorithmConfig # Construct a generic config for an algorithm that needs differentiable Lea...
DifferentiableAlgorithmConfig
python
tensorflow__tensorflow
tensorflow/python/data/kernel_tests/text_line_dataset_test.py
{ "start": 1446, "end": 2765 }
class ____(test_base.DatasetTestBase): """Base class for setting up and testing TextLineDataset.""" def _lineText(self, f, l): return compat.as_bytes("%d: %d" % (f, l)) def _createFiles(self, num_files, num_lines, crlf=False, compre...
TextLineDatasetTestBase
python
xlwings__xlwings
xlwings/constants.py
{ "start": 118309, "end": 118437 }
class ____: xlTabPositionFirst = 0 # from enum XlTabPosition xlTabPositionLast = 1 # from enum XlTabPosition
TabPosition
python
pytorch__pytorch
torch/fx/_graph_pickler.py
{ "start": 8151, "end": 10708 }
class ____: metadata: MetaTensorDesc[FakeTensor] @classmethod def reduce_helper( cls, pickler: GraphPickler, obj: FakeTensor ) -> tuple[ Callable[[Self, _UnpickleState], FakeTensor], tuple[Self, _UnpickleStateToken] ]: return cls.unpickle, ( cls(pickler._meta_ten...
_TensorPickleData
python
getsentry__sentry
tests/sentry/db/postgres/schema/safe_migrations/integration/test_migrations.py
{ "start": 14355, "end": 14676 }
class ____: app = "" def col_exists(self, col_name): with connection.cursor() as cursor: table_name = f"{self.app}_testtable" columns = connection.introspection.get_table_description(cursor, table_name) return any(c for c in columns if c.name == col_name)
ColExistsMixin
python
airbytehq__airbyte
airbyte-ci/connectors/metadata_service/orchestrator/orchestrator/assets/connector_metrics.py
{ "start": 313, "end": 2282 }
class ____(json.JSONDecoder): """A JSON decoder that converts "null" strings to None.""" def __init__(self, *args, **kwargs): super().__init__(object_hook=self.object_hook, *args, **kwargs) def object_hook(self, obj): return {k: (None if v == "null" else v) for k, v in obj.items()} @sent...
StringNullJsonDecoder
python
readthedocs__readthedocs.org
readthedocs/organizations/tests/test_access.py
{ "start": 377, "end": 6993 }
class ____: url_responses = {} def login(self): raise NotImplementedError def is_admin(self): raise NotImplementedError def assertResponse(self, path, method=None, data=None, **kwargs): self.login() if method is None: method = self.client.get if dat...
OrganizationAccessMixin
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-milvus/llama_index/readers/milvus/base.py
{ "start": 191, "end": 4555 }
class ____(BaseReader): """Milvus reader.""" def __init__( self, host: str = "localhost", port: int = 19530, user: str = "", password: str = "", use_secure: bool = False, ): """Initialize with parameters.""" import_err_msg = ( "`py...
MilvusReader
python
tiangolo__fastapi
docs_src/dependencies/tutorial003_an.py
{ "start": 212, "end": 697 }
class ____: def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100): self.q = q self.skip = skip self.limit = limit @app.get("/items/") async def read_items(commons: Annotated[Any, Depends(CommonQueryParams)]): response = {} if commons.q: response.up...
CommonQueryParams
python
GoogleCloudPlatform__python-docs-samples
appengine/standard/ndb/async/guestbook.py
{ "start": 790, "end": 977 }
class ____(ndb.Model): email = ndb.StringProperty() nickname = ndb.StringProperty() def nick(self): return self.nickname or self.email # Whichever is non-empty
Account
python
huggingface__transformers
src/transformers/models/blip_2/modeling_blip_2.py
{ "start": 13923, "end": 14584 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.config = config self.activation_fn = ACT2FN[config.hidden_act] self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size) self.fc2 = nn.Linear(config.intermediate_size, config.hidden_size) ...
Blip2MLP
python
PrefectHQ__prefect
tests/server/orchestration/api/test_validation.py
{ "start": 14744, "end": 20345 }
class ____: async def test_missing_block_document_default_value( self, flow, session, missing_block_doc_ref_template, ): work_pool = await create_work_pool( session=session, base_job_template=missing_block_doc_ref_template, ) deploy...
TestDeploymentFlowRunJobVariablesValidation
python
pypa__packaging
src/packaging/pylock.py
{ "start": 9812, "end": 10607 }
class ____: path: str editable: bool | None = None subdirectory: str | None = None def __init__( self, *, path: str, editable: bool | None = None, subdirectory: str | None = None, ) -> None: # In Python 3.10+ make dataclass kw_only=True and remove __i...
PackageDirectory
python
redis__redis-py
redis/backoff.py
{ "start": 589, "end": 1119 }
class ____(AbstractBackoff): """Constant backoff upon failure""" def __init__(self, backoff: float) -> None: """`backoff`: backoff time in seconds""" self._backoff = backoff def __hash__(self) -> int: return hash((self._backoff,)) def __eq__(self, other) -> bool: if no...
ConstantBackoff
python
apache__airflow
airflow-core/tests/unit/utils/test_entry_points.py
{ "start": 961, "end": 1155 }
class ____: def __init__(self, name: str, entry_points: Iterable[metadata.EntryPoint]) -> None: self.metadata = {"Name": name} self.entry_points = entry_points
MockDistribution
python
pytorch__pytorch
torchgen/selective_build/selector.py
{ "start": 735, "end": 12666 }
class ____: # If true, then the build is not selective, and includes all # operators. include_all_operators: bool # Debug Information at the selective/custom build level. _debug_info: tuple[str, ...] | None # A dictionary of operator -> operator metadata. operators: dict[str, SelectiveBuil...
SelectiveBuilder
python
davidhalter__jedi
jedi/inference/base_value.py
{ "start": 11990, "end": 12212 }
class ____(_ValueWrapperBase): def __init__(self, wrapped_value): self._wrapped_value = wrapped_value def __repr__(self): return '%s(%s)' % (self.__class__.__name__, self._wrapped_value)
ValueWrapper
python
kamyu104__LeetCode-Solutions
Python/maximum-number-of-events-that-can-be-attended-ii.py
{ "start": 61, "end": 688 }
class ____(object): def maxValue(self, events, k): """ :type events: List[List[int]] :type k: int :rtype: int """ events.sort(key=lambda x: x[1]) sorted_ends = [x[1] for x in events] dp = [[0]*(k+1) for _ in xrange(len(events)+1)] for i in xran...
Solution
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 153866, "end": 154885 }
class ____(sgqlc.types.Input): """Descriptive details about the check run.""" __schema__ = github_schema __field_names__ = ("title", "summary", "text", "annotations", "images") title = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="title") """A title to provide for this check run."""...
CheckRunOutput
python
davidhalter__jedi
jedi/api/environment.py
{ "start": 4243, "end": 4489 }
class ____: def __init__(self): self._start_executable = self.executable = sys.executable self.path = sys.prefix self.version_info = _VersionInfo(*sys.version_info[:3]) self._env_vars = None
_SameEnvironmentMixin
python
cherrypy__cherrypy
cherrypy/test/helper.py
{ "start": 592, "end": 1017 }
class ____(object): """Base class for modeling and controlling servers during testing.""" def __init__(self, **kwargs): """Initialize a supervisor.""" for k, v in kwargs.items(): if k == 'port': setattr(self, k, int(v)) setattr(self, k, v) def log_to_st...
Supervisor
python
vyperlang__vyper
vyper/exceptions.py
{ "start": 10187, "end": 10304 }
class ____(VyperException): """Second argument to a division or modulo operation was zero."""
ZeroDivisionException
python
tensorflow__tensorflow
tensorflow/python/ops/init_ops_v2_test.py
{ "start": 6993, "end": 8158 }
class ____(InitializersTest): @test_util.run_in_graph_and_eager_modes def testRangeInitializer(self): shape = (20, 6, 7) self._range_test( init_ops_v2.RandomUniform(minval=-1, maxval=1, seed=124), shape, target_mean=0., target_max=1, target_min=-1) @test_util.run_...
RandomUniformInitializerTest
python
kamyu104__LeetCode-Solutions
Python/clone-binary-tree-with-random-pointer.py
{ "start": 52, "end": 272 }
class ____(object): def __init__(self, val=0, left=None, right=None, random=None): self.val = val self.left = left self.right = right self.random = random # Definition for NodeCopy.
Node
python
sanic-org__sanic
sanic/mixins/exceptions.py
{ "start": 130, "end": 3888 }
class ____(metaclass=SanicMeta): def __init__(self, *args, **kwargs) -> None: self._future_exceptions: set[FutureException] = set() def _apply_exception_handler(self, handler: FutureException): raise NotImplementedError # noqa def exception( self, *exceptions: Union[type[E...
ExceptionMixin
python
scikit-learn__scikit-learn
sklearn/externals/_numpydoc/docscrape.py
{ "start": 19092, "end": 19307 }
class ____(NumpyDocString): def __init__(self, obj, doc=None, config=None): self._f = obj if config is None: config = {} NumpyDocString.__init__(self, doc, config=config)
ObjDoc
python
django__django
django/db/models/expressions.py
{ "start": 35827, "end": 39334 }
class ____(SQLiteNumericMixin, Expression): """An SQL function call.""" function = None template = "%(function)s(%(expressions)s)" arg_joiner = ", " arity = None # The number of arguments the function accepts. def __init__(self, *expressions, output_field=None, **extra): if self.arity...
Func
python
django__django
django/db/migrations/migration.py
{ "start": 165, "end": 9310 }
class ____: """ The base class for all migrations. Migration files will import this from django.db.migrations.Migration and subclass it as a class called Migration. It will have one or more of the following attributes: - operations: A list of Operation instances, probably from django.d...
Migration
python
getsentry__sentry
tests/sentry/api/endpoints/test_auth_config.py
{ "start": 412, "end": 3064 }
class ____(APITestCase): path = "/api/0/auth/config/" def test_logged_in(self) -> None: user = self.create_user("foo@example.com") self.login_as(user) response = self.client.get(self.path) assert response.status_code == 200 assert response.data["nextUri"] == "/organizat...
AuthConfigEndpointTest
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/genericType8.py
{ "start": 146, "end": 225 }
class ____: pass T_A = TypeVar("T_A", bound=ClassA) T = TypeVar("T")
ClassA
python
ZoranPandovski__al-go-rithms
data_structures/Graphs/graph/Python/DijkstraShortestPath.py
{ "start": 151, "end": 2750 }
class ____: def __init__(self, directed=False): self.graph = defaultdict(list) self.directed = directed def addEdge(self, frm, to, weight): self.graph[frm].append([to, weight]) if self.directed is False: self.graph[to].append([frm, weight]) else: ...
Graph
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-qdrant/llama_index/vector_stores/qdrant/base.py
{ "start": 1971, "end": 65550 }
class ____(BasePydanticVectorStore): """ Qdrant Vector Store. In this vector store, embeddings and docs are stored within a Qdrant collection. During query time, the index uses Qdrant to query for the top k most similar nodes. Args: collection_name: (str): name of the Qdrant colle...
QdrantVectorStore
python
spyder-ide__spyder
spyder/utils/snippets/nodes.py
{ "start": 6625, "end": 7067 }
class ____(ASTNode): """ Base regex formatting node. All regex formatting nodes should extend this class. """ def transform_regex(self, regex_result): """ Transform a regex match. This method takes a regex result and applies some transformation to return a new stri...
FormatNode
python
psf__black
tests/data/cases/class_blank_parentheses.py
{ "start": 0, "end": 50 }
class ____(): pass
SimpleClassWithBlankParentheses
python
facebook__pyre-check
documentation/pysa_tutorial/exercise5/urls.py
{ "start": 262, "end": 384 }
class ____: path: str callback: str urlpatterns = [UrlPattern(r"^operate_on_twos/(.*)", operate_on_twos)]
UrlPattern
python
kamyu104__LeetCode-Solutions
Python/shortest-path-in-a-hidden-grid.py
{ "start": 37, "end": 216 }
class ____(object): def canMove(self, direction): pass def move(self, direction): pass def isTarget(self): pass import collections
GridMaster
python
django__django
django/db/backends/mysql/schema.py
{ "start": 183, "end": 9938 }
class ____(BaseDatabaseSchemaEditor): sql_rename_table = "RENAME TABLE %(old_table)s TO %(new_table)s" sql_alter_column_null = "MODIFY %(column)s %(type)s NULL" sql_alter_column_not_null = "MODIFY %(column)s %(type)s NOT NULL" sql_alter_column_type = "MODIFY %(column)s %(type)s%(collation)s%(comment)s"...
DatabaseSchemaEditor
python
sqlalchemy__sqlalchemy
test/base/test_utils.py
{ "start": 98260, "end": 100157 }
class ____(fixtures.TestBase): def test_subclass_overrides_cls_given(self): class Foo: def bar(self): pass class Bar(Foo): def bar(self): pass is_true(util.method_is_overridden(Bar, Foo.bar)) def test_subclass_overrides(self): ...
MethodOveriddenTest
python
realpython__materials
torchaudio/speech.py
{ "start": 2517, "end": 4592 }
class ____(Dataset): def __init__( self, folder: str | Path | None = None, seconds: int | float | None = None, noise_level: float = 0.005, enable_noise: bool = True, transform: Callable[[Tensor], Tensor] | None = None, ) -> None: if folder: sel...
AugmentedSpeechCommands
python
PyCQA__pylint
doc/data/messages/c/class-variable-slots-conflict/good.py
{ "start": 0, "end": 253 }
class ____: __slots__ = ("_age", "name") def __init__(self, age, name): self._age = age self.name = name @property def age(self): return self._age def say_hi(self): print(f"Hi, I'm {self.name}.")
Person
python
numba__numba
numba/core/errors.py
{ "start": 1393, "end": 1530 }
class ____(NumbaWarning, DeprecationWarning): """ Warning category for use of a deprecated feature. """
NumbaDeprecationWarning
python
run-llama__llama_index
llama-index-packs/llama-index-packs-ollama-query-engine/llama_index/packs/ollama_query_engine/base.py
{ "start": 1311, "end": 4484 }
class ____(BaseEmbedding): """ Class for Ollama embeddings. Args: model_name (str): Model for embedding. base_url (str): Ollama url. Defaults to http://localhost:11434. """ _base_url: str = PrivateAttr() _verbose: bool = PrivateAttr() def __init__( self, ...
OllamaEmbedding
python
viewflow__viewflow
viewflow/workflow/migrations/0003_task_owner_permission_change.py
{ "start": 108, "end": 426 }
class ____(migrations.Migration): dependencies = [ ("viewflow", "0002_fsmchange"), ] operations = [ migrations.AlterField( model_name="task", name="owner_permission", field=models.CharField(blank=True, null=True, max_length=150), ), ]
Migration
python
kubernetes-client__python
kubernetes/client/models/v1beta2_device_allocation_result.py
{ "start": 383, "end": 5285 }
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...
V1beta2DeviceAllocationResult
python
pandas-dev__pandas
pandas/core/interchange/column.py
{ "start": 1934, "end": 17922 }
class ____(Column): """ A column object, with only the methods and properties required by the interchange protocol defined. A column can contain one or more chunks. Each chunk can contain up to three buffers - a data buffer, a mask buffer (depending on null representation), and an offsets buffer...
PandasColumn
python
protocolbuffers__protobuf
python/google/protobuf/text_format.py
{ "start": 1835, "end": 1909 }
class ____(Exception): """Top-level module error for text_format."""
Error
python
django__django
tests/contenttypes_tests/test_fields.py
{ "start": 330, "end": 2776 }
class ____(TestCase): def test_str(self): class Model(models.Model): field = GenericForeignKey() field = Model._meta.get_field("field") self.assertEqual(str(field), "contenttypes_tests.Model.field") def test_get_content_type_no_arguments(self): field = Answer._meta...
GenericForeignKeyTests
python
django__django
tests/migrations/models.py
{ "start": 1198, "end": 1339 }
class ____(models.Manager): def __init__(self, a, b, c=1, d=2): super().__init__() self.args = (a, b, c, d)
BaseFoodManager
python
jazzband__django-oauth-toolkit
tests/test_oauth2_provider_middleware.py
{ "start": 381, "end": 3694 }
class ____(TestCase): def setUp(self): self.factory = RequestFactory() self.middleware = OAuth2ExtraTokenMiddleware(lambda r: None) # Create test user and application for valid token tests self.user = User.objects.create_user("test_user", "test@example.com", "123456") self.a...
TestOAuth2ExtraTokenMiddleware
python
pypa__pipenv
pipenv/patched/pip/_internal/utils/hashes.py
{ "start": 4366, "end": 5002 }
class ____(Hashes): """A workalike for Hashes used when we're missing a hash for a requirement It computes the actual hash of the requirement and raises a HashMissing exception showing it to the user. """ def __init__(self) -> None: """Don't offer the ``hashes`` kwarg.""" # Pass o...
MissingHashes
python
ray-project__ray
python/ray/data/_internal/stats.py
{ "start": 4442, "end": 31511 }
class ____: """Actor holding stats for blocks created by LazyBlockList. This actor is shared across all datasets created in the same cluster. In order to cap memory usage, we set a max number of stats to keep in the actor. When this limit is exceeded, the stats will be garbage collected in FIFO ord...
_StatsActor
python
Lightning-AI__lightning
src/lightning/fabric/plugins/precision/transformer_engine.py
{ "start": 1436, "end": 8308 }
class ____(Precision): """Plugin for training with fp8 precision via nvidia's `Transformer Engine <https://docs.nvidia.com/deeplearning/transformer-engine>`__. .. warning:: This is an :ref:`experimental <versioning:Experimental API>` feature. Args: weights_dtype: The weights dtype to use. ...
TransformerEnginePrecision
python
huggingface__transformers
tests/quantization/autoawq/test_awq.py
{ "start": 1344, "end": 3483 }
class ____(unittest.TestCase): def test_wrong_backend(self): """ Simple test that checks if a user passes a wrong backend an error is raised """ # This should work fine _ = AwqConfig(bits=4) with self.assertRaises(ValueError): AwqConfig(bits=4, backend=""...
AwqConfigTest
python
facebook__pyre-check
tools/generate_taint_models/tests/get_dynamic_graphql_sources_test.py
{ "start": 914, "end": 1063 }
class ____: def method1(self, foo) -> bool: return True def method2(self, foo, *bar) -> bool: return True @dataclass
TestClass
python
Lightning-AI__lightning
tests/tests_pytorch/callbacks/progress/test_tqdm_progress_bar.py
{ "start": 17086, "end": 30968 }
class ____(BoringModel): def training_step(self, *args, **kwargs): self.print("training_step", end="") return super().training_step(*args, **kwargs) def validation_step(self, *args, **kwargs): self.print("validation_step", file=sys.stderr) return super().validation_step(*args, *...
PrintModel
python
pytorch__pytorch
torch/nn/modules/pooling.py
{ "start": 57212, "end": 58131 }
class ____(_AdaptiveAvgPoolNd): r"""Applies a 1D adaptive average pooling over an input signal composed of several input planes. The output size is :math:`L_{out}`, for any input size. The number of output features is equal to the number of input planes. Args: output_size: the target output si...
AdaptiveAvgPool1d
python
sqlalchemy__sqlalchemy
test/ext/test_mutable.py
{ "start": 2741, "end": 3055 }
class ____(MutableComposite): x: int y: int def __setattr__(self, key, value): object.__setattr__(self, key, value) self.changed() def __getstate__(self): return self.x, self.y def __setstate__(self, state): self.x, self.y = state @dataclasses.dataclass
DCPoint
python
doocs__leetcode
lcof/面试题53 - I. 在排序数组中查找数字 I/Solution.py
{ "start": 0, "end": 173 }
class ____: def search(self, nums: List[int], target: int) -> int: l = bisect_left(nums, target) r = bisect_right(nums, target) return r - l
Solution
python
plotly__plotly.py
plotly/graph_objs/scattergl/marker/_colorbar.py
{ "start": 233, "end": 61680 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scattergl.marker" _path_str = "scattergl.marker.colorbar" _valid_props = { "bgcolor", "bordercolor", "borderwidth", "dtick", "exponentformat", "labelalias", "len", "lenmode", "min...
ColorBar
python
dagster-io__dagster
python_modules/automation/automation/dagster_docs/watcher.py
{ "start": 5060, "end": 10158 }
class ____: """Watches for file changes and dynamically manages docstring validation.""" def __init__(self, root_path: Path, config: ValidationConfig, verbose: bool = False): """Initialize the changed files watcher. Args: root_path: Root path of the git repository confi...
ChangedFilesWatcher
python
great-expectations__great_expectations
contrib/great_expectations_zipcode_expectations/great_expectations_zipcode_expectations/expectations/expect_column_values_to_be_valid_virginia_zip.py
{ "start": 747, "end": 1751 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.valid_virginia_zip" # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _pand...
ColumnValuesToBeValidVirginiaZip
python
pytorch__pytorch
torch/onnx/_internal/torchscript_exporter/verification.py
{ "start": 1427, "end": 19154 }
class ____: """Options for ONNX export verification. .. deprecated:: 2.7 Consider using ``torch.onnx.export(..., dynamo=True)`` and use the returned ``ONNXProgram`` to test the ONNX model. Attributes: flatten: If True, unpack nested list/tuple/dict inputs into a flattened list of ...
VerificationOptions
python
django__django
tests/admin_views/models.py
{ "start": 3482, "end": 3591 }
class ____(models.Model): name = models.CharField(max_length=100, blank=True)
RowLevelChangePermissionModel
python
tornadoweb__tornado
tornado/iostream.py
{ "start": 3218, "end": 3426 }
class ____(Exception): """Exception raised when a read cannot be satisfied. Raised by ``read_until`` and ``read_until_regex`` with a ``max_bytes`` argument. """ pass
UnsatisfiableReadError
python
tensorflow__tensorflow
tensorflow/python/saved_model/model_utils/export_output.py
{ "start": 14629, "end": 14991 }
class ____(_SupervisedOutput): """Represents the output of a supervised training process. This class generates the appropriate signature def for exporting training output by type-checking and wrapping loss, predictions, and metrics values. """ def _get_signature_def_fn(self): return signature_def_util...
TrainOutput
python
getsentry__sentry
src/sentry/integrations/api/serializers/models/doc_integration_avatar.py
{ "start": 240, "end": 573 }
class ____(Serializer): def serialize( self, obj: DocIntegrationAvatar, attrs, user, **kwargs ) -> MutableMapping[str, Any]: return { "avatarType": obj.get_avatar_type_display(), "avatarUuid": obj.ident, "avatarUrl": obj.absolute_url(), }
DocIntegrationAvatarSerializer
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/recursiveTypeAlias8.py
{ "start": 330, "end": 371 }
class ____(TypedDict): type: int
ClassC
python
getsentry__sentry
src/sentry/uptime/subscriptions/subscriptions.py
{ "start": 2774, "end": 3491 }
class ____(ValueError): pass def check_uptime_subscription_limit(organization_id: int) -> None: """ Check if adding a new manual uptime monitor would exceed the organization's limit. Raises MaxManualUptimeSubscriptionsReached if the limit would be exceeded. """ manual_subscription_count = Dete...
MaxManualUptimeSubscriptionsReached
python
prabhupant__python-ds
data_structures/graphs/not_reachable_nodes.py
{ "start": 37, "end": 813 }
class ____: def __init__(self, vertices): self.V = vertices self.graph = defaultdict(list) def add_edge(self, u, v): self.graph[u].append(v) self.graph[v].append(u) def dfs_util(self, v, visited): visited[v] = True for i in self.graph[v]: if ...
Graph
python
openai__openai-python
src/openai/types/realtime/call_refer_params.py
{ "start": 206, "end": 422 }
class ____(TypedDict, total=False): target_uri: Required[str] """URI that should appear in the SIP Refer-To header. Supports values like `tel:+14155550123` or `sip:agent@example.com`. """
CallReferParams
python
openai__gym
gym/wrappers/rescale_action.py
{ "start": 150, "end": 3100 }
class ____(gym.ActionWrapper): """Affinely rescales the continuous action space of the environment to the range [min_action, max_action]. The base environment :attr:`env` must have an action space of type :class:`spaces.Box`. If :attr:`min_action` or :attr:`max_action` are numpy arrays, the shape must matc...
RescaleAction
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/backfill.py
{ "start": 3866, "end": 4034 }
class ____(graphene.ObjectType): backfill_id = graphene.NonNull(graphene.String) class Meta: name = "ResumeBackfillSuccess"
GrapheneResumeBackfillSuccess
python
huggingface__transformers
src/transformers/models/moonshine/modeling_moonshine.py
{ "start": 2267, "end": 2857 }
class ____(nn.Module): def __init__(self, config, hidden_act): super().__init__() self.config = config self.activation_fn = ACT2FN[hidden_act] self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size) self.fc2 = nn.Linear(config.intermediate_size, config.hidden_size)...
MoonshineEncoderMLP
python
getsentry__sentry
src/sentry/workflow_engine/migrations/0068_migrate_anomaly_detection_alerts.py
{ "start": 867, "end": 936 }
class ____(Enum): DETECTED = 0 ALERT_TRIGGERED = 2
IncidentType
python
yandexdataschool__Practical_RL
week04_approx_rl/dqn/replay_buffer.py
{ "start": 2401, "end": 4296 }
class ____(ReplayBuffer): """ ReplayBuffer for vectorized environments, which are wrapped into FrameBuffers. If an environment is first wrapped into a FrameBuffer and then vectorized, then the resulting VecEnv will not use LazyFrames, but it will directly use np.ndarrays, thus greatly increasing RA...
LazyFramesVectorReplayBuffer
python
conda__conda
conda/plugins/hookspec.py
{ "start": 1386, "end": 22212 }
class ____: """Collection of all supported conda plugin hookspecs.""" @_hookspec def conda_solvers(self) -> Iterable[CondaSolver]: """ Register solvers in conda. **Example:** .. code-block:: python import logging from conda import plugins ...
CondaSpecs
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/duplicateDeclaration2.py
{ "start": 96, "end": 937 }
class ____: def __init__(self): self._property: str = "" # This should generate an error because "prop" # is overwritten below. @property def prop(self): return self._property # This should generate an error because "prop" # is overwritten below. @prop.setter def pr...
MyClass
python
langchain-ai__langchain
libs/langchain_v1/langchain/agents/middleware/shell_tool.py
{ "start": 11353, "end": 26485 }
class ____(AgentMiddleware[ShellToolState, Any]): """Middleware that registers a persistent shell tool for agents. The middleware exposes a single long-lived shell session. Use the execution policy to match your deployment's security posture: * `HostExecutionPolicy` – full host access; best for truste...
ShellToolMiddleware
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/shortcuts/progress_bar/formatters.py
{ "start": 10202, "end": 11739 }
class ____(Formatter): """ For the fun. Add rainbow colors to any of the other formatters. """ colors = ["#%.2x%.2x%.2x" % _hue_to_rgb(h / 100.0) for h in range(0, 100)] def __init__(self, formatter: Formatter) -> None: self.formatter = formatter def format( self, prog...
Rainbow
python
google__jax
tests/export_back_compat_test.py
{ "start": 45741, "end": 47552 }
class ____(bctu.CompatTestBase): def test_shardy_sharding_ops_with_different_meshes(self): # Tests whether we can save and load a module with meshes that have the # same axis sizes (and same order) but different axis names. # Also tests "Sharding", "xla.sdy.GlobalToLocalShape", # "xla.sdy.LocalToGloba...
ShardyCompatTest
python
pypa__warehouse
warehouse/packaging/models.py
{ "start": 19520, "end": 20269 }
class ____(db.Model): __tablename__ = "release_dependencies" __table_args__ = ( Index("release_dependencies_release_kind_idx", "release_id", "kind"), ) __repr__ = make_repr("release", "kind", "specifier") release_id: Mapped[UUID] = mapped_column( ForeignKey("releases.id", onupdate="...
Dependency
python
getsentry__sentry
src/sentry/integrations/api/endpoints/data_forwarding_index.py
{ "start": 1211, "end": 1432 }
class ____(OrganizationPermission): scope_map = { "GET": ["org:read"], "POST": ["org:write"], } @region_silo_endpoint @extend_schema(tags=["Integrations"])
OrganizationDataForwardingDetailsPermission
python
PyCQA__pylint
tests/functional/a/access/access_attr_before_def_false_positive.py
{ "start": 2169, "end": 2536 }
class ____: """use_attr is seen as the method defining attr because it's in first position """ def __init__(self): self.reset() def use_attr(self): """use and set members""" if self.attr: print('hop') self.attr = 10 def reset(self): """reset ...
DefinedOutsideInit
python
apache__airflow
providers/yandex/tests/unit/yandex/operators/test_dataproc.py
{ "start": 2512, "end": 18703 }
class ____: def setup_method(self): dag_id = "test_dag" self.dag = DAG( dag_id, default_args={ "owner": "airflow", "start_date": datetime.datetime.today(), "end_date": datetime.datetime.today() + datetime.timedelta(days=1), ...
TestDataprocClusterCreateOperator
python
pytorch__pytorch
test/dynamo/test_modules.py
{ "start": 4486, "end": 4704 }
class ____(torch.nn.Module): def __init__(self) -> None: super().__init__() self.mod = ModuleWithStaticForward() def forward(self, x): return self.mod(x)
ModuleCallModuleWithStaticForward
python
pypa__pip
src/pip/_vendor/distlib/resources.py
{ "start": 3019, "end": 3208 }
class ____(ResourceBase): is_container = True # Backwards compatibility @cached_property def resources(self): return self.finder.get_resources(self)
ResourceContainer
python
getsentry__sentry
src/sentry/management/commands/devsyncdb.py
{ "start": 145, "end": 837 }
class ____(migrate.Command): help = "Create db skipping migrations" def handle(self, *args: Any, **options: Any) -> None: class DisableMigrations: def __contains__(self, item: str) -> bool: return True def __getitem__(self, item: str) -> None: re...
Command
python
tensorflow__tensorflow
third_party/xla/xla/backends/cpu/codegen/dot/dot_kernel_emitter_test.py
{ "start": 2002, "end": 5529 }
class ____(parameterized.TestCase): @parameterized.product( emitter_type=emitter_types, rhs_shape=[(4,), (4, 3), (4, 3, 10), (500, 10, 123)], dtype=dtypes_to_test, ) def test_vector_matrix_dot(self, emitter_type, rhs_shape, dtype): value_range = (0.0, 20.0) lhs_np = create_input(value_r...
DotKernelTest
python
nryoung__algorithms
tests/test_sorting.py
{ "start": 2271, "end": 2808 }
class ____(SortingAlgorithmTestCase): """ Tests Merge sort on a small range from 0-9 also tests merge function included in merge sort """ def test_mergesort(self): self.output = merge_sort.sort(self.input) self.assertEqual(self.correct, self.output) def test_merge(self): ...
TestMergeSort
python
keras-team__keras
keras/src/losses/losses.py
{ "start": 49536, "end": 52154 }
class ____(LossFunctionWrapper): """Computes the Dice loss value between `y_true` and `y_pred`. Formula: ```python loss = 1 - (2 * sum(y_true * y_pred)) / (sum(y_true) + sum(y_pred)) ``` Args: reduction: Type of reduction to apply to the loss. In almost all cases this shoul...
Dice
python
numba__numba
numba/cuda/tests/cudadrv/test_runtime.py
{ "start": 687, "end": 1456 }
class ____(unittest.TestCase): def test_is_supported_version_true(self): for v in SUPPORTED_VERSIONS: with patch.object(runtime, 'get_version', return_value=v): self.assertTrue(runtime.is_supported_version()) @skip_on_cudasim('The simulator always simulates a supported runti...
TestRuntime
python
tensorflow__tensorflow
tensorflow/python/ops/parallel_for/control_flow_ops_test.py
{ "start": 31504, "end": 32645 }
class ____(PForTestCase): def test_print(self): x = random_ops.random_uniform([3, 5]) def loop_fn(i): x1 = array_ops.gather(x, i) return logging_ops.Print( x1, [x1, "x1", array_ops.shape(x1)], summarize=10) self._test_loop_fn(loop_fn, 3) def test_print_v2(self): x = constan...
LoggingTest
python
numpy__numpy
numpy/_core/tests/test_deprecations.py
{ "start": 13048, "end": 13363 }
class ____(_DeprecationTestCase): message = "Passing in a parenthesized single number" @pytest.mark.parametrize("string", ["(2)i,", "(3)3S,", "f,(2)f"]) def test_parenthesized_repeat_count(self, string): self.assert_deprecated(np.dtype, args=(string,))
TestDeprecatedDTypeParenthesizedRepeatCount
python
numba__numba
numba/cuda/cudadrv/driver.py
{ "start": 79851, "end": 80556 }
class ____(metaclass=ABCMeta): """Abstract base class for modules""" def __init__(self, context, handle, info_log, finalizer=None): self.context = context self.handle = handle self.info_log = info_log if finalizer is not None: self._finalizer = weakref.finalize(self,...
Module
python
django__django
tests/fixtures/tests.py
{ "start": 50801, "end": 52061 }
class ____(TestCase): """ Custom class to limit fixture dirs. """ def test_loaddata_not_existent_fixture_file(self): stdout_output = StringIO() with self.assertRaisesMessage( CommandError, "No fixture named 'this_fixture_doesnt_exist' found." ): managemen...
NonexistentFixtureTests