AnonymousSpottedToad/securityPatternsRecovery / codebase /repos /python /bluesky_tiled /tiled /adapters /protocols.py
| from abc import abstractmethod | |
| from collections.abc import Mapping | |
| from typing import Any, Dict, List, Literal, Optional, Protocol, Set, Tuple, Union | |
| import dask.dataframe | |
| import pandas | |
| import ragged | |
| import sparse | |
| from numpy.typing import NDArray | |
| from tiled.structures.ragged import RaggedStructure | |
| from ..ndslice import NDSlice | |
| from ..storage import Storage | |
| from ..structures.array import ArrayStructure | |
| from ..structures.awkward import AwkwardStructure | |
| from ..structures.bytes import BytesStructure | |
| from ..structures.core import Spec, StructureFamily | |
| from ..structures.sparse import SparseStructure | |
| from ..structures.table import TableStructure | |
| from ..type_aliases import JSON | |
| class BaseAdapter(Protocol): | |
| supported_storage: Set[type[Storage]] | |
| def metadata(self) -> JSON: | |
| pass | |
| def specs(self) -> List[Spec]: | |
| pass | |
| class ContainerAdapter(Mapping[str, "AnyAdapter"], BaseAdapter): | |
| structure_family: Literal[StructureFamily.container] | |
| def structure(self) -> None: | |
| pass | |
| class ArrayAdapter(BaseAdapter, Protocol): | |
| structure_family: Literal[StructureFamily.array] | |
| def structure(self) -> ArrayStructure: | |
| pass | |
| def read(self, slice: NDSlice) -> NDArray[Any]: | |
| pass | |
| # TODO Fix slice | |
| def read_block(self, block: Tuple[int, ...]) -> NDArray[Any]: | |
| pass | |
| class AwkwardAdapter(BaseAdapter, Protocol): | |
| structure_family: Literal[StructureFamily.awkward] | |
| def structure(self) -> AwkwardStructure: | |
| pass | |
| def read(self) -> NDArray[Any]: | |
| pass | |
| def read_buffers(self, form_keys: Optional[List[str]] = None) -> Dict[str, Any]: | |
| pass | |
| class RaggedAdapter(BaseAdapter, Protocol): | |
| structure_family: Literal[StructureFamily.ragged] | |
| def structure(self) -> RaggedStructure: | |
| pass | |
| def read(self, slice: Optional[NDSlice] = None) -> ragged.array: | |
| pass | |
| class SparseAdapter(BaseAdapter, Protocol): | |
| structure_family: Literal[StructureFamily.sparse] = StructureFamily.sparse | |
| def structure(self) -> SparseStructure: | |
| pass | |
| # TODO Fix slice (just like array) | |
| def read(self, slice: NDSlice) -> sparse.COO: | |
| pass | |
| # TODO Fix slice (just like array) | |
| def read_block(self, block: Tuple[int, ...]) -> sparse.COO: | |
| pass | |
| class TableAdapter(BaseAdapter, Protocol): | |
| structure_family: Literal[StructureFamily.table] = StructureFamily.table | |
| def structure(self) -> TableStructure: | |
| pass | |
| def read( | |
| self, fields: List[str] | |
| ) -> Union[dask.dataframe.DataFrame, pandas.DataFrame]: | |
| pass | |
| def read_partition( | |
| self, | |
| partition: int, | |
| fields: Optional[str] = None, | |
| ) -> Union[dask.dataframe.DataFrame, pandas.DataFrame]: | |
| pass | |
| def __getitem__(self, key: str) -> ArrayAdapter: | |
| pass | |
| class BytesAdapter(BaseAdapter, Protocol): | |
| structure_family: Literal[StructureFamily.bytes] = StructureFamily.bytes | |
| def structure(self) -> BytesStructure: | |
| pass | |
| AnyAdapter = Union[ | |
| ArrayAdapter, | |
| AwkwardAdapter, | |
| BytesAdapter, | |
| ContainerAdapter, | |
| RaggedAdapter, | |
| SparseAdapter, | |
| TableAdapter, | |
| ] | |
Xet Storage Details
- Size:
- 3.51 kB
- Xet hash:
- 1d70156a1e889787e62e1d17ac8fec698b758b6c4eeb5cdcab674d33e9657dbf
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.