From 5b9db26cb30151bf00032ea59718e82494408126 Mon Sep 17 00:00:00 2001 From: Zhiyuan Chen Date: Mon, 30 Oct 2023 14:49:08 +0000 Subject: [PATCH] ugly fix to Metaclass conflict Signed-off-by: Zhiyuan Chen --- chanfig/config.py | 2 +- chanfig/default_dict.py | 2 +- chanfig/flat_dict.py | 2 +- chanfig/nested_dict.py | 2 +- chanfig/registry.py | 2 +- chanfig/utils.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/chanfig/config.py b/chanfig/config.py index dcb8dfb8..c0db0804 100755 --- a/chanfig/config.py +++ b/chanfig/config.py @@ -39,7 +39,7 @@ def decorator(self, *args: Any, **kwargs: Any): return decorator -class Config(NestedDict): # type: ignore +class Config(NestedDict): r""" `Config` is an extension of `NestedDict`. diff --git a/chanfig/default_dict.py b/chanfig/default_dict.py index 5f0172d3..a8e63114 100644 --- a/chanfig/default_dict.py +++ b/chanfig/default_dict.py @@ -22,7 +22,7 @@ from .utils import Null -class DefaultDict(FlatDict): # type: ignore +class DefaultDict(FlatDict): r""" `DefaultDict` inherits from `FlatDict` and incorporates support of `default_factory` in the same manner as `collections.defaultdict`. diff --git a/chanfig/flat_dict.py b/chanfig/flat_dict.py index d5a36919..20f27de6 100644 --- a/chanfig/flat_dict.py +++ b/chanfig/flat_dict.py @@ -105,7 +105,7 @@ def to_dict(obj: Any) -> Mapping[str, Any]: # pylint: disable=R0911 return obj -class FlatDict(dict, metaclass=Dict): # type: ignore +class FlatDict(dict, metaclass=Dict): r""" `FlatDict` with attribute-style access. diff --git a/chanfig/nested_dict.py b/chanfig/nested_dict.py index 23a77da8..862e9601 100644 --- a/chanfig/nested_dict.py +++ b/chanfig/nested_dict.py @@ -100,7 +100,7 @@ def apply_(obj: Any, func: Callable, *args: Any, **kwargs: Any) -> Any: return func(*args, **kwargs) if ismethod(func) else func(obj, *args, **kwargs) -class NestedDict(DefaultDict): # type: ignore # pylint: disable=E1136 +class NestedDict(DefaultDict): # pylint: disable=E1136 r""" `NestedDict` further extends `DefaultDict` object by introducing a nested structure with `delimiter`. By default, `delimiter` is `.`, but it could be modified in subclass or by calling `dict.setattr('delimiter', D)`. diff --git a/chanfig/registry.py b/chanfig/registry.py index c630fd2b..7ae26b2e 100644 --- a/chanfig/registry.py +++ b/chanfig/registry.py @@ -23,7 +23,7 @@ from .nested_dict import NestedDict -class Registry(NestedDict): # type: ignore +class Registry(NestedDict): """ `Registry` for components. diff --git a/chanfig/utils.py b/chanfig/utils.py index 2f9ad4fb..91cd19d4 100644 --- a/chanfig/utils.py +++ b/chanfig/utils.py @@ -213,7 +213,7 @@ def isvalid(data: Any, expected_type: type) -> bool: return isinstance(data, expected_type) -class Dict(type): +class Dict(type(dict)): # mypy: ignore def __call__(cls, *args: Any, **kwargs: Any) -> Any: instance = super().__call__(*args, **kwargs) instance.__post_init__()