Skip to content

Commit

Permalink
ugly fix to Metaclass conflict
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiyuan Chen <[email protected]>
  • Loading branch information
ZhiyuanChen committed Oct 31, 2023
1 parent 22c9247 commit 5b9db26
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion chanfig/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion chanfig/default_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion chanfig/flat_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion chanfig/nested_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)`.
Expand Down
2 changes: 1 addition & 1 deletion chanfig/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from .nested_dict import NestedDict


class Registry(NestedDict): # type: ignore
class Registry(NestedDict):
"""
`Registry` for components.
Expand Down
2 changes: 1 addition & 1 deletion chanfig/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
Expand Down

0 comments on commit 5b9db26

Please sign in to comment.