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
tensorflow__tensorflow
tensorflow/python/data/experimental/kernel_tests/service/data_service_ops_test.py
{ "start": 46274, "end": 48026 }
class ____( data_service_test_base.TestBase, parameterized.TestCase ): @combinations.generate(test_base.default_test_combinations()) def testExplicitProtocolFromDatasetId(self): cluster = self.make_test_cluster( num_workers=1, data_transfer_protocol="grpc" ) range_ds = dataset_ops.Dataset.r...
DataServiceOpsGrpcDataTransferTest
python
run-llama__llama_index
llama-index-core/llama_index/core/storage/chat_store/simple_chat_store.py
{ "start": 943, "end": 3696 }
class ____(BaseChatStore): """Simple chat store. Async methods provide same functionality as sync methods in this class.""" store: Dict[str, List[AnnotatedChatMessage]] = Field(default_factory=dict) @classmethod def class_name(cls) -> str: """Get class name.""" return "SimpleChatStore"...
SimpleChatStore
python
pikepdf__pikepdf
tests/test_object.py
{ "start": 17783, "end": 21703 }
class ____: @pytest.fixture def stream_object(self): with pikepdf.new() as pdf: yield Stream(pdf, b'abc123xyz') def test_basic(self, stream_object): stream_object.write(b'abc') assert stream_object.read_bytes() == b'abc' def test_compressed_readback(self, stream_obj...
TestStreamReadWrite
python
huggingface__transformers
tests/models/xcodec/test_modeling_xcodec.py
{ "start": 1321, "end": 3669 }
class ____: def __init__( self, parent, batch_size=4, num_channels=1, sample_rate=16000, codebook_size=1024, num_samples=256, is_training=False, ): self.parent = parent self.batch_size = batch_size self.num_channels = num_ch...
XcodecModelTester
python
django__django
tests/contenttypes_tests/test_views.py
{ "start": 660, "end": 5087 }
class ____(TestCase): @classmethod def setUpTestData(cls): # Don't use the manager to ensure the site exists with pk=1, regardless # of whether or not it already exists. cls.site1 = Site(pk=1, domain="testserver", name="testserver") cls.site1.save() cls.author1 = Author.o...
ContentTypesViewsTests
python
django__django
tests/staticfiles_tests/test_liveserver.py
{ "start": 674, "end": 886 }
class ____(StaticLiveServerTestCase): available_apps = [] @classmethod def setUpClass(cls): cls.enterClassContext(override_settings(**TEST_SETTINGS)) super().setUpClass()
LiveServerBase
python
anthropics__anthropic-sdk-python
src/anthropic/resources/beta/beta.py
{ "start": 3429, "end": 4032 }
class ____: def __init__(self, beta: Beta) -> None: self._beta = beta @cached_property def models(self) -> ModelsWithRawResponse: return ModelsWithRawResponse(self._beta.models) @cached_property def messages(self) -> MessagesWithRawResponse: return MessagesWithRawResponse(s...
BetaWithRawResponse
python
Pylons__pyramid
src/pyramid/security.py
{ "start": 5572, "end": 6344 }
class ____(int): def __new__(cls, s, *args): """ Create a new instance. :param fmt: A format string explaining the reason for denial. :param args: Arguments are stored and used with the format string to generate the ``msg``. """ inst = int.__ne...
PermitsResult
python
numba__numba
numba/cuda/tests/cudapy/test_vector_type.py
{ "start": 6479, "end": 10515 }
class ____(CUDATestCase): def test_basic(self): """Basic test that makes sure that vector type and aliases are available within the cuda module from both device and simulator mode. This is an important sanity check, since other tests below tests the vector type objects programmatica...
TestCudaVectorType
python
django__django
tests/admin_filters/tests.py
{ "start": 7847, "end": 7938 }
class ____(ModelAdmin): list_filter = (NotNinetiesListFilter,)
NotNinetiesListFilterAdmin
python
kamyu104__LeetCode-Solutions
Python/widest-vertical-area-between-two-points-containing-no-points.py
{ "start": 52, "end": 337 }
class ____(object): def maxWidthOfVerticalArea(self, points): """ :type points: List[List[int]] :rtype: int """ sorted_x = sorted({x for x, y in points}) return max([b-a for a, b in itertools.izip(sorted_x, sorted_x[1:])] + [0])
Solution
python
doocs__leetcode
lcof2/剑指 Offer II 102. 加减的目标值/Solution4.py
{ "start": 0, "end": 358 }
class ____: def findTargetSumWays(self, nums: List[int], target: int) -> int: @cache def dfs(i, t): if i == n: if t == target: return 1 return 0 return dfs(i + 1, t + nums[i]) + dfs(i + 1, t - nums[i]) ans, n = 0, l...
Solution
python
joke2k__faker
faker/providers/isbn/isbn.py
{ "start": 148, "end": 492 }
class ____: def __init__( self, ean: Optional[str] = None, group: Optional[str] = None, registrant: Optional[str] = None, publication: Optional[str] = None, ) -> None: self.ean = ean self.group = group self.registrant = registrant self.publ...
ISBN
python
python-excel__xlrd
xlrd/formatting.py
{ "start": 41430, "end": 41951 }
class ____(BaseObject, EqNeAttrs): """ A collection of the background-related attributes of an ``XF`` record. Items correspond to those in the Excel UI's Format -> Cells -> Patterns tab. An explanations of "colour index" is given in :ref:`palette`. .. versionadded:: 0.6.1 """ #: See secti...
XFBackground
python
jazzband__django-oauth-toolkit
tests/test_auth_backends.py
{ "start": 798, "end": 1464 }
class ____(TestCase): """ Base class for cases in this module """ factory = RequestFactory() @classmethod def setUpTestData(cls): cls.user = UserModel.objects.create_user("user", "test@example.com", "123456") cls.app = ApplicationModel.objects.create( name="app", ...
BaseTest
python
openai__openai-python
src/openai/_models.py
{ "start": 1610, "end": 24114 }
class ____(pydantic.BaseModel): if PYDANTIC_V1: @property @override def model_fields_set(self) -> set[str]: # a forwards-compat shim for pydantic v2 return self.__fields_set__ # type: ignore class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprec...
BaseModel
python
ray-project__ray
python/ray/serve/_private/test_utils.py
{ "start": 16988, "end": 18139 }
class ____: def __init__(self): self._auth_context = {"key": "value"} self._invocation_metadata = [("key", "value")] self._peer = "peer" self._peer_identities = b"peer_identities" self._peer_identity_key = "peer_identity_key" self._code = None self._details = ...
FakeGrpcContext
python
Textualize__textual
src/textual/events.py
{ "start": 8935, "end": 15979 }
class ____(InputEvent, bubble=True): """Sent in response to a mouse event. - [X] Bubbles - [ ] Verbose Args: widget: The widget under the mouse. x: The relative x coordinate. y: The relative y coordinate. delta_x: Change in x since the last message. delta_y: Cha...
MouseEvent
python
kamyu104__LeetCode-Solutions
Python/letter-tile-possibilities.py
{ "start": 52, "end": 1537 }
class ____(object): def numTilePossibilities(self, tiles): """ :type tiles: str :rtype: int """ fact = [0.0]*(len(tiles)+1) fact[0] = 1.0 for i in xrange(1, len(tiles)+1): fact[i] = fact[i-1]*i count = collections.Counter(tiles) # ...
Solution
python
kamyu104__LeetCode-Solutions
Python/find-all-lonely-numbers-in-the-array.py
{ "start": 42, "end": 304 }
class ____(object): def findLonely(self, nums): """ :type nums: List[int] :rtype: List[int] """ cnt = collections.Counter(nums) return [x for x in nums if cnt[x] == 1 and x-1 not in cnt and x+1 not in cnt]
Solution
python
sqlalchemy__sqlalchemy
test/orm/test_dynamic.py
{ "start": 24172, "end": 31497 }
class ____( _WriteOnlyFixture, _fixtures.FixtureTest, AssertsCompiledSQL ): __dialect__ = "default" def test_iteration_error(self, user_address_fixture): User, Address = user_address_fixture() sess = fixture_session() u = sess.get(User, 8) with expect_raises_message( ...
WriteOnlyTest
python
pytorch__pytorch
torch/_dynamo/comptime.py
{ "start": 1699, "end": 6034 }
class ____: """ A ComptimeVar represents a Python value, at some particular point in time, in the Python code we are symbolically evaluating with torchdynamo. This must be distinguished from a runtime value, as at compile-time there are some properties of the variable we do not know (for exampl...
ComptimeVar
python
numpy__numpy
numpy/_core/tests/test_multiarray.py
{ "start": 402758, "end": 413586 }
class ____: """ Verify that making a view of a non-contiguous array works as expected. """ def test_smaller_dtype_multiple(self): # x is non-contiguous x = np.arange(10, dtype='<i4')[::2] with pytest.raises(ValueError, match='the last axis must be conti...
TestViewDtype
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/solver9.py
{ "start": 503, "end": 660 }
class ____(Generic[_T1]): def __init__(self, value: _T1) -> None: ... @classmethod def get(cls: type[_T3]) -> type[_T3]: return cls
ClassA
python
charliermarsh__ruff
crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring_code_examples_dynamic_line_width.py
{ "start": 6880, "end": 8250 }
class ____(Abc, Def, Ghi, Jkl, Mno, Pqr, Stu, Vwx, Yz, A1, A2, A3, A4, A5): def abcdefghijklmnopqrstuvwxyz(self, abc, ddef, ghi, jkl, mno, pqr, stu, vwx, yz, a1, a2, a3, a4): def abcdefghijklmnopqrstuvwxyz(abc, ddef, ghi, jkl, mno, pqr, stu, vwx, yz, a1, a2, a3, a4): # For 4 space indents, this ...
Abcdefghijklmopqrstuvwxyz
python
pytorch__pytorch
tools/experimental/torchfuzz/operators/matrix_multiply.py
{ "start": 9787, "end": 14559 }
class ____(MatrixMultiplyOperator): """Operator for general matrix multiplication (torch.matmul).""" def __init__(self): super().__init__("matmul") self.weight = 500.0 @property def torch_op_name(self) -> str | None: """Return the torch operation name.""" return "torch....
MatmulOperator
python
altair-viz__altair
altair/vegalite/v6/schema/channels.py
{ "start": 6444, "end": 7384 }
class ____: _encoding_name: str def to_dict( self, validate: bool = True, ignore: list[str] | None = None, context: dict[str, Any] | None = None, ) -> dict: context = context or {} ignore = ignore or [] condition = self._get("condition", Undefined) #...
ValueChannelMixin
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 1061168, "end": 1061773 }
class ____(sgqlc.types.Union): """ See source code for more info. """ __schema__ = graphql_schema __types__ = ( ProjectV2ItemFieldDateValue, ProjectV2ItemFieldIterationValue, ProjectV2ItemFieldLabelValue, ProjectV2ItemFieldMilestoneValue, ProjectV2ItemFieldNu...
ProjectV2ItemFieldValue
python
huggingface__transformers
tests/models/seamless_m4t/test_processing_seamless_m4t.py
{ "start": 967, "end": 5295 }
class ____(unittest.TestCase): def setUp(self): self.checkpoint = "facebook/hf-seamless-m4t-medium" self.tmpdirname = tempfile.mkdtemp() def get_tokenizer(self, **kwargs): return SeamlessM4TTokenizer.from_pretrained(self.checkpoint, **kwargs) def get_feature_extractor(self, **kwarg...
SeamlessM4TProcessorTest
python
pytorch__pytorch
torch/distributed/fsdp/_fully_shard/_fsdp_param.py
{ "start": 7037, "end": 7781 }
class ____(Enum): """ - ``SHARDED``: The sharded parameter is registered to the module. It is the only contributor to parameter memory. - ``SHARDED_POST_FORWARD``: The unsharded parameter is resharded to a smaller world size. Since this data should not be used for computation, we do not re...
ShardedState
python
RaRe-Technologies__gensim
gensim/test/test_rpmodel.py
{ "start": 505, "end": 2374 }
class ____(unittest.TestCase): def setUp(self): self.corpus = MmCorpus(datapath('testcorpus.mm')) def test_transform(self): # create the transformation model # HACK; set fixed seed so that we always get the same random matrix (and can compare against expected results) np.random....
TestRpModel
python
anthropics__anthropic-sdk-python
src/anthropic/_legacy_response.py
{ "start": 1079, "end": 12270 }
class ____(Generic[R]): """This is a legacy class as it will be replaced by `APIResponse` and `AsyncAPIResponse` in the `_response.py` file in the next major release. For the sync client this will mostly be the same with the exception of `content` & `text` will be methods instead of properties. In ...
LegacyAPIResponse
python
vyperlang__vyper
vyper/builtins/functions.py
{ "start": 43658, "end": 44095 }
class ____(BuiltinFunctionT): _id = "blobhash" _inputs = [("index", UINT256_T)] _return_type = BYTES32_T mutability = StateMutability.VIEW @process_inputs def build_IR(self, expr, args, kwargs, contact): if not version_check(begin="cancun"): raise EvmVersionException("`blobh...
BlobHash
python
ray-project__ray
rllib/models/torch/mingpt.py
{ "start": 715, "end": 1013 }
class ____: # block size must be provided block_size: int # transformer config n_layer: int = 12 n_head: int = 12 n_embed: int = 768 # dropout config embed_pdrop: float = 0.1 resid_pdrop: float = 0.1 attn_pdrop: float = 0.1 @Deprecated(error=False)
GPTConfig
python
django-extensions__django-extensions
django_extensions/collision_resolvers.py
{ "start": 4399, "end": 5282 }
class ____(PathBasedCR, metaclass=ABCMeta): """ Abstract collision resolver which transform pair (app name, model_name) to alias by changing dots to underscores. You must define MODIFICATION_STRING which should be string to format with two keyword arguments: app_name and model_name. For example: "{app_n...
AppNameCR
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 234463, "end": 235241 }
class ____(Operation): def call(self, x1, x2): return backend.numpy.logical_xor(x1, x2) def compute_output_spec(self, x1, x2): x1_shape = getattr(x1, "shape", []) x2_shape = getattr(x2, "shape", []) output_shape = broadcast_shapes(x1_shape, x2_shape) return KerasTensor(o...
LogicalXor
python
ipython__ipython
IPython/core/macro.py
{ "start": 541, "end": 1726 }
class ____: """Simple class to store the value of macros as strings. Macro is just a callable that executes a string of IPython input when called. """ def __init__(self,code): """store the macro value, as a single string which can be executed""" lines = [] enc = None ...
Macro
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/constructor32.py
{ "start": 546, "end": 650 }
class ____(metaclass=BMeta): ... def func1(cls: type[B]): # This should generate an error. cls()
B
python
google__jax
jax/experimental/mosaic/gpu/utils.py
{ "start": 46053, "end": 48428 }
class ____: source_bounds: tuple[int, ...] target_bounds: tuple[int, ...] partition: tuple[int | None, ...] base_offset: tuple[ir.Value, ...] | None def __init__( self, elements: tuple[int, ...], *, partition: tuple[int | None, ...], base_offset: tuple[ir.Value, ...] | None = No...
Partition
python
openai__openai-python
src/openai/pagination.py
{ "start": 1674, "end": 2502 }
class ____(BaseSyncPage[_T], BasePage[_T], Generic[_T]): data: List[_T] has_more: Optional[bool] = None @override def _get_page_items(self) -> List[_T]: data = self.data if not data: return [] return data @override def has_next_page(self) -> bool: ha...
SyncCursorPage
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1520255, "end": 1521553 }
class ____(Transform): """ LoessTransform schema wrapper. Parameters ---------- loess : str, :class:`FieldName` The data field of the dependent variable to smooth. on : str, :class:`FieldName` The data field of the independent variable to use a predictor. bandwidth : float ...
LoessTransform
python
keras-team__keras
keras/src/ops/math_test.py
{ "start": 16240, "end": 35813 }
class ____(testing.TestCase): def run_segment_reduce_test( self, segment_reduce_op, element_wise_reduce_method, num_indices, indices_high, data_dims=tuple(), num_segments=None, add_neg1_to_indices=False, sorted_indices=False, ): if ...
MathOpsCorrectnessTest
python
google__pytype
pytype/abstract/_typing.py
{ "start": 21735, "end": 21891 }
class ____(_TypeVariable): """Parameter of a type (typing.TypeVar).""" _INSTANCE_CLASS: type[TypeParameterInstance] = TypeParameterInstance
TypeParameter
python
airbytehq__airbyte
airbyte-integrations/connectors/source-tiktok-marketing/unit_tests/integration/test_reports_hourly.py
{ "start": 8114, "end": 16238 }
class ____(TestCase): stream_name = "ad_groups_reports_hourly" advertiser_id = "872746382648" cursor = "2024-01-01 10:00:00" cursor_field = "stat_time_hour" metrics = [ "campaign_name", "campaign_id", "adgroup_name", "placement_type", "tt_app_id", "tt_...
TestAdGroupsReportsHourly
python
great-expectations__great_expectations
great_expectations/metrics/query/row_count.py
{ "start": 239, "end": 350 }
class ____(QueryMetric[QueryRowCountResult]): name = "query.row_count" query: NonEmptyString
QueryRowCount
python
allegroai__clearml
clearml/backend_api/services/v2_20/projects.py
{ "start": 154445, "end": 155399 }
class ____(Request): """ Validates that the project exists and can be deleted :param project: Project ID :type project: str """ _service = "projects" _action = "validate_delete" _version = "2.20" _schema = { "definitions": {}, "properties": {"project": {"description...
ValidateDeleteRequest
python
django__django
tests/sessions_tests/tests.py
{ "start": 37005, "end": 38664 }
class ____(SessionTestsMixin, SimpleTestCase): backend = CacheSession # Some backends might issue a warning @ignore_warnings(module="django.core.cache.backends.base") def test_load_overlong_key(self): self.session._session_key = (string.ascii_letters + string.digits) * 20 self.assertEqu...
CacheSessionTests
python
pypa__setuptools
setuptools/command/editable_wheel.py
{ "start": 15765, "end": 16138 }
class ____(Protocol): def __call__( self, wheel: WheelFile, files: list[str], mapping: Mapping[str, str] ) -> object: ... def __enter__(self) -> Self: ... def __exit__( self, _exc_type: type[BaseException] | None, _exc_value: BaseException | None, _traceback: Trac...
EditableStrategy
python
walkccc__LeetCode
solutions/2907. Maximum Profitable Triplets With Increasing Prices I/2907.py
{ "start": 0, "end": 446 }
class ____: def __init__(self, n: int): self.vals = [0] * (n + 1) def maximize(self, i: int, val: int) -> None: while i < len(self.vals): self.vals[i] = max(self.vals[i], val) i += FenwickTree.lowbit(i) def get(self, i: int) -> int: res = 0 while i > 0: res = max(res, self.vals...
FenwickTree
python
Textualize__textual
tests/test_binding_inheritance.py
{ "start": 18315, "end": 18888 }
class ____(Screen): """A screen that binds keys, including movement keys.""" BINDINGS = AppKeyRecorder.make_bindings("screen_") async def action_screen_record(self, key: str) -> None: # Sneaky forward reference. Just for the purposes of testing. await self.app.action_record(f"screenly_{key...
ScreenWithMovementBindingsNoInheritEmptyChild
python
huggingface__transformers
src/transformers/models/patchtst/modeling_patchtst.py
{ "start": 62941, "end": 67770 }
class ____(nn.Module): def __init__(self, config: PatchTSTConfig, num_patches: int, distribution_output=None): r""" num_patches (`int`): The number of patches in the input sequence. distribution_output (`DistributionOutput`, *optional*): The distribution output layer ...
PatchTSTPredictionHead
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 102560, "end": 102857 }
class ____(sgqlc.types.Enum): """Properties by which GitHub Sponsors activity connections can be ordered. Enumeration Choices: * `TIMESTAMP`: Order activities by when they happened. """ __schema__ = github_schema __choices__ = ("TIMESTAMP",)
SponsorsActivityOrderField
python
django__django
django/template/defaulttags.py
{ "start": 11203, "end": 11860 }
class ____(Node): def __init__(self, count, method, common): self.count = count self.method = method self.common = common def render(self, context): try: count = int(self.count.resolve(context)) except (ValueError, TypeError): count = 1 if...
LoremNode
python
pypa__warehouse
warehouse/manage/views/oidc_publishers.py
{ "start": 1329, "end": 29746 }
class ____: def __init__(self, project, request): self.request = request self.project = project self.metrics = self.request.find_service(IMetricsService, context=None) self.github_publisher_form = GitHubPublisherForm( self.request.POST, api_token=self.request....
ManageOIDCPublisherViews
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_slots/SLOT000.py
{ "start": 111, "end": 166 }
class ____(str, Enum): # Ok __slots__ = ["foo"]
Fine
python
PrefectHQ__prefect
src/integrations/prefect-kubernetes/prefect_kubernetes/_logging.py
{ "start": 180, "end": 1801 }
class ____(JsonFormatter): """ Log formatter for kopf objects. This formatter will filter unserializable fields from the log record, which the `prefect` JSON formatter is unable to do. """ def __init__( self, *args: Any, refkey: Optional[str] = None, **kwargs: A...
KopfObjectJsonFormatter
python
getsentry__sentry
src/sentry/migrations/0941_create_temporary_verification_code_table.py
{ "start": 358, "end": 2899 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 123944, "end": 124455 }
class ____(sgqlc.types.Input): """Autogenerated input type of AbortQueuedMigrations""" __schema__ = github_schema __field_names__ = ("owner_id", "client_mutation_id") owner_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="ownerId") """The ID of the organization that is running the mig...
AbortQueuedMigrationsInput
python
python-openxml__python-docx
src/docx/image/bmp.py
{ "start": 119, "end": 1347 }
class ____(BaseImageHeader): """Image header parser for BMP images.""" @classmethod def from_stream(cls, stream): """Return |Bmp| instance having header properties parsed from the BMP image in `stream`.""" stream_rdr = StreamReader(stream, LITTLE_ENDIAN) px_width = stream_r...
Bmp
python
walkccc__LeetCode
solutions/3091. Apply Operations to Make Sum of Array Greater Than or Equal to k/3091-2.py
{ "start": 0, "end": 564 }
class ____: def minOperations(self, k: int) -> int: # The required operations are # 1. Increase `1` to `x` # 2. Duplicate `x`, `y` times, to `sum` s.t. x * (1 + y) >= k. # The number of operations used would be (x - 1) + y. Equivalently, the # problem can be rephrased as finding min(x - 1 + y)...
Solution
python
django__django
tests/queries/tests.py
{ "start": 141877, "end": 142807 }
class ____(SimpleTestCase): def test_invalid_order_by(self): msg = "Cannot resolve keyword '*' into field. Choices are: created, id, name" with self.assertRaisesMessage(FieldError, msg): Article.objects.order_by("*") def test_invalid_order_by_raw_column_alias(self): msg = ( ...
QuerySetExceptionTests
python
keras-team__keras
keras/src/layers/convolutional/depthwise_conv_test.py
{ "start": 5525, "end": 10920 }
class ____(testing.TestCase): @parameterized.parameters( { "depth_multiplier": 5, "kernel_size": 2, "strides": 1, "padding": "valid", "data_format": "channels_last", "dilation_rate": 1, "input_shape": (3, 5, 4), ...
DepthwiseConvBasicTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 543956, "end": 544435 }
class ____(sgqlc.types.Type): """Autogenerated return type of CreateSponsorship""" __schema__ = github_schema __field_names__ = ("client_mutation_id", "sponsorship") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the client performing the ...
CreateSponsorshipPayload
python
tensorflow__tensorflow
tensorflow/python/distribute/test_util_test.py
{ "start": 2606, "end": 3124 }
class ____(test.TestCase): def testLogicalCPUs(self): # TODO(b/273484131): Causing segmentation fault. if (test.is_gpu_available() and sys.version_info.major == 3 and sys.version_info.minor == 8): self.skipTest('Causing segmentation fault in Python 3.8 / GPU') context._reset_context() t...
LogicalDevicesTest
python
pandas-dev__pandas
pandas/tests/frame/test_query_eval.py
{ "start": 47405, "end": 62080 }
class ____: @pytest.fixture def df(self): """ Yields a dataframe with strings that may or may not need escaping by backticks. The last two columns cannot be escaped by backticks and should raise a ValueError. """ return DataFrame( { "A"...
TestDataFrameQueryBacktickQuoting
python
PrefectHQ__prefect
tests/server/orchestration/test_core_policy.py
{ "start": 56805, "end": 97827 }
class ____: async def create_concurrency_limit(self, session, tag, limit): cl_create = actions.ConcurrencyLimitCreate( tag=tag, concurrency_limit=limit, ).model_dump(mode="json") cl_model = schemas.core.ConcurrencyLimit(**cl_create) await concurrency_limits....
TestTaskConcurrencyLimits
python
numba__numba
numba/tests/test_serialize.py
{ "start": 8053, "end": 9652 }
class ____(TestCase): """This test case includes issues specific to the cloudpickle implementation. """ _numba_parallel_test_ = False def test_dynamic_class_reset_on_unpickle(self): # a dynamic class class Klass: classvar = None def mutator(): Klass.clas...
TestCloudPickleIssues
python
pytest-dev__pytest
src/_pytest/doctest.py
{ "start": 4903, "end": 7489 }
class ____(Exception): def __init__(self, failures: Sequence[doctest.DocTestFailure]) -> None: super().__init__() self.failures = failures def _init_runner_class() -> type[doctest.DocTestRunner]: import doctest class PytestDoctestRunner(doctest.DebugRunner): """Runner to collect f...
MultipleDoctestFailures
python
walkccc__LeetCode
solutions/1120. Maximum Average Subtree/1120.py
{ "start": 114, "end": 622 }
class ____: def maximumAverageSubtree(self, root: TreeNode | None) -> float: def maximumAverage(root: TreeNode | None) -> T: if not root: return T(0, 0, 0) left = maximumAverage(root.left) right = maximumAverage(root.right) summ = root.val + left.summ + right.summ count = 1...
Solution
python
run-llama__llama_index
llama-index-integrations/llms/llama-index-llms-mlx/llama_index/llms/mlx/tokenizer_utils.py
{ "start": 7162, "end": 10065 }
class ____: """ A wrapper that combines an HF tokenizer and a detokenizer. Accessing any attribute other than the ``detokenizer`` is forwarded to the huggingface tokenizer. """ def __init__(self, tokenizer, detokenizer_class=NaiveStreamingDetokenizer) -> None: self._tokenizer = tokeniz...
TokenizerWrapper
python
patrick-kidger__equinox
equinox/nn/_pool.py
{ "start": 262, "end": 5880 }
class ____(Module): """General N-dimensional downsampling over a sliding window.""" init: int | float | Array operation: Callable[[Array, Array], Array] num_spatial_dims: int = field(static=True) kernel_size: tuple[int, ...] = field(static=True) stride: tuple[int, ...] = field(static=True) ...
Pool
python
encode__django-rest-framework
tests/test_utils.py
{ "start": 993, "end": 2134 }
class ____(ModelViewSet): serializer_class = ModelSerializer queryset = BasicModel.objects.all() @action(detail=False) def list_action(self, request, *args, **kwargs): raise NotImplementedError @action(detail=True) def detail_action(self, request, *args, **kwargs): raise NotImp...
ResourceViewSet
python
doocs__leetcode
solution/1600-1699/1638.Count Substrings That Differ by One Character/Solution2.py
{ "start": 0, "end": 642 }
class ____: def countSubstrings(self, s: str, t: str) -> int: ans = 0 m, n = len(s), len(t) f = [[0] * (n + 1) for _ in range(m + 1)] g = [[0] * (n + 1) for _ in range(m + 1)] for i, a in enumerate(s, 1): for j, b in enumerate(t, 1): if a == b: ...
Solution
python
milvus-io__pymilvus
pymilvus/client/types.py
{ "start": 3890, "end": 4084 }
class ____(IntEnum): LT = 0 # less than LTE = 1 # less than or equal EQ = 2 # equal GT = 3 # greater than GTE = 4 # greater than or equal NE = 5 # not equal
RangeType
python
networkx__networkx
networkx/linalg/tests/test_modularity.py
{ "start": 103, "end": 3056 }
class ____: @classmethod def setup_class(cls): deg = [3, 2, 2, 1, 0] cls.G = nx.havel_hakimi_graph(deg) # Graph used as an example in Sec. 4.1 of Langville and Meyer, # "Google's PageRank and Beyond". (Used for test_directed_laplacian) cls.DG = nx.DiGraph() cls.DG...
TestModularity
python
ray-project__ray
python/ray/tune/tests/test_trial_scheduler_resource_changing.py
{ "start": 535, "end": 679 }
class ____(TuneController): def get_live_trials(self): return [t for t in self._trials if t.status != "TERMINATED"]
MockTuneController
python
altair-viz__altair
tools/schemapi/codegen.py
{ "start": 990, "end": 1191 }
class ____: """Object whose repr() is a string of code.""" def __init__(self, code: str): self.code = code def __repr__(self) -> str: return self.code @dataclass
CodeSnippet
python
ethereum__web3.py
tests/integration/go_ethereum/test_goethereum_http.py
{ "start": 3412, "end": 3483 }
class ____(GoEthereumNetModuleTest): pass
TestGoEthereumNetModuleTest
python
python-pillow__Pillow
src/PIL/ImageOps.py
{ "start": 14231, "end": 25567 }
class ____(Protocol): """ An object that supports the ``getmesh`` method, taking an image as an argument, and returning a list of tuples. Each tuple contains two tuples, the source box as a tuple of 4 integers, and a tuple of 8 integers for the final quadrilateral, in order of top left, bottom left,...
SupportsGetMesh
python
google__jax
jax/_src/test_util.py
{ "start": 42030, "end": 42985 }
class ____: def __repr__(self): return "<not present>" @contextmanager def assert_global_configs_unchanged(): starting_cache = compilation_cache._cache starting_config = config.config.values.copy() yield ending_config = config.config.values ending_cache = compilation_cache._cache if starting_config...
NotPresent
python
pytorch__pytorch
test/test_autograd.py
{ "start": 505424, "end": 521541 }
class ____(TestCase): def _run_py_multithread_fn( self, fn, args=(), num_threads=10, kwargs=None, pass_idx=False ): class PropagatingThread(threading.Thread): """Helper class to propagate exception from child thread to main thread on join. Reference: https://...
TestMultithreadAutograd
python
google__jax
jax/_src/debugger/colab_lib.py
{ "start": 2504, "end": 4298 }
class ____(DOMElement): """An immutable DOM element.""" _uuid: str = dataclasses.field(init=False) name: str children: list[str | DOMElement] attrs: dict[str, str] def html(self): attr_str = "" if self.attrs: attr_str = " " + (" ".join( [f"{key}=\"{value}\"" for key, value in self.a...
StaticDOMElement
python
psf__black
tests/data/cases/class_methods_new_line.py
{ "start": 288, "end": 371 }
class ____: cls_var = 100 def __init__(self): pass
ClassWithInitAndVars
python
dagster-io__dagster
python_modules/dagster/dagster/_daemon/daemon.py
{ "start": 8282, "end": 9776 }
class ____(DagsterDaemon[TContext], ABC): def __init__( self, interval_seconds, *, interval_jitter_seconds: float = 0, startup_jitter_seconds: float = 0, ): self.interval_seconds = check.numeric_param(interval_seconds, "interval_seconds") self.interval_jit...
IntervalDaemon
python
getsentry__sentry
tests/sentry/backup/test_imports.py
{ "start": 3565, "end": 3862 }
class ____(BackupTransactionTestCase): def export_to_tmp_file_and_clear_database(self, tmp_dir) -> Path: tmp_path = Path(tmp_dir).joinpath(f"{self._testMethodName}.json") export_to_file(tmp_path, ExportScope.Global) clear_database() return tmp_path
ImportTestCase
python
pytorch__pytorch
torch/onnx/_internal/exporter/_verification.py
{ "start": 8395, "end": 12502 }
class ____(torch.fx.Interpreter): """Interpreter for verifying converted ONNX model accuracy by comparing intermediate values. To compare models, first initialize the interpreter with an ONNX program. Then, call the :meth:`run` method with the input arguments to execute the model. The :meth:`run` metho...
_VerificationInterpreter
python
ray-project__ray
python/ray/data/tests/unit/test_datatype.py
{ "start": 5603, "end": 8755 }
class ____: """Test type conversion methods.""" def test_to_arrow_dtype_arrow_passthrough(self): """Test that Arrow types return themselves.""" dt = DataType.from_arrow(pa.int64()) result = dt.to_arrow_dtype() assert result == pa.int64() def test_to_arrow_dtype_numpy_conver...
TestDataTypeConversions
python
pallets__werkzeug
src/werkzeug/datastructures/accept.py
{ "start": 11774, "end": 12177 }
class ____(Accept): """Like :class:`Accept` but with normalization for charsets.""" def _value_matches(self, value: str, item: str) -> bool: def _normalize(name: str) -> str: try: return codecs.lookup(name).name except LookupError: return name.low...
CharsetAccept
python
HypothesisWorks__hypothesis
hypothesis-python/tests/conjecture/test_provider.py
{ "start": 21413, "end": 22355 }
class ____(TrivialProvider): def __init__(self, conjecturedata): super().__init__(conjecturedata) self.n = 0 def draw_integer(self, **constraints): self.n += 1 if self.n == 1: return 1 raise BackendCannotProceed("verified") def test_raising_verified_after_...
SoundnessTestProvider
python
getsentry__sentry
tests/sentry/models/test_apigrant.py
{ "start": 217, "end": 833 }
class ____(TestCase): def setUp(self) -> None: self.user = self.create_user() self.application = ApiApplication.objects.create( owner=self.user, redirect_uris="https://example.com" ) self.grant = ApiGrant.objects.create( user=self.user, application=self.applic...
ApiGrantTest
python
pandas-dev__pandas
asv_bench/benchmarks/arithmetic.py
{ "start": 430, "end": 1182 }
class ____: params = [ [np.float64, np.int64], [2, 3.0, np.int32(4), np.float64(5)], [ operator.add, operator.sub, operator.mul, operator.truediv, operator.floordiv, operator.pow, operator.mod, op...
IntFrameWithScalar
python
pennersr__django-allauth
tests/apps/socialaccount/providers/reddit/tests.py
{ "start": 240, "end": 578 }
class ____(OAuth2TestsMixin, TestCase): provider_id = RedditProvider.id def get_mocked_response(self): return [ MockedResponse( HTTPStatus.OK, """{ "name": "wayward710"}""", ) ] def get_expected_to_str(self): return "w...
RedditTests
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1587073, "end": 1587208 }
class ____(sgqlc.types.Union): """Users and teams.""" __schema__ = github_schema __types__ = (Team, User)
DeploymentReviewer
python
great-expectations__great_expectations
tests/scripts/test_public_api_report.py
{ "start": 10283, "end": 11670 }
class ____: def test_get_all_public_api_definitions(self, public_api_checker: PublicAPIChecker): observed = public_api_checker.get_all_public_api_definitions() assert len(observed) == 6 assert {d.name for d in observed} == { "ExamplePublicAPIClass", "example_multiple_...
TestPublicAPIChecker
python
urllib3__urllib3
test/test_retry.py
{ "start": 372, "end": 16767 }
class ____: def test_string(self) -> None: """Retry string representation looks the way we expect""" retry = Retry() assert ( str(retry) == "Retry(total=10, connect=None, read=None, redirect=None, status=None)" ) for _ in range(3): retry = ...
TestRetry
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/exc.py
{ "start": 12976, "end": 13580 }
class ____: """A mixin class which, when applied to a user-defined Exception class, will not be wrapped inside of :exc:`.StatementError` if the error is emitted within the process of executing a statement. E.g.:: from sqlalchemy.exc import DontWrapMixin class MyCustomException(Except...
DontWrapMixin
python
allegroai__clearml
clearml/backend_api/services/v2_13/models.py
{ "start": 83012, "end": 83880 }
class ____(Request): """ Gets model information :param model: Model id :type model: str """ _service = "models" _action = "get_by_id" _version = "2.13" _schema = { "definitions": {}, "properties": {"model": {"description": "Model id", "type": "string"}}, "re...
GetByIdRequest
python
doocs__leetcode
solution/2700-2799/2780.Minimum Index of a Valid Split/Solution.py
{ "start": 0, "end": 340 }
class ____: def minimumIndex(self, nums: List[int]) -> int: x, cnt = Counter(nums).most_common(1)[0] cur = 0 for i, v in enumerate(nums, 1): if v == x: cur += 1 if cur * 2 > i and (cnt - cur) * 2 > len(nums) - i: return i - 1 ...
Solution
python
joke2k__faker
tests/providers/test_address.py
{ "start": 36522, "end": 37337 }
class ____: """Test fa_IR address provider methods""" def test_city_prefix(self, faker, num_samples): for _ in range(num_samples): city_prefix = faker.city_prefix() assert isinstance(city_prefix, str) assert city_prefix in FaIrAddressProvider.city_prefixes def t...
TestFaIr
python
spyder-ide__spyder
spyder/api/utils.py
{ "start": 680, "end": 1399 }
class ____: """Utility class used to represent a prefixed string tuple.""" def __init__(self, path=None): self.children = {} self.path = path def __iter__(self): prefix = [((self.path,), self)] while prefix != []: current_prefix, node = prefix.pop(0) ...
PrefixNode