Buckets:
MisterAI/LocalAI_Demo_backends / cpu-diffusers.upgrade-tmp /venv /lib /python3.10 /site-packages /traitlets /utils /bunch.py
| """Yet another implementation of bunch | |
| attribute-access of items on a dict. | |
| """ | |
| # Copyright (c) Jupyter Development Team. | |
| # Distributed under the terms of the Modified BSD License. | |
| from __future__ import annotations | |
| from typing import Any | |
| class Bunch(dict): # type:ignore[type-arg] | |
| """A dict with attribute-access""" | |
| def __getattr__(self, key: str) -> Any: | |
| try: | |
| return self.__getitem__(key) | |
| except KeyError as e: | |
| raise AttributeError(key) from e | |
| def __setattr__(self, key: str, value: Any) -> None: | |
| self.__setitem__(key, value) | |
| def __dir__(self) -> list[str]: | |
| names: list[str] = [] | |
| names.extend(super().__dir__()) | |
| names.extend(self.keys()) | |
| return names | |
Xet Storage Details
- Size:
- 758 Bytes
- Xet hash:
- 3eb556fd9841e9f0915d6a857d2661c7f12a694a4cc43fe8f975f3c91d89cbea
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.