Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_attrs.py32 linesDownload Raw Back to referencing
1from __future__ import annotations2 3from typing import NoReturn, TypeVar4 5from attrs import define as _define, frozen as _frozen6 7_T = TypeVar("_T")8 9 10def define(cls: type[_T]) -> type[_T]:  # pragma: no cover11    cls.__init_subclass__ = _do_not_subclass12    return _define(cls)13 14 15def frozen(cls: type[_T]) -> type[_T]:16    cls.__init_subclass__ = _do_not_subclass17    return _frozen(cls)18 19 20class UnsupportedSubclassing(Exception):21    def __str__(self):22        return (23            "Subclassing is not part of referencing's public API. "24            "If no other suitable API exists for what you're trying to do, "25            "feel free to file an issue asking for one."26        )27 28 29@staticmethod30def _do_not_subclass() -> NoReturn:  # pragma: no cover31    raise UnsupportedSubclassing()32 
codekingpro/portable-devtools · Team Ai