Remove any extra typing aliases that were pulled into module dir()s

This commit is contained in:
baldurk
2026-08-13 21:05:14 +01:00
parent 68bb7e1ceb
commit 71f40cef1a
@@ -2182,6 +2182,17 @@ class PyReflector:
# otherwise filter dir()
ret = dir(base_type)
# remove any typing types that might be in dir() of module stubs for type hints
import typing
if inspect.ismodule(base_type):
ret = [
x
for x in ret
if not hasattr(typing, x)
or (getattr(typing, x) != getattr(base_type, x))
]
# apply the prefix filter
ret = list(
filter(lambda x: x.upper().startswith(prefix_filter.upper()), ret)