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
ray-project__ray
python/ray/air/util/tensor_extensions/arrow.py
{ "start": 25712, "end": 36832 }
class ____(pa.ExtensionArray): """ An array of fixed-shape, homogeneous-typed tensors. This is the Arrow side of TensorArray. See Arrow docs for customizing extension arrays: https://arrow.apache.org/docs/python/extending_types.html#custom-extension-array-class """ @classmethod def fr...
ArrowTensorArray
python
google__pytype
pytype/pyi/parser_test.py
{ "start": 95229, "end": 96413 }
class ____(parser_test_base.ParserTestBase): def test_starargs(self): self.check( """ from typing_extensions import TypeVarTuple, Unpack _Ts = TypeVarTuple('_Ts') def f(*args: Unpack[_Ts]): ... """, """ from typing import Any from typing_extensions import TypeVar...
UnpackTest
python
apache__airflow
providers/apache/livy/tests/unit/apache/livy/hooks/test_livy.py
{ "start": 2119, "end": 20359 }
class ____: @classmethod def setup_class(cls): clear_test_connections(add_default_connections_back=False) @classmethod def teardown_class(cls): clear_test_connections(add_default_connections_back=True) # TODO: Potential performance issue, converted setup_class to a setup_connection...
TestLivyDbHook
python
facelessuser__pymdown-extensions
tests/test_extensions/test_superfences.py
{ "start": 5507, "end": 6342 }
class ____(util.MdCase): """Test highlight line wraps.""" extension = ['pymdownx.highlight', 'pymdownx.superfences'] extension_configs = { 'pymdownx.highlight': { 'line_spans': '__my_span', 'linenums_style': 'inline' } } def test_linespans(self): """...
TestHighlightLineWrapsInline
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 374707, "end": 375071 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("client_mutation_id", "column_edge") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") column_edge = sgqlc.types.Field("ProjectColumnEdge", graph...
MoveProjectColumnPayload
python
walkccc__LeetCode
solutions/2297. Jump Game IX/2297.py
{ "start": 0, "end": 531 }
class ____: def minCost(self, nums: list[int], costs: list[int]) -> int: # dp[i] := the minimum cost to jump to i dp = [math.inf] * len(nums) maxStack = [] minStack = [] dp[0] = 0 for i, num in enumerate(nums): while maxStack and num >= nums[maxStack[-1]]: dp[i] = min(dp[i], dp...
Solution
python
sqlalchemy__sqlalchemy
test/orm/inheritance/test_basic.py
{ "start": 40330, "end": 42571 }
class ____(fixtures.MappedTest): """tests eager load/lazy load of child items off inheritance mappers, tests that LazyLoader constructs the right query condition.""" @classmethod def define_tables(cls, metadata): Table( "foo", metadata, Column( ...
EagerLazyTest
python
pypa__pip
src/pip/_vendor/distlib/util.py
{ "start": 14846, "end": 16281 }
class ____(object): def __init__(self, func): self.func = func # for attr in ('__name__', '__module__', '__doc__'): # setattr(self, attr, getattr(func, attr, None)) def __get__(self, obj, cls=None): if obj is None: return self value = self.func(obj) ...
cached_property
python
ansible__ansible
test/lib/ansible_test/_internal/commands/integration/filters.py
{ "start": 9777, "end": 12039 }
class ____(PosixTargetFilter[OriginConfig]): """Target filter for localhost.""" def filter_targets(self, targets: list[IntegrationTarget], exclude: set[str]) -> None: """Filter the list of targets, adding any which this host profile cannot support to the provided exclude list.""" super().filter...
OriginTargetFilter
python
huggingface__transformers
src/transformers/models/chameleon/processing_chameleon.py
{ "start": 1114, "end": 1476 }
class ____(ProcessingKwargs, total=False): text_kwargs: ChameleonTextKwargs _defaults = { "text_kwargs": { "padding": False, "return_for_text_completion": False, "return_mm_token_type_ids": False, }, "common_kwargs": { "return_tensors": "pt...
ChameleonProcessorKwargs
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/dml.py
{ "start": 55205, "end": 57923 }
class ____: table: _DMLTableElement _where_criteria: Tuple[ColumnElement[Any], ...] = () _post_criteria_clause: Optional[ClauseElement] = None """used by extensions to Update/Delete etc. to add additional syntacitcal constructs, e.g. LIMIT etc. .. versionadded:: 2.1 """ # can't put p...
DMLWhereBase
python
falconry__falcon
tests/test_middleware.py
{ "start": 4692, "end": 4842 }
class ____: def setup_method(self, method): # Clear context global context context = {'executed_methods': []}
TestMiddleware
python
networkx__networkx
networkx/utils/configs.py
{ "start": 168, "end": 7370 }
class ____: """The base class for NetworkX configuration. There are two ways to use this to create configurations. The recommended way is to subclass ``Config`` with docs and annotations. >>> class MyConfig(Config): ... '''Breakfast!''' ... ... eggs: int ... spam: int ....
Config
python
allegroai__clearml
clearml/binding/environ_bind.py
{ "start": 3389, "end": 11890 }
class ____(object): _original_fork = None _registered_fork_callbacks = False _current_task = None _original_process_run = None @classmethod def patch_fork(cls, task: "Task") -> None: cls._current_task = task if not task: return # first we need to patch regul...
PatchOsFork
python
lepture__authlib
authlib/jose/rfc7515/jws.py
{ "start": 731, "end": 13717 }
class ____: #: Registered Header Parameter Names defined by Section 4.1 REGISTERED_HEADER_PARAMETER_NAMES = frozenset( [ "alg", "jku", "jwk", "kid", "x5u", "x5c", "x5t", "x5t#S256", "typ", ...
JsonWebSignature
python
getsentry__sentry-python
sentry_sdk/consts.py
{ "start": 23797, "end": 24547 }
class ____: """ The status of a Sentry span. See: https://develop.sentry.dev/sdk/event-payloads/contexts/#trace-context """ ABORTED = "aborted" ALREADY_EXISTS = "already_exists" CANCELLED = "cancelled" DATA_LOSS = "data_loss" DEADLINE_EXCEEDED = "deadline_exceeded" FAILED_PRECO...
SPANSTATUS
python
django-import-export__django-import-export
tests/core/models.py
{ "start": 4437, "end": 4568 }
class ____(Book): """Book proxy model to have a separate admin url access and name""" class Meta: proxy = True
EBook
python
huggingface__transformers
src/transformers/models/aya_vision/modeling_aya_vision.py
{ "start": 1738, "end": 3950 }
class ____(nn.Module): def __init__(self, config: AyaVisionConfig): super().__init__() self.config = config self.downsample_factor = config.downsample_factor self.alignment_intermediate_size = getattr( config, "alignment_intermediate_size", config.text_config.hidden_size ...
AyaVisionMultiModalProjector
python
networkx__networkx
networkx/readwrite/graphml.py
{ "start": 12942, "end": 15527 }
class ____: NS_GRAPHML = "http://graphml.graphdrawing.org/xmlns" NS_XSI = "http://www.w3.org/2001/XMLSchema-instance" # xmlns:y="http://www.yworks.com/xml/graphml" NS_Y = "http://www.yworks.com/xml/graphml" SCHEMALOCATION = " ".join( [ "http://graphml.graphdrawing.org/xmlns", ...
GraphML
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/methodOverride3.py
{ "start": 1999, "end": 2226 }
class ____(G1[[], str]): # This should generate an error because the specialized # signature of f in the base class has no positional parameters. def f(self, a: int, b: int) -> str: ... def g(self) -> str: ...
G5
python
numpy__numpy
numpy/_core/tests/test_dtype.py
{ "start": 24148, "end": 32048 }
class ____: def test_single_subarray(self): a = np.dtype((int, (2))) b = np.dtype((int, (2,))) assert_dtype_equal(a, b) assert_equal(type(a.subdtype[1]), tuple) assert_equal(type(b.subdtype[1]), tuple) def test_equivalent_record(self): """Test whether equivalent...
TestSubarray
python
scipy__scipy
scipy/stats/_distn_infrastructure.py
{ "start": 147046, "end": 153570 }
class ____(rv_discrete): """A 'sample' discrete distribution defined by the support and values. The ctor ignores most of the arguments, only needs the `values` argument. """ def __init__(self, a=0, b=inf, name=None, badvalue=None, moment_tol=1e-8, values=None, inc=1, longname=None, ...
rv_sample
python
huggingface__transformers
src/transformers/models/voxtral/modeling_voxtral.py
{ "start": 9046, "end": 9614 }
class ____(PreTrainedModel): config: VoxtralConfig base_model_prefix = "model" input_modalities = ("audio", "text") supports_gradient_checkpointing = True _no_split_modules = None _skip_keys_device_placement = "past_key_values" _supports_flash_attn = True _supports_sdpa = True _suppo...
VoxtralPreTrainedModel
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/memberAccess22.py
{ "start": 224, "end": 358 }
class ____: @classmethod def method1(cls) -> None: cls.method2 @contextmanager def method2(self): yield
A
python
ray-project__ray
python/ray/data/tests/test_arrow_serialization.py
{ "start": 19358, "end": 20796 }
class ____(pa.ExtensionType): def __init__( self, value_type: pa.DataType, ndim: int, ) -> None: self.value_type = value_type self.ndim = ndim super().__init__( pa.struct( [ pa.field("data", pa.list_(value_type)), ...
_VariableShapeTensorType
python
numpy__numpy
numpy/ma/core.py
{ "start": 78959, "end": 82068 }
class ____: """ Flat iterator object to iterate over masked arrays. A `MaskedIterator` iterator is returned by ``x.flat`` for any masked array `x`. It allows iterating over the array as if it were a 1-D array, either in a for-loop or by calling its `next` method. Iteration is done in C-contigu...
MaskedIterator
python
pytorch__pytorch
test/inductor/test_remote_cache.py
{ "start": 618, "end": 872 }
class ____(RemoteCache): def __init__(self): super().__init__(FailingBackend(), RemoteCachePassthroughSerde()) def _create_sample(self): return TestSample() def _log_sample(self, sample): self.sample = sample
FakeCache
python
huggingface__transformers
src/transformers/models/aria/modular_aria.py
{ "start": 54583, "end": 54918 }
class ____(LlamaModel): def __init__(self, config: AriaTextConfig): super().__init__(config) self.layers = nn.ModuleList( [AriaTextDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)] ) self.gradient_checkpointing = False self.post_ini...
AriaTextModel
python
apache__airflow
providers/google/src/airflow/providers/google/firebase/operators/firestore.py
{ "start": 1248, "end": 3938 }
class ____(BaseOperator): """ Export documents from Google Cloud Firestore to another storage system, such as Google Cloud Storage. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudFirestoreExportDatabaseOperator` :param...
CloudFirestoreExportDatabaseOperator
python
sympy__sympy
sympy/physics/quantum/spin.py
{ "start": 48954, "end": 49777 }
class ____(CoupledSpinState, Ket): """Coupled eigenket of Jx. See JzKetCoupled for the usage of coupled spin eigenstates. See Also ======== JzKetCoupled: Usage of coupled spin states """ @classmethod def dual_class(self): return JxBraCoupled @classmethod def uncoupl...
JxKetCoupled
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/totalOrdering1.py
{ "start": 118, "end": 413 }
class ____: val1: int def __gt__(self, other: object) -> bool: ... a = ClassA() b = ClassA() v1 = a < b v2 = a <= b v3 = a > b v4 = a >= b v5 = a == b v6 = a != b # This should generate an error because it doesn't declare # any of the required ordering functions. @total_ordering
ClassA
python
pytorch__pytorch
test/torch_np/numpy_tests/linalg/test_linalg.py
{ "start": 64964, "end": 66424 }
class ____(TestCase): # TODO: are there no other tests for cholesky? @parametrize("shape", [(1, 1), (2, 2), (3, 3), (50, 50), (3, 10, 10)]) @parametrize("dtype", (np.float32, np.float64, np.complex64, np.complex128)) def test_basic_property(self, shape, dtype): # Check A = L L^H np.rand...
TestCholesky
python
keon__algorithms
algorithms/graph/tarjan.py
{ "start": 265, "end": 2408 }
class ____: """ A directed graph used for finding strongly connected components """ def __init__(self, dict_graph): self.graph = DirectedGraph(dict_graph) self.index = 0 self.stack = [] # Runs Tarjan # Set all node index to None for vertex in self.graph.n...
Tarjan
python
huggingface__transformers
src/transformers/models/esm/modeling_esmfold.py
{ "start": 7862, "end": 9511 }
class ____(nn.Linear): """ A Linear layer with built-in nonstandard initializations. Called just like torch.nn.Linear. Implements the initializers in 1.11.4, plus some additional ones found in the code. """ def __init__( self, in_dim: int, out_dim: int, bias: bool =...
EsmFoldLinear
python
graphql-python__graphene
graphene/tests/issues/test_313.py
{ "start": 140, "end": 207 }
class ____(graphene.ObjectType): yeah = graphene.String()
Success
python
ray-project__ray
rllib/utils/tests/test_checkpointable.py
{ "start": 227, "end": 3863 }
class ____(unittest.TestCase): """Tests the Checkpointable API.""" @classmethod def setUpClass(cls) -> None: ray.init() @classmethod def tearDownClass(cls) -> None: ray.shutdown() def test_checkpoint_backward_compatibility(self): """Tests backward compat. of checkpoint...
TestCheckpointable
python
ray-project__ray
python/ray/experimental/channel/conftest.py
{ "start": 2148, "end": 2266 }
class ____: def __init__(self): self.cuda_stream = 0 def synchronize(self): pass
MockCudaStream
python
allegroai__clearml
clearml/backend_api/services/v2_20/events.py
{ "start": 53989, "end": 54250 }
class ____(Response): """ Response of events.clear_scroll endpoint. """ _service = "events" _action = "clear_scroll" _version = "2.20" _schema = {"additionalProperties": False, "definitions": {}, "type": "object"}
ClearScrollResponse
python
getsentry__sentry
src/sentry/integrations/msteams/card_builder/utils.py
{ "start": 3835, "end": 5516 }
class ____: # NOTE: DATE and TIME are formatting functions in Adaptive Cards. # The syntax is `{{DATE(<some_date>, SHORT)}}` or `{{TIME(<some_date>)}}` # https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/text-features # Since `{` and `}` are special characters in format strings, we need to...
IssueConstants
python
pypa__hatch
tests/backend/version/scheme/test_standard.py
{ "start": 4537, "end": 5092 }
class ____: @pytest.mark.parametrize( ("operations", "expected"), [ ("patch,dev,release", "1!0.0.2"), ("fix,rc", "1!0.0.2rc0"), ("minor,dev", "1!0.1.0.dev0"), ("minor,preview", "1!0.1.0rc0"), ("major,beta", "1!1.0.0b0"), ("major...
TestWithEpoch
python
pytorch__pytorch
test/test_autocast.py
{ "start": 395, "end": 6534 }
class ____(TestAutocast): def setUp(self): super().setUp() self.autocast_lists = AutocastCPUTestLists(torch.device("cpu")) def tearDown(self): del self.autocast_lists super().tearDown() @skipIfTorchDynamo() def test_autocast_torch_expect_builtin_promote(self): f...
TestAutocastCPU
python
coleifer__peewee
tests/manytomany.py
{ "start": 452, "end": 570 }
class ____(TestModel): text = TextField() users = ManyToManyField(User, through_model=AltThroughDeferred)
AltNote
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/base.py
{ "start": 108158, "end": 108777 }
class ____(ReflectedNamedType): """Represents a reflected enum.""" type: str """The string name of the underlying data type of the domain.""" nullable: bool """Indicates if the domain allows null or not.""" default: Optional[str] """The string representation of the default value of this dom...
ReflectedDomain
python
mlflow__mlflow
tests/llama_index/sample_code/query_engine_with_reranker.py
{ "start": 625, "end": 1093 }
class ____(BaseNodePostprocessor): call_count: int = 0 def _postprocess_nodes( self, nodes: list[NodeWithScore], query_bundle: QueryBundle | None ) -> list[NodeWithScore]: # subtracts 1 from the score self.call_count += 1 return nodes query_engine = index.as_query_engine( ...
CustomNodePostprocessor
python
pdm-project__pdm
src/pdm/models/search.py
{ "start": 396, "end": 2305 }
class ____(HTMLParser): """A simple HTML parser for pypi.org search results.""" def __init__(self) -> None: super().__init__() self.results: list[SearchResult] = [] self._current: Result | None = None self._nest_anchors = 0 self._data_callback: Callable[[str], None] | No...
SearchResultParser
python
h5py__h5py
h5py/tests/test_group.py
{ "start": 33673, "end": 34595 }
class ____(TestCase): """ Bugs: Specific regressions for external links """ def test_issue_212(self): """ Issue 212 Fails with: AttributeError: 'SharedConfig' object has no attribute 'lapl' """ def closer(x): def w(): try: ...
TestExtLinkBugs
python
ansible__ansible
lib/ansible/plugins/action/pause.py
{ "start": 1039, "end": 5674 }
class ____(ActionBase): """ pauses execution for a length or time, or until input is received """ BYPASS_HOST_LOOP = True def run(self, tmp=None, task_vars=None): """ run the pause action module """ if task_vars is None: task_vars = dict() result = super(ActionModule, ...
ActionModule
python
python-attrs__attrs
src/attr/validators.py
{ "start": 16719, "end": 17871 }
class ____: type = attrib() def __call__(self, inst, attr, value): """ We use a callable class to be able to change the ``__repr__``. """ if not issubclass(value, self.type): msg = f"'{attr.name}' must be a subclass of {self.type!r} (got {value!r})." rais...
_SubclassOfValidator
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/memberAccess24.py
{ "start": 499, "end": 782 }
class ____(Any): y: Desc v1 = DerivesFromUnknown().x reveal_type(v1, expected_text="Unknown") v2 = DerivesFromAny().x reveal_type(v2, expected_text="Any") reveal_type(DerivesFromUnknown().y, expected_text="int") reveal_type(DerivesFromAny().y, expected_text="int")
DerivesFromAny
python
astropy__astropy
astropy/coordinates/builtin_frames/altaz.py
{ "start": 3590, "end": 5707 }
class ____(BaseCoordinateFrame): """ A coordinate or frame in the Altitude-Azimuth system (Horizontal coordinates) with respect to the WGS84 ellipsoid. Azimuth is oriented East of North (i.e., N=0, E=90 degrees). Altitude is also known as elevation angle, so this frame is also in the Azimuth-Eleva...
AltAz
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/methodOverride1.py
{ "start": 11953, "end": 12185 }
class ____(Base3): @overload def case(self, value: int) -> Iterable[int]: ... @overload def case(self, value: float) -> Iterable[float]: ... def case(self, value: Any) -> Iterable[Any]: return []
Derived3
python
psf__black
tests/data/miscellaneous/force_pyi.py
{ "start": 192, "end": 210 }
class ____: ... @hmm
C
python
numpy__numpy
numpy/_core/tests/test_function_base.py
{ "start": 1535, "end": 4115 }
class ____: def test_basic(self): y = logspace(0, 6) assert_(len(y) == 50) y = logspace(0, 6, num=100) assert_(y[-1] == 10 ** 6) y = logspace(0, 6, endpoint=False) assert_(y[-1] < 10 ** 6) y = logspace(0, 6, num=7) assert_array_equal(y, [1, 10, 100, 1...
TestLogspace
python
pytorch__pytorch
torch/distributed/checkpoint/_async_process_executor.py
{ "start": 1375, "end": 1678 }
class ____: staged_state_dict: STATE_DICT_TYPE checkpoint_request_id: _CheckpointRequestIdentifier storage_writer: Optional[StorageWriter] = None planner: Optional[SavePlanner] = None no_dist: bool = False use_collectives: bool = True @dataclass(init=False)
_AsyncCheckpointRequest
python
openai__openai-python
src/openai/types/shared/error_object.py
{ "start": 178, "end": 305 }
class ____(BaseModel): code: Optional[str] = None message: str param: Optional[str] = None type: str
ErrorObject
python
ijl__orjson
test/test_fixture.py
{ "start": 159, "end": 1532 }
class ____: def test_twitter(self): """ loads(),dumps() twitter.json """ val = read_fixture_str("twitter.json.xz") read = orjson.loads(val) assert orjson.loads(orjson.dumps(read)) == read @needs_data def test_canada(self): """ loads(), dumps()...
TestFixture
python
django__django
tests/utils_tests/test_choices.py
{ "start": 450, "end": 2019 }
class ____(SimpleTestCase): def test_not_implemented_error_on_missing_iter(self): class InvalidChoiceIterator(BaseChoiceIterator): pass # Not overriding __iter__(). msg = "BaseChoiceIterator subclasses must implement __iter__()." with self.assertRaisesMessage(NotImplementedErro...
ChoiceIteratorTests
python
getsentry__sentry
tests/sentry/issues/endpoints/test_project_codeowners_index.py
{ "start": 188, "end": 41683 }
class ____(APITestCase): def setUp(self) -> None: self.user = self.create_user("admin@sentry.io", is_superuser=True) self.login_as(user=self.user) self.team = self.create_team( organization=self.organization, slug="tiger-team", members=[self.user] ) self.projec...
ProjectCodeOwnersEndpointTestCase
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeVarDefaultClass3.py
{ "start": 665, "end": 704 }
class ____[T2 = T1, T1 = str]: ...
ClassC
python
django__django
tests/staticfiles_tests/test_storage.py
{ "start": 31414, "end": 33078 }
class ____(SimpleTestCase): def setUp(self): manifest_path = Path(tempfile.mkdtemp()) self.addCleanup(shutil.rmtree, manifest_path) self.staticfiles_storage = CustomManifestStorage( manifest_location=manifest_path, ) self.manifest_file = manifest_path / self.stat...
TestCustomManifestStorage
python
pytorch__pytorch
test/torch_np/test_function_base.py
{ "start": 449, "end": 1054 }
class ____(TestCase): # tests taken from np.append docstring def test_basic(self): result = np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) assert_equal(result, np.arange(1, 10, dtype=int)) # When `axis` is specified, `values` must have the correct shape. result = np.append([[1, 2,...
TestAppend
python
geekcomputers__Python
BlackJack_game/blackjack_rr.py
{ "start": 1305, "end": 1730 }
class ____: def __init__(self): self.cards = [] self.value = 0 self.aces = 0 # to keep track of aces def add_card(self, card): self.cards.append(card) self.value += values[card.rank] if card.rank == "Ace": self.aces += 1 def adjust_for_ace(self)...
Hand
python
django__django
django/contrib/postgres/operations.py
{ "start": 11193, "end": 12617 }
class ____(Operation): """Validate a table NOT VALID constraint.""" category = OperationCategory.ALTERATION def __init__(self, model_name, name): self.model_name = model_name self.name = name def describe(self): return "Validate constraint %s on model %s" % (self.name, self.mo...
ValidateConstraint
python
google__jax
tests/absl_cpp_logging_test.py
{ "start": 958, "end": 1544 }
class ____(jtu.JaxTestCase): @unittest.skipIf(jaxlib.version <= (0, 7, 2), "absl_set_vlog_level is broken") def test_vlogging(self): utils.absl_set_min_log_level(0) # INFO with jtu.capture_stderr() as stderr: jax.jit(lambda x: x + 1)(1) self.assertNotIn("hlo_pass_pipeline.cc", stderr()) with...
AbslCppLoggingTest
python
pytorch__pytorch
test/inductor/test_codecache.py
{ "start": 3659, "end": 7431 }
class ____(TestCase): def test_linemaps_empty(self): src = """import torch""" (key, path) = PyCodeCache.write(src, "") # Load with an empty linemap PyCodeCache.load_by_key_path(key, path, linemap=[]) stack_frames = PyCodeCache.stack_frames_for_code(path, 0) self.asser...
TestPyCodeCache
python
scrapy__scrapy
tests/test_spidermiddleware_referer.py
{ "start": 35810, "end": 36863 }
class ____(TestReferrerOnRedirect): """ No Referrer policy never sets the "Referer" header. HTTP redirections should not change that. """ settings = {"REFERRER_POLICY": "no-referrer"} scenarii = [ ( "http://scrapytest.org/1", # parent "http://scrapytest.org/2", ...
TestReferrerOnRedirectNoReferrer
python
pennersr__django-allauth
allauth/socialaccount/providers/figma/provider.py
{ "start": 436, "end": 1049 }
class ____(OAuth2Provider): id = "figma" name = "Figma" account_class = FigmaAccount oauth2_adapter_class = FigmaOAuth2Adapter def extract_uid(self, data): return str(data["id"]) def extract_common_fields(self, data): return { "email": data.get("email"), ...
FigmaProvider
python
numpy__numpy
numpy/_core/tests/test_unicode.py
{ "start": 4991, "end": 5146 }
class ____(CreateValues): """Check the creation of valued arrays (size 1, UCS2 values)""" ulen = 1 ucs_value = ucs2_value
TestCreateValues_1_UCS2
python
django__django
tests/string_lookup/tests.py
{ "start": 93, "end": 2447 }
class ____(TestCase): def test_string_form_referencing(self): """ Regression test for #1661 and #1662 String form referencing of models works, both as pre and post reference, on all RelatedField types. """ f1 = Foo(name="Foo1") f1.save() f2 = Foo(nam...
StringLookupTests
python
dagster-io__dagster
python_modules/dagster/dagster/_core/remote_representation/external_data.py
{ "start": 12281, "end": 12444 }
class ____: job_name: str mode: str op_selection: Optional[Sequence[str]] @whitelist_for_serdes(storage_name="ExternalSensorMetadata") @record
TargetSnap
python
facebookresearch__faiss
benchs/bench_fw/optimize.py
{ "start": 648, "end": 11349 }
class ____: distance_metric: str = "L2" num_threads: int = 32 run_local: bool = True def __post_init__(self): self.cached_benchmark = None if self.distance_metric == "IP": self.distance_metric_type = faiss.METRIC_INNER_PRODUCT elif self.distance_metric == "L2": ...
Optimizer
python
pypa__pip
src/pip/_vendor/rich/terminal_theme.py
{ "start": 149, "end": 3370 }
class ____: """A color theme used when exporting console content. Args: background (Tuple[int, int, int]): The background color. foreground (Tuple[int, int, int]): The foreground (text) color. normal (List[Tuple[int, int, int]]): A list of 8 normal intensity colors. bright (List...
TerminalTheme
python
sympy__sympy
sympy/functions/elementary/exponential.py
{ "start": 36790, "end": 42582 }
class ____(DefinedFunction): r""" The Lambert W function $W(z)$ is defined as the inverse function of $w \exp(w)$ [1]_. Explanation =========== In other words, the value of $W(z)$ is such that $z = W(z) \exp(W(z))$ for any complex number $z$. The Lambert W function is a multivalued fu...
LambertW
python
pennersr__django-allauth
tests/apps/socialaccount/providers/stripe/tests.py
{ "start": 240, "end": 1750 }
class ____(OAuth2TestsMixin, TestCase): provider_id = StripeProvider.id def get_mocked_response(self): return MockedResponse( HTTPStatus.OK, """{ "id": "acct_sometestid", "object": "account", "business_logo": null, "business_name": null, ...
StripeTests
python
huggingface__transformers
tests/models/dpt/test_modeling_dpt_auto_backbone.py
{ "start": 1447, "end": 4671 }
class ____: def __init__( self, parent, batch_size=2, num_channels=3, image_size=32, patch_size=16, use_labels=True, num_labels=3, is_training=True, hidden_size=4, num_hidden_layers=2, num_attention_heads=2, inte...
DPTModelTester
python
gevent__gevent
src/gevent/tests/test__socket_dns6.py
{ "start": 1177, "end": 2890 }
class ____(TestCase): NORMALIZE_GHBA_IGNORE_ALIAS = True # host that only has AAAA record host = 'aaaa.test-ipv6.com' def _normalize_result_gethostbyaddr(self, result): # This part of the test is effectively disabled. There are multiple address # that resolve and which ones you get depe...
Test6
python
openai__openai-python
src/openai/types/realtime/realtime_conversation_item_assistant_message_param.py
{ "start": 914, "end": 1683 }
class ____(TypedDict, total=False): content: Required[Iterable[Content]] """The content of the message.""" role: Required[Literal["assistant"]] """The role of the message sender. Always `assistant`.""" type: Required[Literal["message"]] """The type of the item. Always `message`.""" id: st...
RealtimeConversationItemAssistantMessageParam
python
kubernetes-client__python
kubernetes/client/models/v1beta1_resource_claim_spec.py
{ "start": 383, "end": 3469 }
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...
V1beta1ResourceClaimSpec
python
gevent__gevent
src/greentest/3.9/test_socket.py
{ "start": 207132, "end": 207994 }
class ____(SocketUDPTest): def testUDPTimeout(self): def raise_timeout(*args, **kwargs): self.serv.settimeout(1.0) self.serv.recv(1024) self.assertRaises(socket.timeout, raise_timeout, "Error generating a timeout exception (UDP)") def testT...
UDPTimeoutTest
python
great-expectations__great_expectations
great_expectations/datasource/fluent/sql_datasource.py
{ "start": 9525, "end": 10478 }
class ____(FluentBaseModel): column_name: str method_name: str sort_ascending: bool = True @property def columns(self) -> list[str]: return [self.column_name] def param_defaults(self, sql_asset: _SQLAsset) -> list[dict]: batch_identifier_data = _partitioner_and_sql_asset_to_bat...
_PartitionerOneColumnOneParam
python
ashishps1__awesome-system-design-resources
implementations/python/load_balancing_algorithms/least_response_time.py
{ "start": 27, "end": 1073 }
class ____: def __init__(self, servers): self.servers = servers self.response_times = [0] * len(servers) def get_next_server(self): min_response_time = min(self.response_times) min_index = self.response_times.index(min_response_time) return self.servers[min_index] d...
LeastResponseTime
python
ray-project__ray
python/ray/air/execution/resources/fixed.py
{ "start": 1121, "end": 5544 }
class ____(ResourceManager): """Fixed budget based resource manager. This resource manager keeps track of a fixed set of resources. When resources are acquired, they are subtracted from the budget. When resources are freed, they are added back to the budget. The resource manager still requires res...
FixedResourceManager
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/inputs.py
{ "start": 8792, "end": 9158 }
class ____(graphene.InputObjectType): eventType = graphene.NonNull(GrapheneRunlessAssetEventType) assetKey = graphene.NonNull(GrapheneAssetKeyInput) partitionKeys = graphene.InputField(graphene.List(graphene.String)) description = graphene.String() class Meta: name = "ReportRunlessAssetEven...
GrapheneReportRunlessAssetEventsParams
python
openai__openai-python
src/openai/types/beta/realtime/session_update_event.py
{ "start": 524, "end": 883 }
class ____(BaseModel): anchor: Literal["created_at"] """The anchor point for the ephemeral token expiration. Only `created_at` is currently supported. """ seconds: Optional[int] = None """The number of seconds from the anchor point to the expiration. Select a value between `10` and `7200`...
SessionClientSecretExpiresAfter
python
dateutil__dateutil
src/dateutil/rrule.py
{ "start": 42790, "end": 50715 }
class ____(object): __slots__ = ["rrule", "lastyear", "lastmonth", "yearlen", "nextyearlen", "yearordinal", "yearweekday", "mmask", "mrange", "mdaymask", "nmdaymask", "wdaymask", "wnomask", "nwdaymask", "eastermask"] def __init__(self, rrule): for attr...
_iterinfo
python
apache__airflow
providers/microsoft/azure/tests/unit/microsoft/azure/hooks/test_msgraph.py
{ "start": 2431, "end": 12822 }
class ____: @staticmethod def assert_tenant_id(request_adapter: RequestAdapter, expected_tenant_id: str): adapter: HttpxRequestAdapter = cast("HttpxRequestAdapter", request_adapter) auth_provider: BaseBearerTokenAuthenticationProvider = cast( "BaseBearerTokenAuthenticationProvider", ...
TestKiotaRequestAdapterHook
python
xlwings__xlwings
xlwings/main.py
{ "start": 119799, "end": 121073 }
class ____(Collection): """ A collection of all :meth:`chart <Chart>` objects on the specified sheet: >>> import xlwings as xw >>> xw.books['Book1'].sheets[0].charts Charts([<Chart 'Chart 1' in <Sheet [Book1]Sheet1>>, <Chart 'Chart 1' in <Sheet [Book1]Sheet1>>]) .. versionadded:: 0...
Charts
python
huggingface__transformers
src/transformers/models/lxmert/modeling_lxmert.py
{ "start": 26673, "end": 27207 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.Tanh() def forward(self, hidden_states): # We "pool" the model by simply taking the hidden state corresponding # to t...
LxmertPooler
python
sqlalchemy__sqlalchemy
test/dialect/mssql/test_engine.py
{ "start": 19798, "end": 21692 }
class ____(fixtures.TestBase): @testing.fixture def mock_conn_scalar(self): return lambda text: Mock( exec_driver_sql=Mock( return_value=Mock(scalar=Mock(return_value=text)) ) ) def test_pymssql_version(self, mock_conn_scalar): dialect = pymss...
VersionDetectionTest
python
walkccc__LeetCode
solutions/1933. Check if String Is Decomposable Into Value-Equal Substrings/1933.py
{ "start": 0, "end": 320 }
class ____: def isDecomposable(self, s: str) -> bool: twos = 0 for _, group in itertools.groupby(s): groupLength = len(list(group)) if groupLength % 3 == 1: return False if groupLength % 3 == 2: twos += 1 if twos > 1: return False return twos == 1
Solution
python
huggingface__transformers
tests/models/aria/test_image_processing_aria.py
{ "start": 1052, "end": 5804 }
class ____: def __init__( self, parent, batch_size=7, num_channels=3, num_images=1, min_resolution=30, max_resolution=40, size=None, max_image_size=980, min_image_size=336, split_resolutions=None, split_image=True, ...
AriaImageProcessingTester
python
huggingface__transformers
tests/models/xglm/test_modeling_xglm.py
{ "start": 10757, "end": 13165 }
class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (XGLMModel, XGLMForCausalLM) if is_torch_available() else () pipeline_model_mapping = ( {"feature-extraction": XGLMModel, "text-generation": XGLMForCausalLM} if is_torch_available() else {} ...
XGLMModelTest
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/hooks/sagemaker.py
{ "start": 5018, "end": 60524 }
class ____(AwsBaseHook): """ Interact with Amazon SageMaker. Provide thick wrapper around :external+boto3:py:class:`boto3.client("sagemaker") <SageMaker.Client>`. Additional arguments (such as ``aws_conn_id``) may be specified and are passed down to the underlying AwsBaseHook. .. seealso:...
SageMakerHook
python
allegroai__clearml
clearml/backend_api/services/v2_23/queues.py
{ "start": 87172, "end": 88061 }
class ____(Response): """ Response of queues.peek_task endpoint. :param task: Task ID :type task: str """ _service = "queues" _action = "peek_task" _version = "2.23" _schema = { "definitions": {}, "properties": {"task": {"description": "Task ID", "type": ["string", ...
PeekTaskResponse
python
getsentry__sentry
src/sentry/models/releaseactivity.py
{ "start": 307, "end": 716 }
class ____(Model): __relocation_scope__ = RelocationScope.Excluded release = FlexibleForeignKey("sentry.Release", db_index=True) type = BoundedPositiveIntegerField(null=False, choices=CHOICES) data = models.JSONField(default=dict) date_added = models.DateTimeField(default=timezone.now) class M...
ReleaseActivity
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 548443, "end": 549257 }
class ____(sgqlc.types.relay.Connection): """The connection type for CreatedPullRequestContribution.""" __schema__ = github_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of("CreatedPullRequestContributionEdge"), graphql_name="edges") ...
CreatedPullRequestContributionConnection
python
django__django
tests/fixtures_regress/models.py
{ "start": 7930, "end": 8102 }
class ____(BaseNKModel): b = models.ForeignKey(M2MComplexCircular1B, models.CASCADE) c = models.ForeignKey(M2MComplexCircular1C, models.CASCADE)
M2MCircular1ThroughBC
python
sqlalchemy__sqlalchemy
test/dialect/postgresql/test_compiler.py
{ "start": 4590, "end": 102646 }
class ____(fixtures.TestBase, AssertsCompiledSQL): __dialect__ = postgresql.dialect() def test_plain_stringify_returning(self): t = Table( "t", MetaData(), Column("myid", Integer, primary_key=True), Column("name", String, server_default="some str"), ...
CompileTest
python
getsentry__sentry
tests/sentry/api/test_authentication.py
{ "start": 2152, "end": 4097 }
class ____(TestCase): def setUp(self) -> None: super().setUp() self.auth = ClientIdSecretAuthentication() self.org = self.create_organization(owner=self.user) self.sentry_app = self.create_sentry_app(name="foo", organization=self.org) self.api_app = self.sentry_app.applica...
TestClientIdSecretAuthentication
python
pypa__pip
tests/unit/test_vcs.py
{ "start": 34967, "end": 38342 }
class ____(TestCase): def setUp(self) -> None: patcher = mock.patch("pip._internal.vcs.versioncontrol.call_subprocess") self.addCleanup(patcher.stop) self.call_subprocess_mock = patcher.start() # Test Data. self.url = "hg+http://username:password@hg.example.com/" sel...
TestMercurialArgs