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
scipy__scipy
scipy/sparse/tests/test_indexing1d.py
{ "start": 743, "end": 3598 }
class ____: def test_None_index(self, spcreator): D = np.array([4, 3, 0]) A = spcreator(D) N = D.shape[0] for j in range(-N, N): assert_equal(A[j, None].toarray(), D[j, None]) assert_equal(A[None, j].toarray(), D[None, j]) assert_equal(A[None, Non...
TestGetSet1D
python
Textualize__textual
docs/examples/how-to/layout01.py
{ "start": 364, "end": 523 }
class ____(App): def on_mount(self) -> None: self.push_screen(TweetScreen()) if __name__ == "__main__": app = LayoutApp() app.run()
LayoutApp
python
doocs__leetcode
solution/2100-2199/2102.Sequentially Ordinal Rank Tracker/Solution.py
{ "start": 0, "end": 394 }
class ____: def __init__(self): self.sl = SortedList() self.i = -1 def add(self, name: str, score: int) -> None: self.sl.add((-score, name)) def get(self) -> str: self.i += 1 return self.sl[self.i][1] # Your SORTracker object will be instantiated and called as suc...
SORTracker
python
ray-project__ray
rllib/examples/envs/classes/multi_agent/bandit_envs_recommender_system.py
{ "start": 256, "end": 8857 }
class ____(gym.Env): """A recommendation environment which generates items with visible features randomly (parametric actions). The environment can be configured to be multi-user, i.e. different models will be learned independently for each user, by setting num_users_in_db parameter. To enable s...
ParametricRecSys
python
pallets__jinja
src/jinja2/nodes.py
{ "start": 27638, "end": 27766 }
class ____(Helper): """Holds an operator and an expression.""" fields = ("op", "expr") op: str expr: Expr
Operand
python
PrefectHQ__prefect
tests/server/utilities/test_database.py
{ "start": 6277, "end": 7214 }
class ____: async def test_error_if_naive_timestamp_passed(self, session: AsyncSession): model = SQLTimestampModel(ts_1=datetime.datetime(2000, 1, 1)) session.add(model) with pytest.raises(sa.exc.StatementError, match="(must have a timezone)"): await session.flush() async de...
TestTimestamp
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/ext/associationproxy.py
{ "start": 11331, "end": 11584 }
class ____(Protocol): def __call__( self, lazy_collection: _LazyCollectionProtocol[Any], creator: _CreatorProtocol, value_attr: str, parent: AssociationProxyInstance[Any], ) -> Any: ...
_ProxyFactoryProtocol
python
ansible__ansible
test/units/plugins/strategy/test_linear.py
{ "start": 598, "end": 8457 }
class ____(unittest.TestCase): @patch('ansible.playbook.role.definition.unfrackpath', mock_unfrackpath_noop) def test_noop(self): fake_loader = DictDataLoader({ "test_play.yml": """ - hosts: all gather_facts: no tasks: - block: ...
TestStrategyLinear
python
django__django
tests/admin_changelist/admin.py
{ "start": 4511, "end": 4882 }
class ____(admin.ModelAdmin): list_filter = ("parent", "name", "age") def get_list_filter(self, request): my_list_filter = super().get_list_filter(request) if request.user.username == "noparents": my_list_filter = list(my_list_filter) my_list_filter.remove("parent") ...
DynamicListFilterChildAdmin
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/callable7.py
{ "start": 104, "end": 330 }
class ____: def __init__(self): self.__call__ = self.method1 def method1(self, a: int): return a # This should generate an error because `__call__` is # callable only if it's a class variable. A()(0)
A
python
gevent__gevent
src/gevent/tests/test__lock.py
{ "start": 104, "end": 941 }
class ____(test__semaphore.TestSemaphoreMultiThread): def _makeOne(self): # If we don't set the hub before returning, # there's a potential race condition, if the implementation # isn't careful. If it's the background hub that winds up capturing # the hub, it will ask the hub to swi...
TestRLockMultiThread
python
lazyprogrammer__machine_learning_examples
pytorch/rl_trader.py
{ "start": 3329, "end": 7177 }
class ____: """ A 3-stock trading environment. State: vector of size 7 (n_stock * 2 + 1) - # shares of stock 1 owned - # shares of stock 2 owned - # shares of stock 3 owned - price of stock 1 (using daily close price) - price of stock 2 - price of stock 3 - cash owned (can be used to p...
MultiStockEnv
python
pytorch__pytorch
torch/_higher_order_ops/torchbind.py
{ "start": 1039, "end": 6252 }
class ____(HigherOrderOperator): def __init__(self): super().__init__("call_torchbind") def __call__(self, obj, method, *args, **kwargs): return super().__call__(obj, method, *args, **kwargs) @staticmethod def schema(obj, method) -> torch.FunctionSchema: """ Returns the...
CallTorchBind
python
huggingface__transformers
tests/models/dia/test_tokenization_dia.py
{ "start": 822, "end": 9467 }
class ____(TokenizerTesterMixin, unittest.TestCase): tokenizer_class = DiaTokenizer test_rust_tokenizer = False from_pretrained_id = "AntonV/Dia-1.6B" @classmethod def setUpClass(cls): super().setUpClass() tokenizer = DiaTokenizer() tokenizer.save_pretrained(cls.tmpdirname) ...
DiaTokenizerTest
python
PrefectHQ__prefect
src/prefect/utilities/dispatch.py
{ "start": 241, "end": 6310 }
class ____(Base): ... key = get_dispatch_key(Foo) # 'foo' lookup_type(Base, key) # Foo ``` """ import abc import inspect import warnings from typing import Any, Literal, Optional, TypeVar, overload T = TypeVar("T", bound=type[Any]) _TYPE_REGISTRIES: dict[Any, dict[str, Any]] = {} def get_registry_for_type(cl...
Foo
python
ray-project__ray
rllib/core/distribution/torch/torch_distribution.py
{ "start": 8064, "end": 11924 }
class ____(TorchDistribution): @override(TorchDistribution) def __init__( self, loc: Union[float, "torch.Tensor"], scale: Optional[Union[float, "torch.Tensor"]] = 1.0, low: float = -1.0, high: float = 1.0, ): self.loc = loc self.low = low self....
TorchSquashedGaussian
python
django-compressor__django-compressor
compressor/tests/test_filters.py
{ "start": 23029, "end": 23579 }
class ____(TestCase): @override_settings( COMPRESS_TEMPLATE_FILTER_CONTEXT={"stuff": "thing", "gimmick": "bold"} ) def test_template_filter(self): content = """ #content {background-image: url("{{ STATIC_URL|default:stuff }}/images/bg.png");} #footer {font-weight: {{ gimmick ...
TemplateTestCase
python
spack__spack
lib/spack/spack/vendor/ruamel/yaml/parser.py
{ "start": 4510, "end": 33967 }
class ____: # Since writing a recursive-descendant parser is a straightforward task, we # do not give many comments here. DEFAULT_TAGS = {'!': '!', '!!': 'tag:yaml.org,2002:'} def __init__(self, loader): # type: (Any) -> None self.loader = loader if self.loader is not None and ...
Parser
python
arrow-py__arrow
tests/test_locales.py
{ "start": 25491, "end": 29701 }
class ____: def test_format_timeframe(self): # Now assert self.locale._format_timeframe("now", 0) == "Teď" # Second(s) assert self.locale._format_timeframe("second", -1) == "vteřina" assert self.locale._format_timeframe("second", 1) == "vteřina" assert self.locale._f...
TestCzechLocale
python
huggingface__transformers
src/transformers/models/fsmt/modeling_fsmt.py
{ "start": 16738, "end": 19672 }
class ____(nn.Module): def __init__(self, config: FSMTConfig, layer_idx=None): super().__init__() self.embed_dim = config.d_model self.self_attn = Attention( embed_dim=self.embed_dim, num_heads=config.decoder_attention_heads, dropout=config.attention_drop...
DecoderLayer
python
kubernetes-client__python
kubernetes/client/models/v1_resource_requirements.py
{ "start": 383, "end": 6440 }
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...
V1ResourceRequirements
python
getsentry__sentry-python
tests/integrations/sanic/test_sanic.py
{ "start": 9537, "end": 13925 }
class ____: """ Data class to store configurations for each performance transaction test run, including both the inputs and relevant expected results. """ def __init__( self, integration_args, url, expected_status, expected_transaction_name, expected_...
TransactionTestConfig
python
streamlit__streamlit
lib/streamlit/elements/widgets/button_group.py
{ "start": 9367, "end": 44125 }
class ____: # These overloads are not documented in the docstring, at least not at this time, on # the theory that most people won't know what it means. And the Literals here are a # subclass of int anyway. Usually, we would make a type alias for # Literal["thumbs", "faces", "stars"]; but, in this case,...
ButtonGroupMixin
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 359230, "end": 360148 }
class ____(sgqlc.types.Input): """Autogenerated input type of UpdateProject""" __schema__ = github_schema __field_names__ = ("project_id", "name", "body", "state", "public", "client_mutation_id") project_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="projectId") """The Project ID to...
UpdateProjectInput
python
great-expectations__great_expectations
great_expectations/datasource/fluent/data_asset/path/dataframe_partitioners.py
{ "start": 2209, "end": 2790 }
class ____(_PartitionerDatetime): column_name: str sort_ascending: bool = True method_name: Literal["partition_on_year_and_month_and_day"] = ( "partition_on_year_and_month_and_day" ) @property @override def param_names(self) -> List[str]: return ["year", "month", "day"] ...
DataframePartitionerDaily
python
ansible__ansible
test/units/module_utils/facts/hardware/test_darwin_facts.py
{ "start": 324, "end": 3728 }
class ____: def _get_mock_sysctl_data(self, filename="sysctl_darwin_silicon.txt"): fixture_file = pathlib.Path(__file__).parent / "fixtures" / filename return fixture_file.read_text() @pytest.fixture() def mocked_module(self, mocker, request): request.cls.module = mocker.MagicMock()...
TestDarwinHardwareFacts
python
huggingface__transformers
src/transformers/models/qwen3_vl_moe/modular_qwen3_vl_moe.py
{ "start": 12276, "end": 12333 }
class ____(Qwen3MoeRMSNorm): pass
Qwen3VLMoeTextRMSNorm
python
imageio__imageio
imageio/plugins/pyav.py
{ "start": 9917, "end": 46575 }
class ____(PluginV3): """Support for pyAV as backend. Parameters ---------- request : iio.Request A request object that represents the users intent. It provides a standard interface to access various the various ImageResources and serves them to the plugin as a file object (or f...
PyAVPlugin
python
anthropics__anthropic-sdk-python
src/anthropic/_models.py
{ "start": 1541, "end": 23747 }
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
scipy__scipy
scipy/io/matlab/_miobase.py
{ "start": 591, "end": 10066 }
class ____(UserWarning): """Warning class for write issues.""" doc_dict = \ {'file_arg': '''file_name : str Name of the mat file (do not need .mat extension if appendmat==True) Can also pass open file-like object.''', 'append_arg': '''appendmat : bool, optional True to append t...
MatWriteWarning
python
gevent__gevent
src/gevent/tests/test__timeout.py
{ "start": 242, "end": 720 }
class ____(greentest.TestCase): switch_expected = False def test_direct_raise_class(self): try: raise gevent.Timeout except gevent.Timeout as t: assert not t.pending, repr(t) def test_direct_raise_instance(self): timeout = gevent.Timeout() try: ...
TestDirectRaise
python
pydata__xarray
xarray/namedarray/_typing.py
{ "start": 7165, "end": 7445 }
class ____( _arrayfunction[_ShapeType_co, _DType_co], Protocol[_ShapeType_co, _DType_co] ): """ Sparse duck array supporting NEP 18. Corresponds to np.ndarray. """ def todense(self) -> np.ndarray[Any, _DType_co]: ... @runtime_checkable
_sparsearrayfunction
python
tensorflow__tensorflow
tensorflow/python/ops/ragged/ragged_fill_empty_rows_op_test.py
{ "start": 1223, "end": 5668 }
class ____(test_util.TensorFlowTestCase): def testFillInt(self): with test_util.use_gpu(): default_value = constant_op.constant(-1, dtype=dtypes.int32) ragged_input = ragged_factory_ops.constant( [[], [1, 3, 5, 7], [], [2, 4, 6, 8], []], dtype=dtypes.int32 ) ragged_output, empty...
RaggedFillEmptyRowsTest
python
python-attrs__attrs
src/attr/exceptions.py
{ "start": 456, "end": 601 }
class ____(FrozenError): """ A frozen instance has been attempted to be modified. .. versionadded:: 16.1.0 """
FrozenInstanceError
python
django__django
tests/queries/models.py
{ "start": 17861, "end": 18032 }
class ____(models.Model): custom_column = models.IntegerField(db_column="custom_name", null=True) ip_address = models.GenericIPAddressField(null=True)
CustomDbColumn
python
spyder-ide__spyder
spyder/widgets/calltip.py
{ "start": 1438, "end": 11549 }
class ____(QLabel): """ Shows tooltips that can be styled with the different themes. """ # Delay in miliseconds before hiding the tooltip HIDE_DELAY = 50 # Signals sig_completion_help_requested = Signal(str, str) sig_help_requested = Signal(str) def __init__(self, parent=None): ...
ToolTipWidget
python
PrefectHQ__prefect
src/prefect/server/schemas/filters.py
{ "start": 81310, "end": 82082 }
class ____(PrefectFilterBaseModel): """Filter by `ArtifactCollection.type`.""" any_: Optional[list[str]] = Field( default=None, description="A list of artifact types to include" ) not_any_: Optional[list[str]] = Field( default=None, description="A list of artifact types to exclude" ...
ArtifactCollectionFilterType
python
pytorch__pytorch
test/distributed/fsdp/test_wrap.py
{ "start": 2815, "end": 3414 }
class ____(nn.Module): def __init__(self) -> None: super().__init__() self.q_proj = nn.Linear(32, 32, bias=False) self.lora_A = nn.Linear(32, 8, bias=False) self.lora_B = nn.Linear(8, 32, bias=False) self.k_proj = nn.Linear(32, 32, bias=False) self.v_proj = nn.Linear(...
LoraAttention
python
pymupdf__PyMuPDF
src_classic/__init__.py
{ "start": 7978, "end": 23545 }
class ____(DeprecationWarning): pass def restore_aliases(): import warnings warnings.filterwarnings( "once", category=FitzDeprecation, ) def showthis(msg, cat, filename, lineno, file=None, line=None): text = warnings.formatwarning(msg, cat, filename, lineno, line=line) ...
FitzDeprecation
python
dagster-io__dagster
python_modules/libraries/dagster-fivetran/dagster_fivetran/asset_defs.py
{ "start": 13724, "end": 18173 }
class ____( NamedTuple( "_FivetranConnectionMetadata", [ ("name", str), ("connector_id", str), ("connector_url", str), ("schemas", Mapping[str, Any]), ("database", Optional[str]), ("service", Optional[str]), ], ) ): ...
FivetranConnectionMetadata
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/instrumentation.py
{ "start": 19213, "end": 23950 }
class ____(EventTarget): """Factory for new ClassManager instances.""" dispatch: dispatcher[InstrumentationFactory] def create_manager_for_cls(self, class_: Type[_O]) -> ClassManager[_O]: assert class_ is not None assert opt_manager_of_class(class_) is None # give a more complicat...
InstrumentationFactory
python
sphinx-doc__sphinx
sphinx/builders/html/_assets.py
{ "start": 244, "end": 1767 }
class ____: filename: str | os.PathLike[str] priority: int attributes: dict[str, str] def __init__( self, filename: str | os.PathLike[str], /, *, priority: int = 500, rel: str = 'stylesheet', type: str = 'text/css', **attributes: str, ...
_CascadingStyleSheet
python
doocs__leetcode
solution/1500-1599/1500.Design a File Sharing System/Solution.py
{ "start": 0, "end": 1081 }
class ____: def __init__(self, m: int): self.cur = 0 self.chunks = m self.reused = [] self.user_chunks = defaultdict(set) def join(self, ownedChunks: List[int]) -> int: if self.reused: userID = heappop(self.reused) else: self.cur += 1 ...
FileSharing
python
ethereum__web3.py
web3/types.py
{ "start": 10668, "end": 11780 }
class ____(TypedDict): author: ChecksumAddress difficulty: HexStr extraData: HexStr gasLimit: HexStr gasUsed: HexStr hash: HexBytes logsBloom: HexStr miner: HexBytes mixHash: HexBytes nonce: HexStr number: HexStr parentHash: HexBytes receiptsRoot: HexBytes sealFie...
Uncle
python
getsentry__sentry
src/sentry/integrations/msteams/actions/notification.py
{ "start": 863, "end": 3787 }
class ____(IntegrationEventAction): id = "sentry.integrations.msteams.notify_action.MsTeamsNotifyServiceAction" label = "Send a notification to the {team} Team to {channel}" prompt = "Send a Microsoft Teams notification" provider = IntegrationProviderSlug.MSTEAMS.value integration_key = "team" ...
MsTeamsNotifyServiceAction
python
joerick__pyinstrument
pyinstrument/renderers/session.py
{ "start": 105, "end": 395 }
class ____(Renderer): output_file_extension: str = "pyisession" def __init__(self, tree_format: bool = False): super().__init__() self.tree_format = tree_format def render(self, session: Session) -> str: return json.dumps(session.to_json())
SessionRenderer
python
huggingface__transformers
src/transformers/models/evolla/modular_evolla.py
{ "start": 26834, "end": 27752 }
class ____(LlamaPreTrainedModel): _supports_flash_attn = False # see dependency on `EvollaSequenceCompressorResampler` _supports_flex_attn = False # see dependency on `EvollaSequenceCompressorResampler` _supports_attention_backend = False _no_split_modules = [ "EvollaDecoderLayer", "Ev...
EvollaPreTrainedModel
python
numba__numba
numba/core/typing/builtins.py
{ "start": 7240, "end": 7426 }
class ____(ConcreteTemplate): cases = list(integer_binop_cases) cases += [signature(op, op, op) for op in sorted(types.real_domain)] @infer_global(operator.ifloordiv)
BinOpFloorDiv
python
getsentry__sentry
tests/sentry/api/endpoints/test_organization_api_key_details.py
{ "start": 2780, "end": 3164 }
class ____(OrganizationApiKeyDetailsBase): method = "delete" def test_can_delete_api_key(self) -> None: self.get_success_response(self.organization.slug, self.api_key.id) # check to make sure it's deleted self.get_error_response( self.organization.slug, self.api_key.id, met...
OrganizationApiKeyDetailsDelete
python
RaRe-Technologies__gensim
gensim/utils.py
{ "start": 35019, "end": 35871 }
class ____(SaveLoad): """Wrap a `corpus` and return `max_doc` element from it.""" def __init__(self, corpus, max_docs=None): """ Parameters ---------- corpus : iterable of iterable of (int, numeric) Input corpus. max_docs : int Maximum number of d...
ClippedCorpus
python
pyqtgraph__pyqtgraph
pyqtgraph/parametertree/parameterTypes/checklist.py
{ "start": 4958, "end": 12083 }
class ____(GroupParameter): """ Can be set just like a :class:`ListParameter`, but allows for multiple values to be selected simultaneously. ============== ======================================================== **Options** exclusive When *False*, any number of options can be selected. The re...
ChecklistParameter
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/vertex_ai/test_generative_model.py
{ "start": 18174, "end": 19365 }
class ____: @mock.patch(VERTEX_AI_PATH.format("generative_model.ExperimentRunHook")) def test_execute(self, mock_hook): test_experiment_name = "test_experiment_name" test_experiment_run_name = "test_experiment_run_name" with pytest.warns(AirflowProviderDeprecationWarning): o...
TestVertexAIDeleteExperimentRunOperator
python
plotly__plotly.py
plotly/graph_objs/scatter/marker/_colorbar.py
{ "start": 233, "end": 61634 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scatter.marker" _path_str = "scatter.marker.colorbar" _valid_props = { "bgcolor", "bordercolor", "borderwidth", "dtick", "exponentformat", "labelalias", "len", "lenmode", "minexpo...
ColorBar
python
django-compressor__django-compressor
compressor/parser/default_htmlparser.py
{ "start": 321, "end": 2591 }
class ____(ParserBase, html.parser.HTMLParser): def __init__(self, content): html.parser.HTMLParser.__init__(self, **HTML_PARSER_ARGS) self.content = content self._css_elems = [] self._js_elems = [] self._current_tag = None try: self.feed(self.content) ...
DefaultHtmlParser
python
doocs__leetcode
solution/1000-1099/1001.Grid Illumination/Solution.py
{ "start": 0, "end": 889 }
class ____: def gridIllumination( self, n: int, lamps: List[List[int]], queries: List[List[int]] ) -> List[int]: s = {(i, j) for i, j in lamps} row, col, diag1, diag2 = Counter(), Counter(), Counter(), Counter() for i, j in s: row[i] += 1 col[j] += 1 ...
Solution
python
getsentry__sentry
tests/sentry/relocation/tasks/test_process.py
{ "start": 61580, "end": 71011 }
class ____(RelocationTaskTestCase): def setUp(self) -> None: super().setUp() self.relocation.step = Relocation.Step.VALIDATING.value self.relocation.latest_task = OrderedTask.VALIDATING_START.name self.relocation.want_usernames = ["testuser"] self.relocation.want_org_slugs = ...
ValidatingPollTest
python
django-debug-toolbar__django-debug-toolbar
debug_toolbar/store.py
{ "start": 1994, "end": 4383 }
class ____(BaseStore): # ids is the collection of storage ids that have been used. # Use a dequeue to support O(1) appends and pops # from either direction. _request_ids: deque = deque() _request_store: dict[str, dict] = defaultdict(dict) @classmethod def request_ids(cls) -> Iterable: ...
MemoryStore
python
getsentry__sentry
src/sentry/backup/crypto.py
{ "start": 551, "end": 1395 }
class ____(NamedTuple): """ A structured version of a Google Cloud KMS CryptoKeyVersion, as described here: https://cloud.google.com/kms/docs/resource-hierarchy#retrieve_resource_id """ project_id: str location: str key_ring: str key: str version: str # No arguments, so we lazily ...
CryptoKeyVersion
python
ipython__ipython
IPython/core/formatters.py
{ "start": 30841, "end": 31355 }
class ____(BaseFormatter): """A PDF formatter. To define the callables that compute the PDF representation of your objects, define a :meth:`_repr_pdf_` method or use the :meth:`for_type` or :meth:`for_type_by_name` methods to register functions that handle this. The return value of this format...
PDFFormatter
python
ray-project__ray
doc/source/_ext/queryparamrefs.py
{ "start": 147, "end": 274 }
class ____(nodes.General, nodes.Element): """Node type for references that need URL query parameters."""
URLQueryParamRefNode
python
doocs__leetcode
solution/2100-2199/2102.Sequentially Ordinal Rank Tracker/Solution2.py
{ "start": 0, "end": 127 }
class ____: def __init__(self, s: str): self.s = s def __lt__(self, other): return self.s > other.s
Node
python
google__pytype
pytype/typegraph/cfg_utils.py
{ "start": 2141, "end": 6913 }
class ____: """A class that raises TooComplexError if we hit a limit.""" def __init__(self, limit: int) -> None: self.limit = limit self.count = 0 def inc(self, add: int = 1) -> None: self.count += add if self.count >= self.limit: raise TooComplexError() def deep_variable_product(variabl...
ComplexityLimit
python
scipy__scipy
benchmarks/benchmarks/spatial.py
{ "start": 18568, "end": 19689 }
class ____(Benchmark): params = [1, 10, 1000, 10000] param_names = ['num_rotations'] def setup(self, num_rotations): rng = np.random.default_rng(1234) self.rotations = Rotation.random(num_rotations, random_state=rng) def time_matrix_conversion(self, num_rotations): '''Time conv...
RotationBench
python
pydata__xarray
xarray/core/indexing.py
{ "start": 38066, "end": 59122 }
class ____(enum.Enum): # for backends that support only basic indexer BASIC = 0 # for backends that support basic / outer indexer OUTER = 1 # for backends that support outer indexer including at most 1 vector. OUTER_1VECTOR = 2 # for backends that support full vectorized indexer. VECTORI...
IndexingSupport
python
great-expectations__great_expectations
tests/core/test_expectation_suite.py
{ "start": 42560, "end": 49382 }
class ____: @pytest.fixture def empty_suite(self, in_memory_runtime_context) -> ExpectationSuite: return in_memory_runtime_context.suites.add(ExpectationSuite(name="my_suite")) @pytest.fixture def expect_column_values_to_be_between(self) -> Expectation: return gxe.ExpectColumnValuesToBe...
TestExpectationSuiteAnalytics
python
getsentry__sentry
tests/sentry/integrations/jira_server/test_integration.py
{ "start": 3430, "end": 45833 }
class ____(JiraServerIntegrationBaseTest): def test_get_create_issue_config(self) -> None: event = self.store_event( data={ "event_id": "a" * 32, "message": "message", "timestamp": self.min_ago, }, project_id=self.project.id...
JiraServerRegionIntegrationTest
python
dask__distributed
distributed/spans.py
{ "start": 2991, "end": 16254 }
class ____: #: (<tag>, <tag>, ...) #: Matches ``TaskState.annotations["span"]["name"]``, both on the scheduler and the #: worker. name: tuple[str, ...] #: Unique ID, generated by :func:`~distributed.span` and #: taken from ``TaskState.annotations["span"]["id"][-1]``. #: Matches ``distribute...
Span
python
dagster-io__dagster
python_modules/libraries/dagster-airlift/kitchen-sink/kitchen_sink/airflow_dags/custom_callback.py
{ "start": 1304, "end": 2125 }
class ____(DefaultProxyTaskToDagsterOperator): @classmethod def build_from_task(cls, original_task: BaseOperator) -> BaseProxyTaskToDagsterOperator: # pyright: ignore[reportIncompatibleMethodOverride] """A custom callback to construct a new operator for the given task. In our case, we add retries to th...
CustomProxyTaskToDagsterOperator
python
ansible__ansible
test/lib/ansible_test/_internal/python_requirements.py
{ "start": 1089, "end": 1382 }
class ____(ApplicationError): """Exception raised when pip is not available.""" def __init__(self, python: PythonConfig) -> None: super().__init__(f'Python {python.version} at "{python.path}" does not have pip available.') @dataclasses.dataclass(frozen=True)
PipUnavailableError
python
airbytehq__airbyte
airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_base_streams.py
{ "start": 4614, "end": 10846 }
class ____: def test_stream_slices_multiple_accounts_with_state(self, incremental_class_instance): stream_state = { "123": {"state_key": "state_value"}, "456": {"state_key": "another_state_value"}, } expected_slices = [ {"account_id": "123", "stream_state"...
TestFBMarketingIncrementalStreamSliceAndState
python
python-poetry__poetry
src/poetry/mixology/incompatibility_cause.py
{ "start": 1607, "end": 1968 }
class ____(IncompatibilityCauseError): """ The incompatibility represents a package's platform constraint (OS most likely) being incompatible with the current platform. """ def __init__(self, platform: str) -> None: self._platform = platform @property def platform(self) -> str: ...
PlatformCauseError
python
kamyu104__LeetCode-Solutions
Python/design-skiplist.py
{ "start": 281, "end": 407 }
class ____(object): def __init__(self, level=0, num=None): self.num = num self.nexts = [None]*level
SkipNode
python
plotly__plotly.py
plotly/graph_objs/scattergl/_hoverlabel.py
{ "start": 233, "end": 11255 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scattergl" _path_str = "scattergl.hoverlabel" _valid_props = { "align", "alignsrc", "bgcolor", "bgcolorsrc", "bordercolor", "bordercolorsrc", "font", "namelength", "namelengthsrc"...
Hoverlabel
python
tensorflow__tensorflow
tensorflow/python/data/kernel_tests/cache_test.py
{ "start": 27621, "end": 28804 }
class ____( checkpoint_test_base.CheckpointTestBase, parameterized.TestCase): @combinations.generate( combinations.times( test_base.default_test_combinations(), checkpoint_test_base.default_test_combinations(), combinations.combine( dataset_range=[10], ...
CacheGlobalShuffleCheckpointTest
python
astropy__astropy
astropy/time/core.py
{ "start": 107005, "end": 126232 }
class ____(TimeBase): """ Represent the time difference between two times. A TimeDelta object is initialized with one or more times in the ``val`` argument. The input times in ``val`` must conform to the specified ``format``. The optional ``val2`` time input should be supplied only for numeri...
TimeDelta
python
realpython__materials
python-protocol/adder_v2.py
{ "start": 30, "end": 107 }
class ____(Protocol): def add(self, x: float, y: float) -> float: ...
Adder
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 23703, "end": 26354 }
class ____(GeneratedAirbyteSource): class OAuth20: @public def __init__( self, app_id: str, secret: str, access_token: str, auth_type: Optional[str] = None ): self.auth_type = check.opt_str_param(auth_type, "auth_type") self.app_id = check.str_param(app_id...
TiktokMarketingSource
python
chroma-core__chroma
chromadb/api/async_api.py
{ "start": 18085, "end": 23690 }
class ____(AsyncBaseAPI, AsyncAdminAPI, Component): """An API instance that extends the relevant Base API methods by passing in a tenant and database. This is the root component of the Chroma System""" @abstractmethod async def list_collections( self, limit: Optional[int] = None, ...
AsyncServerAPI
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1286660, "end": 1288163 }
class ____(sgqlc.types.Type, Node): """An Invitation for a user to an organization.""" __schema__ = github_schema __field_names__ = ("created_at", "email", "invitation_source", "invitation_type", "invitee", "inviter", "organization", "role") created_at = sgqlc.types.Field(sgqlc.types.non_null(DateTime)...
OrganizationInvitation
python
py-pdf__pypdf
pypdf/constants.py
{ "start": 15729, "end": 15871 }
class ____(IntFlag): """Table 8.70 Field flags common to all field types.""" READ_ONLY = 1 REQUIRED = 2 NO_EXPORT = 4
FieldFlag
python
scipy__scipy
scipy/optimize/_optimize.py
{ "start": 2517, "end": 4132 }
class ____: """Decorator that caches the return values of a function returning ``(fun, grad)`` each time it is called.""" def __init__(self, fun): self.fun = fun self.jac = None self._value = None self.x = None def _compute_if_needed(self, x, *args): if not np.a...
MemoizeJac
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/util.py
{ "start": 17861, "end": 18317 }
class ____(_repr_base): """Provide a string view of a row.""" __slots__ = ("row",) def __init__( self, row: Row[Unpack[Tuple[Any, ...]]], max_chars: int = 300 ): self.row = row self.max_chars = max_chars def __repr__(self) -> str: trunc = self.trunc return ...
_repr_row
python
facebookresearch__faiss
tests/test_fast_scan_ivf.py
{ "start": 20752, "end": 21009 }
class ____(unittest.TestCase): def test_issue_2019(self): index = faiss.index_factory( 32, "PCAR16,IVF200(IVF10,PQ2x4fs,RFlat),PQ4x4fsr" ) des = faiss.rand((1000, 32)) index.train(des)
TestIsTrained
python
pypa__hatch
tests/cli/self/test_report.py
{ "start": 863, "end": 6108 }
class ____: def test_open(self, hatch, mocker, platform): open_new_tab = mocker.patch("webbrowser.open_new_tab") result = hatch(os.environ["PYAPP_COMMAND_NAME"], "report") assert result.exit_code == 0, result.output assert not result.output expected_body = f"""\ {STATIC_BOD...
TestDefault
python
getsentry__sentry
src/sentry/api/endpoints/organization_access_request_details.py
{ "start": 1569, "end": 5902 }
class ____(OrganizationEndpoint): publish_status = { "GET": ApiPublishStatus.PRIVATE, "PUT": ApiPublishStatus.PRIVATE, } owner = ApiOwner.ENTERPRISE permission_classes = (AccessRequestPermission,) # TODO(dcramer): this should go onto AccessRequestPermission def _can_access(self,...
OrganizationAccessRequestDetailsEndpoint
python
jina-ai__jina
tests/integration/hub_usage/dummyhub_pretrained/__init__.py
{ "start": 53, "end": 208 }
class ____(FileNotFoundError): """Exception to raise for executors depending on pretrained model files when they do not exist."""
ModelCheckpointNotExist
python
great-expectations__great_expectations
great_expectations/datasource/fluent/data_connector/google_cloud_storage_data_connector.py
{ "start": 788, "end": 962 }
class ____(pydantic.BaseModel): gcs_prefix: str = "" gcs_delimiter: str = "/" gcs_max_results: int = 1000 gcs_recursive_file_discovery: bool = False
_GCSOptions
python
pyca__cryptography
tests/hazmat/primitives/test_aes.py
{ "start": 667, "end": 4149 }
class ____: def test_xts_vectors(self, backend, subtests): # This list comprehension excludes any vector that does not have a # data unit length that is divisible by 8. The NIST vectors include # tests for implementations that support encryption of data that is # not divisible modulo...
TestAESModeXTS
python
bokeh__bokeh
src/bokeh/events.py
{ "start": 15039, "end": 15447 }
class ____(PointEvent): ''' Announce a double-tap or double-click event on a Bokeh plot. Attributes: sx (float) : x-coordinate of the event in *screen* space sy (float) : y-coordinate of the event in *screen* space x (float) : x-coordinate of the event in *data* space y (float) ...
DoubleTap
python
tensorflow__tensorflow
tensorflow/python/compiler/tensorrt/test/trt_mode_test.py
{ "start": 3458, "end": 3828 }
class ____(TrtModeTestBase): def GetParams(self): """We specify input/output masks with static (known) shapes.""" return self.BuildParamsWithMask( self.GraphFn, dtypes.float32, [[1, 12, 5]], [[12, 5]], input_mask=[[True, True, True]], output_mask=[[True, True]], extra_...
StaticInputTest
python
getsentry__responses
responses/__init__.py
{ "start": 3032, "end": 3202 }
class ____(NamedTuple): request: "PreparedRequest" response: "_Body" _real_send = HTTPAdapter.send _UNSET = object() logger = logging.getLogger("responses")
Call
python
pypa__setuptools
pkg_resources/tests/test_resources.py
{ "start": 1069, "end": 13077 }
class ____: def testCollection(self): # empty path should produce no distributions ad = pkg_resources.Environment([], platform=None, python=None) assert list(ad) == [] assert ad['FooPkg'] == [] ad.add(dist_from_fn("FooPkg-1.3_1.egg")) ad.add(dist_from_fn("FooPkg-1.4-p...
TestDistro
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 506931, "end": 507276 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") node = sgqlc.types.Field("ProjectNextItemFieldValue", graphql_name="node")
ProjectNextItemFieldValueEdge
python
openai__openai-python
src/openai/types/realtime/realtime_transcription_session_create_response.py
{ "start": 1616, "end": 2434 }
class ____(BaseModel): id: str """Unique identifier for the session that looks like `sess_1234567890abcdef`.""" object: str """The object type. Always `realtime.transcription_session`.""" type: Literal["transcription"] """The type of session. Always `transcription` for transcription sessions."...
RealtimeTranscriptionSessionCreateResponse
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 507516, "end": 508731 }
class ____(sgqlc.types.Type): """Represents a single day of contributions on GitHub by a user.""" __schema__ = github_schema __field_names__ = ("color", "contribution_count", "contribution_level", "date", "weekday") color = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="color") """Th...
ContributionCalendarDay
python
bokeh__bokeh
tests/unit/bokeh/test_settings.py
{ "start": 6784, "end": 11350 }
class ____: def test_env_var_property(self) -> None: ps = bs.PrioritizedSetting("foo", env_var="BOKEH_FOO") assert ps.env_var == "BOKEH_FOO" def test_everything_unset_raises(self) -> None: ps = bs.PrioritizedSetting("foo") with pytest.raises(RuntimeError): ps() ...
TestPrioritizedSetting
python
walkccc__LeetCode
solutions/682. Baseball Game/682.py
{ "start": 0, "end": 394 }
class ____: def calPoints(self, operations: list[str]) -> int: scores = [] for operation in operations: match operation: case '+': scores.append(scores[-1] + scores[-2]) case 'D': scores.append(scores[-1] * 2) case 'C': scores.pop() case def...
Solution
python
facebookresearch__faiss
tests/test_contrib.py
{ "start": 9450, "end": 14499 }
class ____(unittest.TestCase): def test_index_pretransformed(self): ds = datasets.SyntheticDataset(128, 2000, 2000, 200) xt = ds.get_train() xq = ds.get_queries() xb = ds.get_database() index = faiss.index_factory(128, 'PCA64,IVF64,PQ4np') index.train(xt) in...
TestPreassigned
python
django__django
tests/select_for_update/models.py
{ "start": 529, "end": 607 }
class ____(CountryProxy): class Meta: proxy = True
CountryProxyProxy
python
ZoranPandovski__al-go-rithms
data_structures/Tree/Binary-tree/BST.py
{ "start": 148, "end": 3705 }
class ____: def __init__(self,data=None): self.root = BinaryNode() self.root.data = data def search(self,k): return self.searchtree(self.root,k) def searchtree(self,r=None,k=None): if r is None: return False if k == r.data: return True ...
Binarytree