diff options
Diffstat (limited to 'pint/facets/group/registry.py')
-rw-r--r-- | pint/facets/group/registry.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/pint/facets/group/registry.py b/pint/facets/group/registry.py index c6cc06d..0d35ae0 100644 --- a/pint/facets/group/registry.py +++ b/pint/facets/group/registry.py @@ -15,10 +15,10 @@ from ... import errors if TYPE_CHECKING: from ..._typing import Unit -from ...util import build_dependent_class, create_class_with_registry +from ...util import create_class_with_registry from ..plain import PlainRegistry, UnitDefinition from .definitions import GroupDefinition -from .objects import Group +from . import objects class GroupRegistry(PlainRegistry): @@ -34,19 +34,15 @@ class GroupRegistry(PlainRegistry): # TODO: Change this to Group: Group to specify class # and use introspection to get system class as a way # to enjoy typing goodies - _group_class = Group + Group = objects.Group def __init__(self, **kwargs): super().__init__(**kwargs) #: Map group name to group. #: :type: dict[ str | Group] - self._groups: dict[str, Group] = {} + self._groups: dict[str, objects.Group] = {} self._groups["root"] = self.Group("root") - def __init_subclass__(cls, **kwargs): - super().__init_subclass__() - cls.Group = build_dependent_class(cls, "Group", "_group_class") - def _init_dynamic_classes(self) -> None: """Generate subclasses on the fly and attach them to self""" super()._init_dynamic_classes() @@ -93,7 +89,7 @@ class GroupRegistry(PlainRegistry): except KeyError as e: raise errors.DefinitionSyntaxError(f"unknown dimension {e} in context") - def get_group(self, name: str, create_if_needed: bool = True) -> Group: + def get_group(self, name: str, create_if_needed: bool = True) -> objects.Group: """Return a Group. Parameters |