Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/referencing/_attrs.py: 100%
10 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:51 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:51 +0000
1from __future__ import annotations
3from typing import NoReturn, TypeVar
5from attrs import define as _define, frozen as _frozen
7_T = TypeVar("_T")
10def define(cls: type[_T]) -> type[_T]: # pragma: no cover
11 cls.__init_subclass__ = _do_not_subclass
12 return _define(cls)
15def frozen(cls: type[_T]) -> type[_T]:
16 cls.__init_subclass__ = _do_not_subclass
17 return _frozen(cls)
20class UnsupportedSubclassing(Exception):
21 pass
24@staticmethod
25def _do_not_subclass() -> NoReturn: # pragma: no cover
26 raise UnsupportedSubclassing(
27 "Subclassing is not part of referencing's public API. "
28 "If no other suitable API exists for what you're trying to do, "
29 "feel free to file an issue asking for one.",
30 )