Skip to content

Commit e96a5ca

Browse files
committed
Silence some misleading Mypy unreachable warnings in property name2submethodnames_automethod of class PyxWriter of module modelutils (see python/typeshed#11200).
1 parent 4ea7b74 commit e96a5ca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

hydpy/cythons/modelutils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,15 +1781,16 @@ def name2submethodnames_automethod(
17811781
self,
17821782
) -> dict[str, tuple[type[modeltools.Method], ...]]:
17831783
"""Submethods selected by |AutoMethod| subclasses."""
1784-
name2submethods = {}
1784+
# see https://github.com/python/typeshed/issues/11200
1785+
name2submethods: dict[str, tuple[type[modeltools.Method], ...]] = {}
17851786
for name, member in vars(self.model).items():
17861787
if (
1787-
isinstance(member, types.MethodType)
1788-
and isinstance(call := member.__func__, types.MethodType)
1788+
isinstance(member, types.MethodType) # type: ignore[unreachable]
1789+
and isinstance(call := member.__func__, types.MethodType) # type: ignore[unreachable] # pylint: disable=line-too-long
17891790
and inspect.isclass(method := call.__self__)
17901791
and issubclass(automethod := method, modeltools.AutoMethod)
17911792
):
1792-
name2submethods[name] = automethod.SUBMETHODS
1793+
name2submethods[name] = automethod.SUBMETHODS # type: ignore[unreachable] # pylint: disable=line-too-long
17931794
return name2submethods
17941795

17951796
@property

0 commit comments

Comments
 (0)