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
spack__spack
lib/spack/spack/builder.py
{ "start": 13164, "end": 15972 }
class ____: """Manages a single phase of the installation. This descriptor stores at creation time the name of the method it should search for execution. The method is retrieved at __get__ time, so that it can be overridden by subclasses of whatever class declared the phases. It also provides hook...
InstallationPhase
python
getsentry__sentry
src/sentry/analytics/events/alert_rule_ui_component_webhook_sent.py
{ "start": 93, "end": 354 }
class ____(analytics.Event): # organization_id refers to the organization that installed the sentryapp organization_id: int sentry_app_id: int event: str analytics.register(AlertRuleUiComponentWebhookSentEvent)
AlertRuleUiComponentWebhookSentEvent
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/dataform.py
{ "start": 30689, "end": 33537 }
class ____(GoogleCloudBaseOperator): """ Deletes workspace. :param project_id: Required. The ID of the Google Cloud project where workspace located. :param region: Required. The ID of the Google Cloud region where workspace located. :param repository_id: Required. The ID of the Dataform repository ...
DataformDeleteWorkspaceOperator
python
apache__airflow
airflow-core/tests/unit/serialization/test_serialized_objects.py
{ "start": 24445, "end": 25542 }
class ____: """Test that serialization doesn't import kubernetes unnecessarily.""" def test_has_kubernetes_no_import_when_not_needed(self): """Ensure _has_kubernetes() doesn't import k8s when not already loaded.""" # Remove kubernetes from sys.modules if present k8s_modules = [m for m i...
TestKubernetesImportAvoidance
python
chroma-core__chroma
chromadb/db/impl/grpc/client.py
{ "start": 1954, "end": 20385 }
class ____(SysDB): """A gRPC implementation of the SysDB. In the distributed system, the SysDB is also called the 'Coordinator'. This implementation is used by Chroma frontend servers to call a remote SysDB (Coordinator) service.""" _sys_db_stub: SysDBStub _channel: grpc.Channel _coordinator_ur...
GrpcSysDB
python
PrefectHQ__prefect
src/prefect/server/schemas/responses.py
{ "start": 13478, "end": 18570 }
class ____(ORMBaseModel): name: str = Field(default=..., description="The name of the deployment.") version: Optional[str] = Field( default=None, description="An optional version for the deployment." ) description: Optional[str] = Field( default=None, description="A description for the d...
DeploymentResponse
python
ZoranPandovski__al-go-rithms
greedy/prim's_algorithm/python/ArthurFortes/vertexFunctions.py
{ "start": 228, "end": 1700 }
class ____: def __init__(self, no, dx, dy, neighbor, color): self.no = no self.dx = dx self.dy = dy self.neighbor = neighbor self.color = color k = [] def cutPrim(result, argument): row = 0 while (argument-1) > 0: big = 0 for i in range(len(result...
Vertex
python
pytest-dev__pytest
testing/python/integration.py
{ "start": 7096, "end": 8391 }
class ____: def test_rerun(self, pytester: Pytester) -> None: pytester.makeconftest( """ from _pytest.runner import runtestprotocol def pytest_runtest_protocol(item, nextitem): runtestprotocol(item, log=False, nextitem=nextitem) runtestprot...
TestReRunTests
python
google__jax
tests/multiprocess/pjit_test.py
{ "start": 2424, "end": 3409 }
class ____(jt_multiprocess.MultiProcessTest): @jtu.ignore_warning(category=DeprecationWarning) def testLocalInputsWithJaxArray(self): # Note that this is too small to shard over the global mesh, but fine for # the local mesh and so should be accepted. mesh = jtu.create_mesh((4, 2), ("x", "y")) elem...
PJitTestMultiHost
python
encode__django-rest-framework
tests/test_metadata.py
{ "start": 11149, "end": 12114 }
class ____(TestCase): def test_null_boolean_field_info_type(self): options = metadata.SimpleMetadata() field_info = options.get_field_info(serializers.BooleanField( allow_null=True)) assert field_info['type'] == 'boolean' def test_related_field_choices(self): options...
TestSimpleMetadataFieldInfo
python
getsentry__sentry
src/sentry/api/endpoints/organization_events_facets.py
{ "start": 703, "end": 803 }
class ____(TypedDict): key: str topValues: list[_TopValue] @region_silo_endpoint
_KeyTopValues
python
django__django
tests/db_functions/math/test_ceil.py
{ "start": 269, "end": 2306 }
class ____(TestCase): def test_null(self): IntegerModel.objects.create() obj = IntegerModel.objects.annotate(null_ceil=Ceil("normal")).first() self.assertIsNone(obj.null_ceil) def test_decimal(self): DecimalModel.objects.create(n1=Decimal("12.9"), n2=Decimal("0.6")) obj ...
CeilTests
python
ipython__ipython
IPython/core/interactiveshell.py
{ "start": 5593, "end": 5964 }
class ____(Unicode): r"""A Unicode subclass to validate separate_in, separate_out, etc. This is a Unicode based trait that converts '0'->'' and ``'\\n'->'\n'``. """ def validate(self, obj, value): if value == '0': value = '' value = value.replace('\\n','\n') return super(Separa...
SeparateUnicode
python
PyCQA__pylint
tests/functional/n/non/non_init_parent_called.py
{ "start": 1248, "end": 1448 }
class ____(dict): """ Using the same idiom as Super, but without calling the __init__ method. """ def __init__(self): base = super() base.__woohoo__() # [no-member]
Super2
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/check_ops_test.py
{ "start": 84666, "end": 86013 }
class ____(test.TestCase): @test_util.run_in_graph_and_eager_modes def test_constant_tensor_is_not_strictly_increasing(self): self.assertFalse(self.evaluate(check_ops.is_strictly_increasing([1, 1, 1]))) @test_util.run_in_graph_and_eager_modes def test_decreasing_tensor_is_not_strictly_increasing(self): ...
IsStrictlyIncreasingTest
python
keras-team__keras
keras/src/metrics/accuracy_metrics_test.py
{ "start": 17248, "end": 21544 }
class ____(testing.TestCase): def test_config(self): sp_top_k_cat_acc_obj = accuracy_metrics.SparseTopKCategoricalAccuracy( k=1, name="sparse_top_k_categorical_accuracy", dtype="float32" ) self.assertEqual( sp_top_k_cat_acc_obj.name, "sparse_top_k_categorical_accuracy...
SparseTopKCategoricalAccuracyTest
python
ansible__ansible
test/lib/ansible_test/_internal/become.py
{ "start": 683, "end": 1266 }
class ____(Become): """Become using 'doas'.""" @property def method(self) -> str: """The name of the Ansible become plugin that is equivalent to this.""" raise NotImplementedError('Ansible has no built-in doas become plugin.') def prepare_command(self, command: list[str]) -> list[str]:...
Doas
python
kamyu104__LeetCode-Solutions
Python/string-matching-in-an-array.py
{ "start": 2397, "end": 2937 }
class ____(object): def stringMatching(self, words): """ :type words: List[str] :rtype: List[str] """ trie = AhoTrie(words) lookup = set() for i in xrange(len(words)): trie.reset() for c in words[i]: for j in trie.step(c...
Solution
python
run-llama__llama_index
llama-index-core/llama_index/core/tools/types.py
{ "start": 594, "end": 2932 }
class ____: description: str name: Optional[str] = None fn_schema: Optional[Type[BaseModel]] = DefaultToolFnSchema return_direct: bool = False def get_parameters_dict(self) -> dict: if self.fn_schema is None: parameters = { "type": "object", "prop...
ToolMetadata
python
pyca__cryptography
tests/x509/test_x509_ext.py
{ "start": 222932, "end": 225194 }
class ____: def test_invalid_types(self): with pytest.raises(TypeError): x509.OCSPAcceptableResponses(38) # type:ignore[arg-type] with pytest.raises(TypeError): x509.OCSPAcceptableResponses([38]) # type:ignore[list-item] def test_eq(self): acceptable_responses1...
TestOCSPAcceptableResponses
python
allegroai__clearml
clearml/backend_api/services/v2_23/dataviews.py
{ "start": 116770, "end": 117659 }
class ____(Request): """ Get dataview information :param dataview: Datatview ID :type dataview: str """ _service = "dataviews" _action = "get_by_id" _version = "2.23" _schema = { "definitions": {}, "properties": {"dataview": {"description": "Datatview ID", "type": "...
GetByIdRequest
python
pypa__warehouse
tests/unit/test_views.py
{ "start": 1779, "end": 7568 }
class ____: def test_returns_context_when_no_template(self, pyramid_config): pyramid_config.testing_add_renderer("non-existent.html") response = context = pretend.stub(status_code=499) request = pretend.stub(context=None) assert httpexception_view(context, request) is response ...
TestHTTPExceptionView
python
dagster-io__dagster
python_modules/libraries/dagster-databricks/dagster_databricks/components/databricks_asset_bundle/configs.py
{ "start": 15687, "end": 21028 }
class ____(IHaveNew): databricks_config_path: Path tasks: list[DatabricksBaseTask] job_level_parameters: Mapping[str, Any] def __new__( cls, databricks_config_path: Union[Path, str], ) -> "DatabricksConfig": databricks_config_path = Path(databricks_config_path) if no...
DatabricksConfig
python
plotly__plotly.py
plotly/graph_objs/scattermap/marker/colorbar/_tickfont.py
{ "start": 233, "end": 9969 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scattermap.marker.colorbar" _path_str = "scattermap.marker.colorbar.tickfont" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "variant", ...
Tickfont
python
getsentry__sentry-python
tests/integrations/fastmcp/test_fastmcp.py
{ "start": 8249, "end": 38315 }
class ____: """Mock HTTP request for SSE/StreamableHTTP transport""" def __init__(self, session_id=None, transport="http"): self.headers = {} self.query_params = {} if transport == "sse": # SSE transport uses query parameter if session_id: self.q...
MockHTTPRequest
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0117_remove_old_fields.py
{ "start": 121, "end": 1939 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0116_mark_fields_as_null"), ] operations = [ migrations.RemoveField( model_name="historicalproject", name="conf_py_file", ), migrations.RemoveField( ...
Migration
python
astropy__astropy
astropy/table/meta.py
{ "start": 193, "end": 857 }
class ____(list): """ List of tuples that sorts in a specific order that makes sense for astropy table column attributes. """ def sort(self, *args, **kwargs): super().sort() column_keys = ["name", "unit", "datatype", "format", "description", "meta"] in_dict = dict(self) ...
ColumnOrderList
python
ethereum__web3.py
web3/middleware/filter.py
{ "start": 16189, "end": 17809 }
class ____: def __init__(self, w3: "AsyncWeb3[Any]") -> None: self.w3 = w3 def __await__(self) -> Generator[Any, None, "AsyncRequestBlocks"]: async def closure() -> "AsyncRequestBlocks": self.block_number = await self.w3.eth.block_number self.start_block = BlockNumber(se...
AsyncRequestBlocks
python
getsentry__sentry
src/sentry/middleware/integrations/parsers/discord.py
{ "start": 1397, "end": 6200 }
class ____(BaseRequestParser): provider = EXTERNAL_PROVIDERS[ExternalProviders.DISCORD] webhook_identifier = WebhookProviderIdentifier.DISCORD control_classes = [ DiscordLinkIdentityView, DiscordUnlinkIdentityView, DiscordExtensionConfigurationView, ] # Dynamically set to a...
DiscordRequestParser
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1045368, "end": 1045848 }
class ____(sgqlc.types.Type): """Autogenerated return type of UpdateSubscription""" __schema__ = github_schema __field_names__ = ("client_mutation_id", "subscribable") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the client performing th...
UpdateSubscriptionPayload
python
sqlalchemy__sqlalchemy
test/sql/test_text.py
{ "start": 2131, "end": 11166 }
class ____(fixtures.TestBase, AssertsCompiledSQL): """test the usage of text() implicit within the select() construct when strings are passed.""" __dialect__ = "default" def test_select_composition_one(self): self.assert_compile( select( literal_column("foobar(a)"),...
SelectCompositionTest
python
pydata__xarray
xarray/tests/test_plot.py
{ "start": 4943, "end": 26665 }
class ____(PlotTestCase): @pytest.fixture(autouse=True) def setup_array(self) -> None: self.darray = DataArray(easy_array((2, 3, 4))) def test_accessor(self) -> None: from xarray.plot.accessor import DataArrayPlotAccessor assert DataArray.plot is DataArrayPlotAccessor asser...
TestPlot
python
scipy__scipy
scipy/signal/tests/test_filter_design.py
{ "start": 7599, "end": 10369 }
class ____: def test_identity(self, xp): """Test the identity transfer function.""" z = xp.asarray([]) p = xp.asarray([]) k = 1. b, a = zpk2tf(z, p, k) b_r = xp.asarray([1.]) # desired result a_r = xp.asarray([1.]) # desired result # The test for th...
TestZpk2Tf
python
numpy__numpy
numpy/f2py/tests/test_return_real.py
{ "start": 131, "end": 1787 }
class ____(util.F2PyTest): def check_function(self, t, tname): if tname in ["t0", "t4", "s0", "s4"]: err = 1e-5 else: err = 0.0 assert abs(t(234) - 234.0) <= err assert abs(t(234.6) - 234.6) <= err assert abs(t("234") - 234) <= err assert abs(t...
TestReturnReal
python
getsentry__sentry
tests/snuba/tasks/test_unmerge.py
{ "start": 1512, "end": 21360 }
class ____(TestCase, SnubaTestCase): def test_get_fingerprint(self) -> None: assert ( get_fingerprint( self.store_event(data={"message": "Hello world"}, project_id=self.project.id) ) == hashlib.md5(b"Hello world").hexdigest() ) assert ( ...
UnmergeTestCase
python
great-expectations__great_expectations
great_expectations/exceptions/exceptions.py
{ "start": 13327, "end": 13381 }
class ____(MetricError): pass
UnavailableMetricError
python
has2k1__plotnine
plotnine/themes/themeable.py
{ "start": 55179, "end": 55469 }
class ____(themeable): """ Figure size in inches Parameters ---------- theme_element : tuple (width, height) in inches """ def apply_figure(self, figure: Figure, targets: ThemeTargets): figure.set_size_inches(self.properties["value"])
figure_size
python
django__django
tests/model_fields/test_autofield.py
{ "start": 473, "end": 602 }
class ____(SmallIntegerFieldTests): model = SmallAutoModel rel_db_type_class = models.SmallIntegerField
SmallAutoFieldTests
python
has2k1__plotnine
plotnine/composition/_plotspec.py
{ "start": 314, "end": 1015 }
class ____: """ Plot Specification """ plot: ggplot """ Plot """ figure: Figure """ Figure in which the draw the plot """ composition_gridspec: p9GridSpec """ The gridspec of the innermost composition group that contains the plot """ subplotspec: Subpl...
plotspec
python
networkx__networkx
benchmarks/benchmarks/benchmark_shortest_path.py
{ "start": 89, "end": 1686 }
class ____: timeout = 120 seed = 0xDEADC0DE params = ["unweighted", "uniform", "increasing", "random"] param_names = ["edge_weights"] def setup(self, edge_weights): connected_sevens = [ G for G in nx.graph_atlas_g() if (len(G) == 7) and nx.is_connected(G) ] matc...
UndirectedGraphAtlasSevenNodesConnected
python
pytorch__pytorch
test/cpp_extensions/open_registration_extension/torch_openreg/tests/test_ops.py
{ "start": 3133, "end": 4069 }
class ____(TestCase): def test_backend_dispatchstub(self): x_cpu = torch.randn(2, 2, 3, dtype=torch.float32, device="cpu") x_openreg = x_cpu.to("openreg") y_cpu = torch.abs(x_cpu) y_openreg = torch.abs(x_openreg) self.assertEqual(y_cpu, y_openreg.cpu()) o_cpu = torc...
TestSTUB
python
walkccc__LeetCode
solutions/3417. Zigzag Grid Traversal With Skip/3417.py
{ "start": 0, "end": 209 }
class ____: def zigzagTraversal(self, grid: list[list[int]]) -> list[int]: zigzag = [row[::-1] if i % 2 else row for i, row in enumerate(grid)] return [num for row in zigzag for num in row][::2]
Solution
python
jupyterlab__jupyterlab
jupyterlab/handlers/announcements.py
{ "start": 2335, "end": 3818 }
class ____(CheckForUpdateABC): """Default class to check for update. Args: version: Current JupyterLab version Attributes: version - str: Current JupyterLab version logger - logging.Logger: Server logger """ async def __call__(self) -> Awaitable[tuple[str, tuple[str, str]]...
CheckForUpdate
python
astropy__astropy
astropy/io/votable/exceptions.py
{ "start": 49269, "end": 49618 }
class ____(VOWarning, ValueError): """ Non-ASCII unicode values should not be written when the FIELD ``datatype="char"``, and cannot be written in BINARY or BINARY2 serialization. """ message_template = ( 'Attempt to write non-ASCII value ({}) to FIELD ({}) which has datatype="char"' ) ...
E24
python
dask__dask
dask/delayed.py
{ "start": 27692, "end": 28609 }
class ____(Delayed): __slots__ = ("_obj", "_pure", "_nout") def __init__(self, obj, key, pure=None, nout=None): super().__init__(key, None, length=nout) self._obj = obj self._pure = pure self._nout = nout @property def dask(self): if isinstance(self._obj, (TaskR...
DelayedLeaf
python
django__django
tests/auth_tests/models/custom_user.py
{ "start": 392, "end": 1590 }
class ____(BaseUserManager): def create_user(self, email, date_of_birth, password=None, **fields): """ Creates and saves a User with the given email and password. """ if not email: raise ValueError("Users must have an email address") user = self.model( ...
CustomUserManager
python
google__pytype
pytype/overlays/typed_dict.py
{ "start": 557, "end": 1673 }
class ____: """Collection of typed dict properties passed between various stages.""" name: str fields: dict[str, abstract.BaseValue] required: set[str] total: bool @property def keys(self): return set(self.fields.keys()) @property def optional(self): return self.keys - self.required def ...
TypedDictProperties
python
fastai__fastai
fastai/vision/gan.py
{ "start": 14107, "end": 16514 }
class ____(TensorBase): "TensorBase but show method does nothing" def show(self, ctx=None, **kwargs): return ctx # %% ../../nbs/24_vision.gan.ipynb 35 def generate_noise( fn, # Dummy argument so it works with `DataBlock` size=100 # Size of returned noise vector ) -> InvisibleTensor: "Generate noise...
InvisibleTensor
python
numpy__numpy
benchmarks/benchmarks/bench_function_base.py
{ "start": 3571, "end": 5311 }
class ____: # The size of the unsorted area in the "random unsorted area" # benchmarks AREA_SIZE = 100 # The size of the "partially ordered" sub-arrays BUBBLE_SIZE = 100 @staticmethod @memoize def random(size, dtype, rnd): """ Returns a randomly-shuffled array. "...
SortGenerator
python
pypa__setuptools
setuptools/_vendor/inflect/__init__.py
{ "start": 40941, "end": 103796 }
class ____: def __init__(self) -> None: self.classical_dict = def_classical.copy() self.persistent_count: Optional[int] = None self.mill_count = 0 self.pl_sb_user_defined: List[Optional[Word]] = [] self.pl_v_user_defined: List[Optional[Word]] = [] self.pl_adj_user_def...
engine
python
PyCQA__pylint
tests/functional/u/undefined/undefined_variable.py
{ "start": 5245, "end": 5399 }
class ____: myattr = 1 # Nested default argument in lambda # Should not raise error mylambda3 = lambda: lambda a=LambdaClass3: a
LambdaClass3
python
encode__starlette
starlette/schemas.py
{ "start": 390, "end": 785 }
class ____(Response): media_type = "application/vnd.oai.openapi" def render(self, content: Any) -> bytes: assert yaml is not None, "`pyyaml` must be installed to use OpenAPIResponse." assert isinstance(content, dict), "The schema passed to OpenAPIResponse should be a dictionary." return...
OpenAPIResponse
python
doocs__leetcode
solution/2800-2899/2807.Insert Greatest Common Divisors in Linked List/Solution.py
{ "start": 151, "end": 462 }
class ____: def insertGreatestCommonDivisors( self, head: Optional[ListNode] ) -> Optional[ListNode]: pre, cur = head, head.next while cur: x = gcd(pre.val, cur.val) pre.next = ListNode(x, cur) pre, cur = cur, cur.next return head
Solution
python
kubernetes-client__python
kubernetes/client/models/v1_user_info.py
{ "start": 383, "end": 5970 }
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...
V1UserInfo
python
ray-project__ray
python/ray/data/tests/test_clickhouse.py
{ "start": 15689, "end": 33495 }
class ____: @pytest.fixture def datasink(self, mock_clickhouse_sink_client): sink = ClickHouseDatasink( table="default.test_table", dsn="clickhouse+http://user:pass@localhost:8123/default", mode=SinkMode.APPEND, table_settings=ClickHouseTableSettings(engin...
TestClickHouseDatasink
python
PyCQA__pycodestyle
testing/data/E30.py
{ "start": 86, "end": 627 }
class ____: def a(): pass # comment def b(): pass #: #: E302:2:1 """Main module.""" def _main(): pass #: E302:2:1 import sys def get_sys_path(): return sys.path #: E302:4:1 def a(): pass def b(): pass #: E302:6:1 def a(): pass # comment def b(): pass #: #: E302:...
X
python
airbytehq__airbyte
airbyte-integrations/connectors/source-facebook-marketing/unit_tests/integration/test_include_deleted.py
{ "start": 1197, "end": 7228 }
class ____(TestCase): account_id = ACCOUNT_ID filter_statuses_flag = "filter_statuses" statuses = ["ACTIVE", "ARCHIVED"] @staticmethod def _read(config_: ConfigBuilder, stream_name: str, expecting_exception: bool = False) -> EntrypointOutput: return read_output( config_builder=c...
TestIncludeDeleted
python
pytorch__pytorch
torch/testing/_internal/common_device_type.py
{ "start": 23061, "end": 23566 }
class ____(DeviceTypeTestBase): device_type = "lazy" def _should_stop_test_suite(self): return False @classmethod def setUpClass(cls): import torch._lazy import torch._lazy.metrics import torch._lazy.ts_backend global lazy_ts_backend_init if not lazy_ts...
LazyTestBase
python
kamyu104__LeetCode-Solutions
Python/minimum-moves-to-reach-target-score.py
{ "start": 41, "end": 388 }
class ____(object): def minMoves(self, target, maxDoubles): """ :type target: int :type maxDoubles: int :rtype: int """ result = 0 while target > 1 and maxDoubles: result += 1+target%2 target //= 2 maxDoubles -= 1 re...
Solution
python
ansible__ansible
lib/ansible/plugins/strategy/__init__.py
{ "start": 8355, "end": 52068 }
class ____: """ This is the base class for strategy plugins, which contains some common code useful to all strategies like running handlers, cleanup actions, etc. """ # by default, strategies should support throttling but we allow individual # strategies to disable this and either forego suppo...
StrategyBase
python
falconry__falcon
falcon/routing/util.py
{ "start": 808, "end": 3716 }
class ____(Exception): def __init__(self, message: str) -> None: super().__init__(message) self.message = message def map_http_methods(resource: object, suffix: str | None = None) -> MethodDict: """Map HTTP methods (e.g., GET, POST) to methods of a resource object. Args: resource:...
SuffixedMethodNotFoundError
python
ray-project__ray
rllib/env/multi_agent_episode.py
{ "start": 900, "end": 135039 }
class ____: """Stores multi-agent episode data. The central attribute of the class is the timestep mapping `self.env_t_to_agent_t` that maps AgentIDs to their specific environment steps to the agent's own scale/timesteps. Each AgentID in the `MultiAgentEpisode` has its own `SingleAgentEpisode` obj...
MultiAgentEpisode
python
django__django
tests/admin_utils/models.py
{ "start": 1930, "end": 2167 }
class ____(Vehicle): vehicle = models.OneToOneField( Vehicle, models.CASCADE, parent_link=True, related_name="vehicle_%(app_label)s_%(class)s", ) class Meta: abstract = True
VehicleMixin
python
geekcomputers__Python
8_puzzle.py
{ "start": 80, "end": 3521 }
class ____: """Represents a state in 8-puzzle solving with A* algorithm.""" def __init__( self, board: List[List[int]], goal: List[List[int]], moves: int = 0, previous: Optional["PuzzleState"] = None, ) -> None: self.board = board # Current 3x3 board configu...
PuzzleState
python
anthropics__anthropic-sdk-python
src/anthropic/types/tool_text_editor_20250429_param.py
{ "start": 326, "end": 734 }
class ____(TypedDict, total=False): name: Required[Literal["str_replace_based_edit_tool"]] """Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks. """ type: Required[Literal["text_editor_20250429"]] cache_control: Optional[CacheControlEphemeralParam] ...
ToolTextEditor20250429Param
python
PyCQA__pylint
pylint/extensions/consider_refactoring_into_while_condition.py
{ "start": 561, "end": 3321 }
class ____(checkers.BaseChecker): """Checks for instances where while loops are implemented with a constant condition which. always evaluates to truthy and the first statement(s) is/are if statements which, when evaluated. to True, breaks out of the loop. The if statement(s) can be refactored...
ConsiderRefactorIntoWhileConditionChecker
python
encode__django-rest-framework
tests/test_model_serializer.py
{ "start": 3890, "end": 4094 }
class ____(models.Model): CHOICES = ( ('choice1', 'choice 1'), ('choice2', 'choice 1'), ) name = models.CharField(max_length=254, unique=True, choices=CHOICES)
UniqueChoiceModel
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/partitions/mapping/time_window.py
{ "start": 1231, "end": 26000 }
class ____( PartitionMapping, NamedTuple( "_TimeWindowPartitionMapping", [ ("start_offset", PublicAttr[int]), ("end_offset", PublicAttr[int]), ("allow_nonexistent_upstream_partitions", PublicAttr[bool]), ], ), ): """The default mapping between ...
TimeWindowPartitionMapping
python
pennersr__django-allauth
allauth/mfa/admin.py
{ "start": 112, "end": 309 }
class ____(admin.ModelAdmin): raw_id_fields = ("user",) list_display = ("user", "type", "created_at", "last_used_at") list_filter = ("type", "created_at", "last_used_at")
AuthenticatorAdmin
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 865637, "end": 865820 }
class ____(sgqlc.types.Type, ProjectNextFieldCommon, Node): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ()
ProjectNextField
python
run-llama__llama_index
llama-index-integrations/indices/llama-index-indices-managed-bge-m3/llama_index/indices/managed/bge_m3/retriever.py
{ "start": 473, "end": 2380 }
class ____(BaseRetriever): """ Vector index retriever. Args: index (BGEM3Index): BGEM3 index. similarity_top_k (int): number of top k results to return. filters (Optional[MetadataFilters]): metadata filters, defaults to None doc_ids (Optional[List[str]]): list of documents t...
BGEM3Retriever
python
joke2k__faker
tests/providers/test_color.py
{ "start": 14633, "end": 14944 }
class ____: """Test de_DE color provider methods""" def test_color_name(self, faker, num_samples): for _ in range(num_samples): color_name = faker.color_name() assert isinstance(color_name, str) assert color_name in DeDeColorProvider.all_colors.keys()
TestDeDe
python
kamyu104__LeetCode-Solutions
Python/split-linked-list-in-parts.py
{ "start": 33, "end": 683 }
class ____(object): def splitListToParts(self, root, k): """ :type root: ListNode :type k: int :rtype: List[ListNode] """ n = 0 curr = root while curr: curr = curr.next n += 1 width, remainder = divmod(n, k) res...
Solution
python
huggingface__transformers
src/transformers/models/big_bird/modeling_big_bird.py
{ "start": 66422, "end": 67126 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.transform = BigBirdPredictionHeadTransform(config) # The output weights are the same as the input embeddings, but there is # an output-only bias for each token. self.decoder = nn.Linear(config.hidden_...
BigBirdLMPredictionHead
python
pypa__pipenv
pipenv/patched/pip/_internal/resolution/resolvelib/resolver.py
{ "start": 1614, "end": 13026 }
class ____(BaseResolver): _allowed_strategies = {"eager", "only-if-needed", "to-satisfy-only"} def __init__( self, preparer: RequirementPreparer, finder: PackageFinder, wheel_cache: Optional[WheelCache], make_install_req: InstallRequirementProvider, use_user_site...
Resolver
python
django__django
django/db/migrations/operations/special.py
{ "start": 2634, "end": 5266 }
class ____(Operation): """ Run some raw SQL. A reverse SQL statement may be provided. Also accept a list of operations that represent the state change effected by this SQL change, in case it's custom column/table creation/deletion. """ category = OperationCategory.SQL noop = "" def __...
RunSQL
python
pytorch__pytorch
torch/_dynamo/polyfills/builtins.py
{ "start": 2087, "end": 3658 }
class ____: pass # TODO(guilhermeleobas): use substitute_in_graph for iter() def iter_(fn_or_iterable, sentinel=_SENTINEL_MISSING, /): # type: ignore[no-untyped-def] # Without a second argument, object must be a collection object which supports # the iterable (__iter__) or the sequence protocol (__getite...
_SENTINEL_MISSING
python
apache__airflow
task-sdk/tests/task_sdk/execution_time/test_supervisor.py
{ "start": 50833, "end": 87518 }
class ____: """Test case data for request handling tests in `TestHandleRequest` class.""" message: Any """The request message to send to the supervisor (e.g., GetConnection, SetXCom).""" test_id: str """Unique identifier for this test case, used in pytest parameterization.""" client_mock: Cli...
RequestTestCase
python
pydantic__pydantic
pydantic/types.py
{ "start": 93103, "end": 100894 }
class ____: """!!! abstract "Usage Documentation" [Discriminated Unions with `Callable` `Discriminator`](../concepts/unions.md#discriminated-unions-with-callable-discriminator) Provides a way to use a custom callable as the way to extract the value of a union discriminator. This allows you to get ...
Discriminator
python
pypa__pip
src/pip/_vendor/urllib3/exceptions.py
{ "start": 4553, "end": 4660 }
class ____(HTTPWarning): """Warned when performing security reducing actions""" pass
SecurityWarning
python
kubernetes-client__python
kubernetes/client/models/v1alpha1_mutating_admission_policy_binding_spec.py
{ "start": 383, "end": 5923 }
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...
V1alpha1MutatingAdmissionPolicyBindingSpec
python
xlwings__xlwings
xlwings/_xlwindows.py
{ "start": 54602, "end": 54963 }
class ____(base_classes.PageSetup): def __init__(self, xl): self.xl = xl @property def api(self): return self.xl @property def print_area(self): value = self.xl.PrintArea return None if value == "" else value @print_area.setter def print_area(self, value): ...
PageSetup
python
pypa__warehouse
warehouse/integrations/secrets/utils.py
{ "start": 4728, "end": 4938 }
class ____(InvalidTokenLeakRequestError): pass PUBLIC_KEYS_CACHE_TIME = 60 * 30 # 30 minutes PUBLIC_KEYS_CACHE = integrations.PublicKeysCache(cache_time=PUBLIC_KEYS_CACHE_TIME)
GenericPublicKeyMetaAPIError
python
ipython__ipython
tests/test_pycolorize.py
{ "start": 1272, "end": 1809 }
class ____(Super): def __init__(self): super(Bar, self).__init__(1**2, 3^4, 5 or 6) """ def test_parse_sample(theme_name): """and test writing to a buffer""" buf = io.StringIO() p = Parser(theme_name=theme_name) p.format(sample, buf) buf.seek(0) f1 = buf.read() assert "ERROR"...
Bar
python
HypothesisWorks__hypothesis
hypothesis-python/tests/quality/test_poisoned_trees.py
{ "start": 742, "end": 4421 }
class ____(SearchStrategy): """Generates variable sized tuples with an implicit tree structure. The actual result is flattened out, but the hierarchy is implicit in the data. """ def __init__(self, p): super().__init__() self.__p = p def do_draw(self, data): if data.dr...
PoisonedTree
python
zostera__django-bootstrap4
src/bootstrap4/exceptions.py
{ "start": 0, "end": 82 }
class ____(Exception): """Any exception from this package."""
BootstrapException
python
python-openxml__python-docx
src/docx/opc/phys_pkg.py
{ "start": 252, "end": 900 }
class ____: """Factory for physical package reader objects.""" def __new__(cls, pkg_file): # if `pkg_file` is a string, treat it as a path if isinstance(pkg_file, str): if os.path.isdir(pkg_file): reader_cls = _DirPkgReader elif is_zipfile(pkg_file): ...
PhysPkgReader
python
fastai__fastai
fastai/interpret.py
{ "start": 7727, "end": 7840 }
class ____(Interpretation): "Interpretation methods for segmentation models." pass
SegmentationInterpretation
python
sqlalchemy__sqlalchemy
test/sql/test_statement_params.py
{ "start": 749, "end": 2519 }
class ____(fixtures.TestBase): def _all_subclasses(self, cls_): return dict.fromkeys( s for s in class_hierarchy(cls_) # class_hierarchy may return values that # aren't subclasses of cls if issubclass(s, cls_) ) @staticmethod def _...
BasicTests
python
modin-project__modin
modin/pandas/window.py
{ "start": 1374, "end": 3267 }
class ____(ClassLogger): _dataframe: Union[DataFrame, Series] _query_compiler: BaseQueryCompiler def __init__( self, dataframe: Union[DataFrame, Series], window=None, min_periods=None, center=False, win_type=None, on=None, axis=0, clos...
Window
python
huggingface__transformers
tests/quantization/torchao_integration/test_torchao.py
{ "start": 35509, "end": 35955 }
class ____(TorchAoSerializationTest): device = f"{torch_device}:0" # called only once for all test in this class @classmethod def setUpClass(cls): super().setUpClass() cls.quant_scheme = Int8DynamicActivationInt8WeightConfig() cls.quant_scheme_kwargs = {} cls.EXPECTED_OU...
TorchAoSerializationW8A8AcceleratorTest
python
PrefectHQ__prefect
tests/client/test_events_client.py
{ "start": 298, "end": 3517 }
class ____: async def test_read_events_with_filter( self, prefect_client: "PrefectTestHarness" ) -> None: """test querying events with a filter""" async with get_client() as client: # create a filter for recent events now = prefect.types._datetime.now("UTC") ...
TestReadEventsAsync
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-vespa/llama_index/vector_stores/vespa/base.py
{ "start": 1289, "end": 20430 }
class ____(BasePydanticVectorStore): """ Vespa vector store. Can be initialized in several ways: 1. (Default) Initialize Vespa vector store with default hybrid template and local (docker) deployment. 2. Initialize by providing an application package created in pyvespa (can be deployed locally or to...
VespaVectorStore
python
apache__airflow
providers/jdbc/tests/unit/jdbc/hooks/test_jdbc.py
{ "start": 2308, "end": 16744 }
class ____: @pytest.fixture(autouse=True) def setup_connections(self, create_connection_without_db): create_connection_without_db( Connection( conn_id="jdbc_default", conn_type="jdbc", host="jdbc://localhost/", port=443, ...
TestJdbcHook
python
joke2k__faker
tests/providers/test_phone_number.py
{ "start": 19331, "end": 19986 }
class ____: """Test th_TH phone number provider methods""" def test_phone_number(self, faker, num_samples): pattern: Pattern = re.compile( # leading zero or internaional code r"((\+66)|\+66[ -]?\(0\)|0)[ -]?" # landline or mobile r"([23457][ -]?(\d[ -]?){...
TestThTh
python
getsentry__sentry
tests/sentry_plugins/github/endpoints/test_installation_install_event.py
{ "start": 278, "end": 936 }
class ____(APITestCase): def test_simple(self) -> None: url = "/plugins/github/installations/webhook/" response = self.client.post( path=url, data=INSTALLATION_EVENT_EXAMPLE, content_type="application/json", HTTP_X_GITHUB_EVENT="installation", ...
InstallationInstallEventWebhookTest
python
PrefectHQ__prefect
tests/test_flows.py
{ "start": 121736, "end": 126113 }
class ____: def test_noniterable_hook_raises(self): def running_hook(): pass with pytest.raises( TypeError, match=re.escape( "Expected iterable for 'on_running'; got function instead. Please" " provide a list of hooks to 'on_runnin...
TestFlowHooksOnRunning
python
lxml__lxml
src/lxml/html/_html5builder.py
{ "start": 516, "end": 720 }
class ____: def __init__(self): self._elementTree = None self.childNodes = [] def appendChild(self, element): self._elementTree.getroot().addnext(element._element)
Document
python
mlflow__mlflow
mlflow/utils/search_utils.py
{ "start": 65983, "end": 83484 }
class ____(SearchUtils): """ Utility class for searching traces. """ VALID_SEARCH_ATTRIBUTE_KEYS = { "request_id", "timestamp", "timestamp_ms", "execution_time", "execution_time_ms", "end_time", "end_time_ms", "status", "client_req...
SearchTraceUtils
python
airbytehq__airbyte
airbyte-integrations/connectors/destination-astra/unit_tests/destination_test.py
{ "start": 316, "end": 3781 }
class ____(unittest.TestCase): def setUp(self): self.config = { "processing": {"text_fields": ["str_col"], "metadata_fields": [], "chunk_size": 1000}, "embedding": {"mode": "openai", "openai_key": "mykey"}, "indexing": { "astra_db_app_token": "mytoken", ...
TestDestinationAstra