bagofholding.content module
Content controls the decomposition of python objects into their component parts, along with a record of what type of object they are, and gathering any relevant metadata.
Content is not, of itself, concerned with what you _do_ with this decompositon. That is handled via the “packer” protocol (for us, the relevant implementation of this is “bags”).
- class bagofholding.content.BespokeItem[source]
Bases:
ReflexiveItem[ItemType,PackerType],Generic[ItemType,PackerType],ABC
- class bagofholding.content.Bool[source]
Bases:
BuiltinItem[bool]- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) bool[source]
- class bagofholding.content.BuiltinGroup[source]
Bases:
ReflexiveGroup[BuiltinGroupType],Generic[BuiltinGroupType],ABC- classmethod pack(obj: PackingType, packer: Packer, path: str, packing: PackingArguments) None[source]
- class bagofholding.content.BuiltinItem[source]
Bases:
ReflexiveItem[BuiltinItemType,Packer],Generic[BuiltinItemType],ABC
- class bagofholding.content.Bytearray[source]
Bases:
BuiltinItem[bytearray]- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) bytearray[source]
- class bagofholding.content.Bytes[source]
Bases:
BuiltinItem[bytes]- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) bytes[source]
- class bagofholding.content.Complex[source]
Bases:
BuiltinItem[complex]- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) complex[source]
- class bagofholding.content.Content[source]
Bases:
Generic[PackingType,UnpackingType,PackerType],ABC- abstractmethod classmethod pack(obj: PackingType, packer: PackerType, path: str, packing: PackingArguments) None[source]
- abstractmethod classmethod unpack(packer: PackerType, path: str, unpacking: UnpackingArguments) UnpackingType[source]
- class bagofholding.content.Dict[source]
Bases:
BuiltinGroup[dict[Any,Any]]- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) dict[Any, Any][source]
- class bagofholding.content.Float[source]
Bases:
BuiltinItem[float]- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) float[source]
- class bagofholding.content.FrozenSet[source]
Bases:
Indexable[frozenset[Any]]- recast
alias of
frozenset
- class bagofholding.content.Global[source]
Bases:
Item[type[type] |LambdaType|str,Any,Packer]- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) Any[source]
- class bagofholding.content.Group[source]
Bases:
Content[PackingType,UnpackingType,Packer],Generic[PackingType,UnpackingType],ABC
- class bagofholding.content.HasContents(*args, **kwargs)[source]
Bases:
Sized,Iterable[str],Protocol
- class bagofholding.content.Indexable[source]
Bases:
BuiltinGroup[IndexableType],Generic[IndexableType],ABC- recast: type[IndexableType]
- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) IndexableType[source]
- class bagofholding.content.Item[source]
Bases:
Content[PackingType,UnpackingType,PackerType],Generic[PackingType,UnpackingType,PackerType],ABC- classmethod pack(obj: PackingType, packer: PackerType, path: str, packing: PackingArguments) None[source]
- class bagofholding.content.Long[source]
Bases:
BuiltinItem[int]- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) int[source]
- class bagofholding.content.NoneItem[source]
Bases:
Item[type[None],None,Packer]- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) None[source]
- class bagofholding.content.Packer(*args, **kwargs)[source]
Bases:
Protocol- get_bespoke_content_class(obj: object) type[BespokeItem[Any, Self]] | None[source]
- open_group(path: str) HasContents[source]
- class bagofholding.content.PackingArguments(memo: 'PackingMemoAlias', references: 'ReferencesAlias', require_versions: 'bool', forbidden_modules: 'list[str] | tuple[str, ...]', version_scraping: 'VersionScrapingMap | None', _pickle_protocol: 'SupportsIndex')[source]
Bases:
object- forbidden_modules: list[str] | tuple[str, ...]
- memo: bidict[int, str]
- references: list[object]
- require_versions: bool
- version_scraping: dict[str, Callable[[str], str | None]] | None
- class bagofholding.content.Reducible[source]
Bases:
ReflexiveGroup[object]- classmethod pack(obj: object, packer: Packer, path: str, packing: PackingArguments, rv: tuple[Callable[[...], object], tuple[object, ...]] | tuple[Callable[[...], object], tuple[object, ...], object | None] | tuple[Callable[[...], object], tuple[object, ...], object | None, Iterator[object] | None] | tuple[Callable[[...], object], tuple[object, ...], object | None, Iterator[object] | None, Iterator[tuple[object, object]] | None] | tuple[Callable[[...], object] | None, tuple[object, ...] | None, object | None, Iterator[object] | None, Iterator[tuple[object, object]] | None, Callable[[object, object], None] | None] | None = None) None[source]
- reduction_fields: ClassVar[tuple[str, str, str, str, str, str]] = ('constructor', 'args', 'state', 'item_iterator', 'kv_iterator', 'setter')
- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) object[source]
- class bagofholding.content.Reference[source]
-
- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) Any[source]
- class bagofholding.content.ReflexiveGroup[source]
Bases:
Group[GroupType,GroupType],Generic[GroupType],ABC
- class bagofholding.content.ReflexiveItem[source]
Bases:
Item[ItemType,ItemType,PackerType],Generic[ItemType,PackerType],ABC
- class bagofholding.content.Str[source]
Bases:
BuiltinItem[str]- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) str[source]
- class bagofholding.content.StrKeyDict[source]
Bases:
BuiltinGroup[dict[str,Any]]- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) dict[str, Any][source]
- class bagofholding.content.Union[source]
Bases:
BuiltinGroup[Union]types.UnionTypehas no__reduce__()method. Pickle actually gets around this with bespoke logic, and so we need to too.- classmethod unpack(packer: Packer, path: str, unpacking: UnpackingArguments) Union[source]
- class bagofholding.content.UnpackingArguments(memo: 'UnpackingMemoAlias', version_validator: 'VersionValidatorType', version_scraping: 'VersionScrapingMap | None')[source]
Bases:
object- memo: dict[str, Any]
- version_scraping: dict[str, Callable[[str], str | None]] | None
- version_validator: Literal['exact', 'semantic-minor', 'semantic-major', 'none'] | Callable[[str, str], bool]
- bagofholding.content.pack(obj: object, packer: Packer, path: str, memo: bidict[int, str], references: list[object], require_versions: bool, forbidden_modules: list[str] | tuple[str, ...], version_scraping: dict[str, Callable[[str], str | None]] | None, _pickle_protocol: SupportsIndex = 4) None[source]