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
aio-libs__aiohttp
aiohttp/web_exceptions.py
{ "start": 5120, "end": 5203 }
class ____(HTTPSuccessful): status_code = 204 empty_body = True
HTTPNoContent
python
google__python-fire
fire/decorators_test.py
{ "start": 695, "end": 1113 }
class ____: """A class for testing decorated functions without default values.""" @decorators.SetParseFns(count=int) def double(self, count): return 2 * count @decorators.SetParseFns(count=float) def triple(self, count): return 3 * count @decorators.SetParseFns(int) def quadruple(self, count): ...
NoDefaults
python
django__django
tests/model_inheritance/models.py
{ "start": 4319, "end": 4355 }
class ____(Child): pass
GrandChild
python
ray-project__ray
python/ray/llm/tests/serve/cpu/deployments/utils/test_batcher.py
{ "start": 1912, "end": 7967 }
class ____: @pytest.mark.asyncio async def test_batch(self): count = 0 batcher = TestBatcher(fake_generator()) async for x in batcher.stream(): count += 1 assert x["num_generated_tokens"] == 100 assert x["generated_text"] == TEXT_VALUE * 100 #...
TestBatching
python
doocs__leetcode
solution/2100-2199/2187.Minimum Time to Complete Trips/Solution.py
{ "start": 0, "end": 233 }
class ____: def minimumTime(self, time: List[int], totalTrips: int) -> int: mx = min(time) * totalTrips return bisect_left( range(mx), totalTrips, key=lambda x: sum(x // v for v in time) )
Solution
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/model_query.py
{ "start": 3753, "end": 3853 }
class ____: def method1(): return 0 def method2(): return 0
ClassTest2_Alarm1
python
chroma-core__chroma
chromadb/api/types.py
{ "start": 59225, "end": 59355 }
class ____: enabled: bool config: BoolInvertedIndexConfig # Individual Value Type Classes @dataclass
BoolInvertedIndexType
python
doocs__leetcode
solution/1000-1099/1024.Video Stitching/Solution.py
{ "start": 0, "end": 444 }
class ____: def videoStitching(self, clips: List[List[int]], time: int) -> int: last = [0] * time for a, b in clips: if a < time: last[a] = max(last[a], b) ans = mx = pre = 0 for i, v in enumerate(last): mx = max(mx, v) if mx <= i: ...
Solution
python
encode__django-rest-framework
tests/test_urlpatterns.py
{ "start": 479, "end": 8051 }
class ____(TestCase): """ Tests `format_suffix_patterns` against different URLPatterns to ensure the URLs still resolve properly, including any captured parameters. """ def _resolve_urlpatterns(self, urlpatterns, test_paths, allowed=None): factory = APIRequestFactory() try: ...
FormatSuffixTests
python
astropy__astropy
astropy/table/tests/test_init_table.py
{ "start": 5625, "end": 6783 }
class ____(BaseInitFromListLike): def setup_method(self, table_type): self._setup(table_type) self.data = [ (np.int32(1), np.int32(3)), Column(name="col1", data=[2, 4], dtype=np.int32), np.array([3, 5], dtype=np.int32), ] def test_default_names(self, ...
TestInitFromListOfLists
python
ray-project__ray
python/ray/tests/test_resource_demand_scheduler.py
{ "start": 53232, "end": 59423 }
class ____(unittest.TestCase): def testResourceDemandVector(self): lm = LoadMetrics() lm.update( "1.1.1.1", mock_node_id(), {"CPU": 2}, {"CPU": 1}, 0, waiting_bundles=[{"GPU": 1}], infeasible_bundles=[{"CPU": 16}], ...
LoadMetricsTest
python
walkccc__LeetCode
solutions/3371. Identify the Largest Outlier in an Array/3371.py
{ "start": 0, "end": 409 }
class ____: def getLargestOutlier(self, nums: list[int]) -> int: ans = -math.inf summ = sum(nums) count = collections.Counter(nums) for num in nums: withoutNum = summ - num if withoutNum % 2 == 0: specialSum = withoutNum // 2 # the sum of special numbers if count[specialS...
Solution
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/util/typing.py
{ "start": 20398, "end": 21032 }
class ____: def __getattr__(self, key: str) -> tuple[type, ...]: types = tuple( { t for t in [ getattr(typing, key, None), getattr(typing_extensions, key, None), ] if t is not None ...
_TypingInstances
python
getsentry__sentry
tests/sentry/integrations/bitbucket/test_repository.py
{ "start": 5865, "end": 8271 }
class ____(IntegrationRepositoryTestCase): provider_name = "integrations:bitbucket" def setUp(self) -> None: super().setUp() self.base_url = "https://api.bitbucket.org" self.shared_secret = "234567890" self.subject = "connect:1234567" with assume_test_silo_mode(SiloMode....
BitbucketCreateRepositoryTestCase
python
apache__airflow
airflow-ctl/tests/airflow_ctl/api/test_operations.py
{ "start": 5839, "end": 13870 }
class ____: asset_id: int = 1 dag_id: str = "dag_id" before: str = "2024-12-31T23:59:59+00:00" asset_response = AssetResponse( id=asset_id, name="asset", uri="asset_uri", extra={"extra": "extra"}, # type: ignore[dict-item] created_at=datetime.datetime(2024, 12, 3...
TestAssetsOperations
python
neetcode-gh__leetcode
python/0051-n-queens.py
{ "start": 0, "end": 868 }
class ____: def solveNQueens(self, n: int) -> List[List[str]]: col = set() posDiag = set() # (r + c) negDiag = set() # (r - c) res = [] board = [["."] * n for i in range(n)] def backtrack(r): if r == n: copy = ["".join(row) for row in b...
Solution
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 350330, "end": 351080 }
class ____(sgqlc.types.Input): """Autogenerated input type of UpdateIpAllowListEnabledSetting""" __schema__ = github_schema __field_names__ = ("owner_id", "setting_value", "client_mutation_id") owner_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="ownerId") """The ID of the owner on ...
UpdateIpAllowListEnabledSettingInput
python
getsentry__sentry
tests/sentry/sentry_apps/services/test_hook_service.py
{ "start": 566, "end": 13712 }
class ____(TestCase): def setUp(self) -> None: self.user = self.create_user() self.org = self.create_organization(owner=self.user) self.project = self.create_project(name="foo", organization=self.org) self.sentry_app = self.create_sentry_app( organization_id=self.org.id, ...
TestHookService
python
openai__openai-python
src/openai/types/beta/threads/run_create_params.py
{ "start": 8325, "end": 9472 }
class ____(TypedDict, total=False): content: Required[Union[str, Iterable[MessageContentPartParam]]] """The text contents of the message.""" role: Required[Literal["user", "assistant"]] """The role of the entity that is creating the message. Allowed values include: - `user`: Indicates the message ...
AdditionalMessage
python
encode__httpx
httpx/_exceptions.py
{ "start": 3342, "end": 3444 }
class ____(TimeoutException): """ Timed out while sending data to the host. """
WriteTimeout
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_bugbear/B024.py
{ "start": 1506, "end": 1598 }
class ____(notabc.ABC, abc.ABCMeta): # safe def method(self): foo()
multi_super_1
python
getsentry__sentry
src/sentry/replays/lib/new_query/fields.py
{ "start": 1365, "end": 1714 }
class ____(Protocol): """Field interface. Any instance which defines an "apply" method which accepts a "SearchFilter" and returns a "Condition" is considered a field. Additional methods and state may be added to help construct the "Condition". """ def apply(self, search_filter: SearchFilter) ...
FieldProtocol
python
scipy__scipy
scipy/signal/tests/test_signaltools.py
{ "start": 94818, "end": 94924 }
class ____(_TestLinearFilter): dtype = 'float64' @skip_xp_backends(np_only=True)
TestLinearFilterFloat64
python
doocs__leetcode
solution/2300-2399/2311.Longest Binary Subsequence Less Than or Equal to K/Solution.py
{ "start": 0, "end": 294 }
class ____: def longestSubsequence(self, s: str, k: int) -> int: ans = v = 0 for c in s[::-1]: if c == "0": ans += 1 elif ans < 30 and (v | 1 << ans) <= k: v |= 1 << ans ans += 1 return ans
Solution
python
marshmallow-code__marshmallow
tests/test_serialization.py
{ "start": 594, "end": 694 }
class ____: def __init__(self, dtime_int): self.dtime_int = dtime_int
DateTimeIntegerTuple
python
numba__numba
numba/tests/test_function_type.py
{ "start": 36956, "end": 39010 }
class ____(MemoryLeakMixin, TestCase): def test_exception_raising(self): class MyError(Exception): pass @njit def add(x, y): res = x + y if res > 100: raise MyError(res) return res fnty = types.FunctionType(int64(int64...
TestExceptionInFunctionType
python
pytorch__pytorch
torch/_dynamo/variables/higher_order_ops.py
{ "start": 105923, "end": 106671 }
class ____(TorchHigherOrderOperatorVariable): def _call_function( self, tx: "InstructionTranslator", args: "list[VariableTracker]", kwargs: "dict[str, VariableTracker]", ) -> "VariableTracker": from .builder import wrap_fx_proxy args, kwargs = LazyVariableTracker...
PrintHigherOrderVariable
python
airbytehq__airbyte
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/steps/common.py
{ "start": 23514, "end": 23620 }
class ____(Enum): ALL = "live" REGRESSION = "regression" VALIDATION = "validation"
LiveTestSuite
python
PrefectHQ__prefect
src/integrations/prefect-aws/tests/test_client_parameters.py
{ "start": 173, "end": 5643 }
class ____: @pytest.mark.parametrize( "params,result", [ (AwsClientParameters(), {"use_ssl": True}), ( AwsClientParameters( use_ssl=False, verify=False, endpoint_url="http://localhost:9000" ), { ...
TestAwsClientParameters
python
keras-team__keras
keras/src/utils/file_utils_test.py
{ "start": 4342, "end": 7835 }
class ____(test_case.TestCase): def setUp(self): self.base_dir = os.path.join(os.getcwd(), "temp_dir") os.makedirs(self.base_dir, exist_ok=True) self.tar_path = os.path.join(self.base_dir, "test.tar") def tearDown(self): os.remove(self.tar_path) shutil.rmtree(self.base_d...
FilterSafePathsTest
python
doocs__leetcode
solution/1200-1299/1238.Circular Permutation in Binary Representation/Solution.py
{ "start": 0, "end": 190 }
class ____: def circularPermutation(self, n: int, start: int) -> List[int]: g = [i ^ (i >> 1) for i in range(1 << n)] j = g.index(start) return g[j:] + g[:j]
Solution
python
coleifer__peewee
tests/postgres.py
{ "start": 1937, "end": 2017 }
class ____(TestModel): name = CharField() duration = IntervalField()
Event
python
gevent__gevent
src/gevent/tests/test__pywsgi.py
{ "start": 39820, "end": 40883 }
class ____(TestCase): validator = None # wsgiref.validate.IteratorWrapper([]) does not have __len__ def application(self, environ, start_response): path_bytes = b'/\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82' if PY3: # Under PY3, the escapes were decoded as latin-1 ...
TestInternational
python
google__pytype
pytype/constant_folding.py
{ "start": 3187, "end": 3359 }
class ____: """A dictionary.""" key_types: frozenset[Any] keys: tuple[Any, ...] value_types: frozenset[Any] values: tuple[Any, ...] elements: dict[Any, Any]
_Map
python
geekcomputers__Python
Emoji Dictionary/emoji_dictionary.py
{ "start": 378, "end": 8008 }
class ____(tk.Frame): cells = [ ["😀", "🥰", "😴", "🤓", "🤮", "🤬", "😨", "🤑", "😫", "😎"], [ "🐒", "🐕", "🐎", "🐪", "🐁", "🐘", "🦘", "🦈", "🐓", "🐝", "👀", ...
Keypad
python
keon__algorithms
tests/test_strings.py
{ "start": 9884, "end": 10450 }
class ____(unittest.TestCase): """[summary] Test for the file reverse_string.py Arguments: unittest {[type]} -- [description] """ def test_recursive(self): self.assertEqual("ereht olleh", recursive("hello there")) def test_iterative(self): self.assertEqual("ereht olleh...
TestReverseString
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 381581, "end": 382290 }
class ____(sgqlc.types.Input): """Ways in which lists of workflow runs can be ordered upon return.""" __schema__ = github_schema __field_names__ = ("field", "direction") field = sgqlc.types.Field(sgqlc.types.non_null(WorkflowRunOrderField), graphql_name="field") """The field by which to order workf...
WorkflowRunOrder
python
wandb__wandb
tests/unit_tests/test_launch/test_agent/test_config.py
{ "start": 267, "end": 4143 }
class ____: def __init__(self, api, config): self.api = api self.config = config async def loop(*args, **kwargs): pass @pytest.fixture def mock_agent(monkeypatch): monkeypatch.setattr( "wandb.sdk.launch._launch.LaunchAgent", lambda *args, **kwargs: MockAgent ) @pytes...
MockAgent
python
google__jax
tests/pallas/tpu_pallas_async_test.py
{ "start": 31597, "end": 33494 }
class ____(parameterized.TestCase): def setUp(self): super().setUp() if not jtu.is_device_tpu_at_least(4): self.skipTest('DMAs only guaranteed to work ou TPU v4+') def test_basic_stateful_async_copy(self): @jax.jit def f(x): y = jnp.zeros_like(x) def body(refs): copy_star...
PallasCallStatefulAsyncTest
python
django__django
django/contrib/gis/db/models/lookups.py
{ "start": 6095, "end": 6308 }
class ____(GISLookup): """ The 'bboverlaps' operator returns true if A's bounding box overlaps B's bounding box. """ lookup_name = "bboverlaps" @BaseSpatialField.register_lookup
BBOverlapsLookup
python
sqlalchemy__sqlalchemy
test/base/test_utils.py
{ "start": 28205, "end": 39973 }
class ____(ColumnCollectionCommon, fixtures.TestBase): def _column_collection(self, columns=None): return DedupeColumnCollection(columns=columns) def test_separate_key_cols(self): c1, c2 = sql.column("col1"), sql.column("col2") assert_raises_message( exc.ArgumentError, ...
DedupeColumnCollectionTest
python
readthedocs__readthedocs.org
readthedocs/config/models.py
{ "start": 1978, "end": 2120 }
class ____(ConfigBaseModel): path: str method: Literal["pip", "setuptools"] = "pip" extra_requirements: list[str] = []
PythonInstall
python
rapidsai__cudf
python/cudf_polars/cudf_polars/experimental/benchmarks/utils.py
{ "start": 6262, "end": 45936 }
class ____: """Results for a PDS-H or PDS-DS query run.""" queries: list[int] suffix: str executor: ExecutorType runtime: str stream_policy: str | None cluster: str scheduler: str # Deprecated, kept for backward compatibility n_workers: int versions: PackageVersions = dataclass...
RunConfig
python
huggingface__transformers
src/transformers/models/regnet/modeling_regnet.py
{ "start": 2959, "end": 3613 }
class ____(nn.Module): """ RegNet shortcut, used to project the residual features to the correct size. If needed, it is also used to downsample the input using `stride=2`. """ def __init__(self, in_channels: int, out_channels: int, stride: int = 2): super().__init__() self.convoluti...
RegNetShortCut
python
scikit-learn__scikit-learn
sklearn/manifold/_isomap.py
{ "start": 828, "end": 15734 }
class ____(ClassNamePrefixFeaturesOutMixin, TransformerMixin, BaseEstimator): """Isomap Embedding. Non-linear dimensionality reduction through Isometric Mapping Read more in the :ref:`User Guide <isomap>`. Parameters ---------- n_neighbors : int or None, default=5 Number of neighbors ...
Isomap
python
openai__openai-python
src/openai/types/responses/response_retrieve_params.py
{ "start": 1771, "end": 2372 }
class ____(ResponseRetrieveParamsBase): stream: Required[Literal[True]] """ If set to true, the model response data will be streamed to the client as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_f...
ResponseRetrieveParamsStreaming
python
keras-team__keras
keras/src/ops/core.py
{ "start": 440, "end": 2326 }
class ____(Operation): def call(self, f, xs): return backend.core.map(f, xs) def compute_output_spec(self, f, xs): x = tree.map_structure(lambda t: t[0], xs) n = tree.flatten(xs)[0].shape[0] y = backend.compute_output_spec(f, x) def append_batch_axis(t): ret...
Map
python
etianen__django-reversion
reversion/views.py
{ "start": 1235, "end": 1981 }
class ____: """ A class-based view mixin that wraps the request in a revision. The revision will have it's user set from the request automatically. """ revision_manage_manually = False revision_using = None revision_atomic = True def __init__(self, *args, **kwargs): super()...
RevisionMixin
python
catalyst-team__catalyst
catalyst/callbacks/metrics/scikit_learn.py
{ "start": 392, "end": 5005 }
class ____(FunctionalBatchMetricCallback): """SklearnBatchCallback implements an integration of **batch-based** Sklearn metrics Args: keys: a dictionary containing: a mapping between ``metric_fn`` arguments and keys in ``runner.batch`` other arguments needed for ``metric_fn`` ...
SklearnBatchCallback
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI045.py
{ "start": 292, "end": 433 }
class ____: def __iter__(self) -> typing.Iterable: ... def not_iter(self) -> typing.Iterable: ...
TypingIterableReturn
python
getsentry__sentry
tests/sentry/backup/test_imports.py
{ "start": 29532, "end": 33038 }
class ____(ImportTestCase): """ Some models are automatically created via signals and similar automagic from related models. We test that behavior here. Specifically, we test the following: - That `Email` and `UserEmail` are automatically created when `User` is. - That `OrganizationMapping` ...
SignalingTests
python
django-import-export__django-import-export
tests/core/migrations/0016_alter_category_options_alter_uuidcategory_options.py
{ "start": 84, "end": 511 }
class ____(migrations.Migration): dependencies = [ ("core", "0015_withpositiveintegerfields"), ] operations = [ migrations.AlterModelOptions( name="category", options={"verbose_name_plural": "categories"}, ), migrations.AlterModelOptions( ...
Migration
python
pytorch__pytorch
torch/nn/modules/activation.py
{ "start": 20027, "end": 21106 }
class ____(Module): r"""Applies the gated linear unit function. :math:`{GLU}(a, b)= a \otimes \sigma(b)` where :math:`a` is the first half of the input matrices and :math:`b` is the second half. Args: dim (int): the dimension on which to split the input. Default: -1 Shape: - Input...
GLU
python
pytorch__pytorch
torch/_inductor/codegen/pallas.py
{ "start": 1879, "end": 10256 }
class ____(OpOverrides): """ Map element-wise ops to JAX/Pallas operations. For now, we use the default Python operators which are compatible with JAX numpy broadcasting semantics. """ @staticmethod def sin(x: str) -> str: return f"jnp.sin({x})" @staticmethod def cos(x: st...
PallasKernelOverrides
python
pytorch__pytorch
torch/testing/_internal/jit_metaprogramming_utils.py
{ "start": 789, "end": 22532 }
class ____(tuple): __slots__ = () non_differentiable = collections.namedtuple('non_differentiable', ['tensor']) def create_input(call_args, requires_grad=True, non_contiguous=False, call_kwargs=None, dtype=torch.float, device=None): if not isinstance(call_args, tuple): call_args = (call_args,) de...
dont_convert
python
readthedocs__readthedocs.org
readthedocs/projects/tests/test_build_tasks.py
{ "start": 1331, "end": 2541 }
class ____: # NOTE: `load_yaml_config` maybe be moved to the setup and assign to self. @pytest.fixture(autouse=True) def setup(self, requests_mock): # Save the reference to query it from inside the test self.requests_mock = requests_mock self.project = self._get_project() s...
BuildEnvironmentBase
python
PrefectHQ__prefect
src/integrations/prefect-databricks/prefect_databricks/models/jobs.py
{ "start": 24716, "end": 24860 }
class ____(RootModel[str]): """ See source code for the fields' description. """ model_config = ConfigDict(frozen=True)
GroupName
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/named_types.py
{ "start": 5872, "end": 6102 }
class ____(NamedTypeDropper): def visit_enum(self, enum): if not self._can_drop_type(enum): return with self.with_ddl_events(enum): self.connection.execute(DropEnumType(enum))
EnumDropper
python
kubernetes-client__python
kubernetes/client/models/v1alpha1_pod_certificate_request_spec.py
{ "start": 383, "end": 19698 }
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...
V1alpha1PodCertificateRequestSpec
python
realpython__materials
python-annotations/models.py
{ "start": 86, "end": 190 }
class ____: email: str password: str def __post_init__(self): validate_email(self)
User
python
getsentry__sentry
tests/sentry/api/serializers/test_grouptagkey.py
{ "start": 137, "end": 442 }
class ____(TestCase): def test(self) -> None: user = self.create_user() grouptagkey = GroupTagKey(group_id=0, key="key", values_seen=1) result = serialize(grouptagkey, user) assert result["key"] == "key" assert result["uniqueValues"] == 1
GroupTagKeySerializerTest
python
huggingface__transformers
src/transformers/models/mistral3/configuration_mistral3.py
{ "start": 725, "end": 5710 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`Mistral3ForConditionalGeneration`]. It is used to instantiate an Mistral3 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will...
Mistral3Config
python
astropy__astropy
astropy/modeling/spline.py
{ "start": 24128, "end": 27532 }
class ____(_SplineFitter): """ Fit a spline using the `scipy.interpolate.splrep` function interface. """ def __init__(self): super().__init__() self.fit_info = {"fp": None, "ier": None, "msg": None} def __call__(self, model, x, y, **kwargs): """ Fit a spline to data...
SplineSplrepFitter
python
davidhalter__jedi
test/completion/classes.py
{ "start": 8127, "end": 8267 }
class ____(Foo): def foo(self): #? int() super().foo() # ----------------- # if flow at class level # -----------------
Foo
python
jina-ai__jina
jina/excepts.py
{ "start": 2393, "end": 2541 }
class ____(Exception, BaseJinaException): """Raised when trying to use non-containerized Executor in K8s or Docker Compose"""
NoContainerizedError
python
numpy__numpy
numpy/_core/tests/test_multiarray.py
{ "start": 221804, "end": 224447 }
class ____: @pytest.mark.parametrize('dtype', [ np.uint8, np.uint16, np.uint32, np.uint64, np.int8, np.int16, np.int32, np.int64, np.float16, np.float32, np.float64 ]) def test_basic(self, dtype): a = np.array([1, 2, 1, 3, 1, 5], dtype=dtype) b = np.array([0, 4, 5, 6,...
TestLexsort
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1392125, "end": 1393565 }
class ____(sgqlc.types.Type, Node): """Represents a 'referenced' event on a given `ReferencedSubject`.""" __schema__ = github_schema __field_names__ = ("actor", "commit", "commit_repository", "created_at", "is_cross_repository", "is_direct_reference", "subject") actor = sgqlc.types.Field(Actor, graphql...
ReferencedEvent
python
sqlalchemy__sqlalchemy
test/orm/test_froms.py
{ "start": 39132, "end": 56493 }
class ____(QueryTest, AssertsCompiledSQL): def test_from_alias_two_needs_nothing(self): User, addresses, users = ( self.classes.User, self.tables.addresses, self.tables.users, ) query = ( users.select() .where(users.c.id == 7) ...
InstancesTest
python
chroma-core__chroma
chromadb/utils/embedding_functions/chroma_bm25_embedding_function.py
{ "start": 1205, "end": 1381 }
class ____(TypedDict, total=False): k: float b: float avg_doc_length: float token_max_length: int stopwords: List[str] store_tokens: bool
ChromaBm25Config
python
apache__airflow
airflow-core/src/airflow/api_fastapi/core_api/datamodels/xcom.py
{ "start": 2292, "end": 2545 }
class ____(XComResponse): """XCom response serializer with string return type.""" value: str | None @field_validator("value", mode="before") def value_to_string(cls, v): return str(v) if v is not None else None
XComResponseString
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/dt_diamond_left/package.py
{ "start": 217, "end": 574 }
class ____(Package): """This package has an indirect diamond dependency on dt-diamond-bottom""" homepage = "http://www.example.com" url = "http://www.example.com/dt-diamond-left-1.0.tar.gz" version("1.0", md5="0123456789abcdef0123456789abcdef") depends_on("dt-diamond-bottom", type="build") de...
DtDiamondLeft
python
pytorch__pytorch
test/distributed/_composable/fsdp/test_fully_shard_init.py
{ "start": 16414, "end": 19126 }
class ____(FSDPTestMultiThread): @property def world_size(self) -> int: return 2 @skip_if_lt_x_gpu(1) def test_shard_tensor_parameters(self): # Use odd dim sizes to test uneven shards model = nn.Sequential(*[MLP(3, dim_multiplier=3) for _ in range(3)]) orig_params = [par...
TestFullyShardShardedParameterTensor
python
imageio__imageio
imageio/plugins/lytro.py
{ "start": 6744, "end": 14728 }
class ____(LytroFormat): """This is the Lytro Illum LFR format. The lfr is a image and meta data container format as used by the Lytro Illum light field camera. The format will read the specified lfr file. This format does not support writing. Parameters for reading ---------------------- ...
LytroLfrFormat
python
tornadoweb__tornado
tornado/test/escape_test.py
{ "start": 7550, "end": 12330 }
class ____(unittest.TestCase): def test_linkify(self): for text, kwargs, html in linkify_tests: linked = tornado.escape.linkify(text, **kwargs) self.assertEqual(linked, html) def test_xhtml_escape(self): tests = [ ("<foo>", "&lt;foo&gt;"), ("<foo>...
EscapeTestCase
python
doocs__leetcode
solution/2300-2399/2353.Design a Food Rating System/Solution.py
{ "start": 0, "end": 849 }
class ____: def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int]): self.d = defaultdict(SortedList) self.g = {} for food, cuisine, rating in zip(foods, cuisines, ratings): self.d[cuisine].add((-rating, food)) self.g[food] = (rating, cuisine) ...
FoodRatings
python
cython__cython
Cython/Compiler/ExprNodes.py
{ "start": 467526, "end": 468441 }
class ____(UnopNode): # unary '-' operator operator = '-' def analyse_c_operation(self, env): if self.operand.type.is_numeric: self.type = PyrexTypes.widest_numeric_type( self.operand.type, PyrexTypes.c_int_type) elif self.operand.type.is_enum: self...
UnaryMinusNode
python
xlwings__xlwings
xlwings/constants.py
{ "start": 71464, "end": 71617 }
class ____: xlShiftDown = -4121 # from enum XlInsertShiftDirection xlShiftToRight = -4161 # from enum XlInsertShiftDirection
InsertShiftDirection
python
spyder-ide__spyder
spyder/plugins/workingdirectory/confpage.py
{ "start": 574, "end": 4665 }
class ____(PluginConfigPage): def setup_page(self): about_label = QLabel( _("This is the directory that will be set as the default for " "the IPython console and Files panes.") ) about_label.setWordWrap(True) # Startup directory startup_group = QGr...
WorkingDirectoryConfigPage
python
dagster-io__dagster
examples/docs_projects/project_components_pdf_extraction/project_components_pdf_extraction/lib/pdf_extraction.py
{ "start": 1885, "end": 10923 }
class ____(dg.Component, dg.Resolvable): """A component for extracting and validating text from PDF documents. This component provides a complete PDF text extraction pipeline that: 1. Converts PDF pages to high-quality images 2. Performs OCR text extraction using Tesseract 3. Validates extraction q...
PdfExtraction
python
gevent__gevent
src/greentest/3.10/test_asyncore.py
{ "start": 26091, "end": 26182 }
class ____(TestAPI_UseIPv4Sockets, unittest.TestCase): use_poll = True
TestAPI_UseIPv4Poll
python
pytorch__pytorch
torch/nn/utils/_expanded_weights/linear_expanded_weights.py
{ "start": 327, "end": 2259 }
class ____(torch.autograd.Function): @staticmethod # pyrefly: ignore [bad-override] def forward(ctx, _, __, *expanded_args_and_kwargs): if len(expanded_args_and_kwargs[0].shape) <= 1: raise RuntimeError( "Input does not have a batch dimension. Expanded Weights expected in...
LinearPerSampleGrad
python
langchain-ai__langchain
libs/partners/chroma/tests/integration_tests/fake_embeddings.py
{ "start": 987, "end": 2002 }
class ____(FakeEmbeddings): """Fake embeddings which remember all the texts seen so far to return consistent vectors for the same texts.""" def __init__(self, dimensionality: int = 10) -> None: self.known_texts: list[str] = [] self.dimensionality = dimensionality def embed_documents(se...
ConsistentFakeEmbeddings
python
anthropics__anthropic-sdk-python
tests/api_resources/beta/test_models.py
{ "start": 445, "end": 3708 }
class ____: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: Anthropic) -> None: model = client.beta.models.retrieve( model_id="model_id", ) assert_matches_type(Beta...
TestModels
python
astropy__astropy
astropy/wcs/wcsapi/fitswcs.py
{ "start": 6459, "end": 33556 }
class ____(BaseLowLevelWCS, HighLevelWCSMixin): """ A mix-in class that is intended to be inherited by the :class:`~astropy.wcs.WCS` class and provides the low- and high-level WCS API. """ @property def pixel_n_dim(self): return self.naxis @property def world_n_dim(self): ...
FITSWCSAPIMixin
python
davidhalter__jedi
test/completion/pep0484_generic_passthroughs.py
{ "start": 6005, "end": 6872 }
class ____: def __call__(self, func: TCallable) -> TCallable: ... #? class_decorator_factory_bound_callable() class_decorator_factory_bound_callable() #? Callable() class_decorator_factory_bound_callable()() is_decorated_by_class_bound_factory = class_decorator_factory_bound_callable()(will_be_decorated)...
class_decorator_factory_bound_callable
python
modin-project__modin
modin/core/storage_formats/pandas/query_compiler.py
{ "start": 7903, "end": 187466 }
class ____(BaseQueryCompiler): """ Query compiler for the pandas storage format. This class translates common query compiler API into the DataFrame Algebra queries, that is supposed to be executed by :py:class:`~modin.core.dataframe.pandas.dataframe.dataframe.PandasDataframe`. Parameters -----...
PandasQueryCompiler
python
jazzband__django-redis
tests/test_hashring.py
{ "start": 61, "end": 716 }
class ____: def __init__(self, identifier): self.identifier = identifier def __str__(self): return f"node:{self.identifier}" def __repr__(self): return f"<Node {self.identifier}>" @pytest.fixture def hash_ring(): return HashRing([Node(i) for i in range(3)]) def test_hashrin...
Node
python
gwtw__py-sorting
test/base_string_sort_test.py
{ "start": 0, "end": 1882 }
class ____(object): def test_sorts_sorted_character_array(self): self.assertEqual(["a","b","c","d","e"], self.sort(["a","b","c","d","e"])) def test_sorts_reverse_sorted_character_array(self): self.assertEqual(["a","b","c","d","e"], self.sort(["e","d","c","b","a"])) def test_sorts_sorted_character_array_...
BaseStringSortTest
python
kamyu104__LeetCode-Solutions
Python/maximize-score-after-n-operations.py
{ "start": 84, "end": 950 }
class ____(object): def maxScore(self, nums): """ :type nums: List[int] :rtype: int """ def popcount(n): count = 0 while n: n &= n-1 count += 1 return count def bits(mask): result = [] ...
Solution
python
run-llama__llama_index
llama-index-core/llama_index/core/llama_dataset/rag.py
{ "start": 1175, "end": 2685 }
class ____(BaseLlamaDataExample): """ RAG example class. Analogous to traditional ML datasets, this dataset contains the "features" (i.e., query + context) to make a prediction and the "label" (i.e., response) to evaluate the prediction. Args: query (str): The user query query_by (C...
LabelledRagDataExample
python
Unity-Technologies__ml-agents
ml-agents-trainer-plugin/mlagents_trainer_plugin/dqn/dqn_optimizer.py
{ "start": 1553, "end": 6732 }
class ____(TorchOptimizer): def __init__(self, policy: TorchPolicy, trainer_settings: TrainerSettings): super().__init__(policy, trainer_settings) # initialize hyper parameters params = list(self.policy.actor.parameters()) self.optimizer = torch.optim.Adam( params, lr=se...
DQNOptimizer
python
bokeh__bokeh
tests/unit/bokeh/models/widgets/test_slider.py
{ "start": 4860, "end": 8530 }
class ____: def test_value_and_value_throttled(self) -> None: start = datetime(2021, 1, 1) end = datetime(2021, 12, 31) value = (convert_datetime_type(datetime(2021, 2, 1)), convert_datetime_type(datetime(2021, 2, 28))) s0 = mws.DateRangeSlider(start=start, end=end) with pyt...
TestDateRangeSlider
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/array_ops/array_ops_test.py
{ "start": 82864, "end": 91545 }
class ____(test_util.TensorFlowTestCase): def testShapesMatch(self): """Tests for various different shape combinations.""" shapes = [] # params_shape, indices_shape, batch_dims shapes.append(((2, 2, 2), (2, 1), 1),) shapes.append(((2, 2, 2), (2, 2), 1),) shapes.append(((2, 2, 2), (2, 3), 0),)...
BatchGatherNdTest
python
realpython__materials
tic-tac-toe-ai-python/source_code_bonus/tic-tac-toe/library/src/tic_tac_toe/game/players_async.py
{ "start": 829, "end": 1382 }
class ____(AsyncPlayer, metaclass=abc.ABCMeta): def __init__(self, mark: Mark, delay_seconds: float = 0.25) -> None: super().__init__(mark) self.delay_seconds = delay_seconds async def get_move(self, game_state: GameState) -> Move | None: await asyncio.sleep(self.delay_seconds) ...
AsyncComputerPlayer
python
coleifer__peewee
playhouse/sqlcipher_ext.py
{ "start": 3556, "end": 3632 }
class ____(_SqlCipherDatabase, SqliteExtDatabase): pass
SqlCipherExtDatabase
python
doocs__leetcode
solution/3000-3099/3042.Count Prefix and Suffix Pairs I/Solution.py
{ "start": 0, "end": 246 }
class ____: def countPrefixSuffixPairs(self, words: List[str]) -> int: ans = 0 for i, s in enumerate(words): for t in words[i + 1 :]: ans += t.endswith(s) and t.startswith(s) return ans
Solution
python
getsentry__sentry
src/sentry/workflow_engine/typings/notification_action.py
{ "start": 733, "end": 974 }
class ____(StrEnum): """ SentryAppIdentifier is an enum that represents the identifier for a Sentry app. """ SENTRY_APP_INSTALLATION_UUID = "sentry_app_installation_uuid" SENTRY_APP_ID = "sentry_app_id"
SentryAppIdentifier
python
dask__dask
dask/tests/test_tokenize.py
{ "start": 26487, "end": 26556 }
class ____: a: int = dataclasses.field(init=False)
NoValueDataClass
python
run-llama__llama_index
llama-index-integrations/callbacks/llama-index-callbacks-agentops/llama_index/callbacks/agentops/base.py
{ "start": 927, "end": 3074 }
class ____(BaseModel): class Config: arbitrary_types_allowed = True is_agent_chat_span: Dict[str, bool] = Field( default_factory=dict, description="Dictionary to check whether a span originates from an agent.", ) agent_chat_start_event: Dict[str, LLMChatStartEvent] = Field( ...
AgentOpsHandlerState
python
pennersr__django-allauth
allauth/socialaccount/providers/notion/provider.py
{ "start": 267, "end": 850 }
class ____(ProviderAccount): def get_user(self): return self.account.extra_data["owner"]["user"] def get_name(self): return self.get_user()["name"] def get_avatar_url(self): return self.get_user()["avatar_url"] def get_workspace_name(self): return self.account.extra_da...
NotionAccount