Fix a few more typing issues

This commit is contained in:
Dave Halter
2026-02-04 02:24:41 +01:00
parent 3ffed76884
commit e7fdbcc834
17 changed files with 38 additions and 23 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ def _is_type(obj):
def _shadowed_dict(klass):
dict_attr = type.__dict__["__dict__"]
dict_attr = type.__dict__["__dict__"] # type: ignore[index]
for entry in _static_getmro(klass):
try:
class_dict = dict_attr.__get__(entry)["__dict__"]
@@ -54,7 +54,7 @@ def _shadowed_dict(klass):
def _static_getmro(klass):
mro = type.__dict__['__mro__'].__get__(klass)
mro = type.__dict__['__mro__'].__get__(klass) # type: ignore[index]
if not isinstance(mro, (tuple, list)):
# There are unfortunately no tests for this, I was not able to
# reproduce this in pure Python. However should still solve the issue
@@ -158,7 +158,10 @@ def _find_module(string, path=None, full_name=None, is_global_search=True):
if loader is None and not spec.has_location:
# This is a namespace package.
full_name = string if not path else full_name
implicit_ns_info = ImplicitNSInfo(full_name, spec.submodule_search_locations._path)
implicit_ns_info = ImplicitNSInfo(
full_name,
spec.submodule_search_locations._path, # type: ignore[union-attr]
)
return implicit_ns_info, True
break