Skip to content

Commit b2e242b

Browse files
committed
revised Info class __init__ generation on non-annotation cases (#113)
1 parent 4a6f0cf commit b2e242b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

pcapkit/corekit/infoclass.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ class Info(collections.abc.Mapping[str, VT], Generic[VT]):
4040
4141
"""
4242

43-
#: Mapping of name conflicts with builtin methods (original names to
44-
#: transformed names).
45-
__map__: 'dict[str, str]'
46-
#: Mapping of name conflicts with builtin methods (transformed names to
47-
#: original names).
48-
__map_reverse__: 'dict[str, str]'
49-
#: List of builtin methods.
50-
__builtin__: 'set[str]'
43+
if TYPE_CHECKING:
44+
#: Mapping of name conflicts with builtin methods (original names to
45+
#: transformed names).
46+
__map__: 'dict[str, str]'
47+
#: Mapping of name conflicts with builtin methods (transformed names to
48+
#: original names).
49+
__map_reverse__: 'dict[str, str]'
50+
#: List of builtin methods.
51+
__builtin__: 'set[str]'
5152

5253
def __new__(cls, *args: 'VT', **kwargs: 'VT') -> 'Info': # pylint: disable=unused-argument
5354
"""Create a new instance.
@@ -64,7 +65,7 @@ def __new__(cls, *args: 'VT', **kwargs: 'VT') -> 'Info': # pylint: disable=unus
6465
cls.__map__ = {}
6566
cls.__map_reverse__ = {}
6667

67-
temp = [] # type: list[str]
68+
temp = ['__map__', '__map_reverse__', '__builtin__']
6869
for obj in cls.mro():
6970
temp.extend(dir(obj))
7071
cls.__builtin__ = set(temp)

0 commit comments

Comments
 (0)