Skip to content

fix type annotations in client._generate._get_known_symbols #390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
junkmd opened this issue Dec 2, 2022 · 0 comments · Fixed by #391
Closed

fix type annotations in client._generate._get_known_symbols #390

junkmd opened this issue Dec 2, 2022 · 0 comments · Fixed by #391
Labels
good first issue Good for newcomers

Comments

@junkmd
Copy link
Collaborator

junkmd commented Dec 2, 2022

def _get_known_symbols():
# type: () -> dict[str, str]
known_symbols = {} # type: dict[str, str]
for mod_name in (
"comtypes.persist",
"comtypes.typeinfo",
"comtypes.automation",
"comtypes",
"ctypes.wintypes",
"ctypes"
):
mod = importlib.import_module(mod_name)
if hasattr(mod, "__known_symbols__"):
names = mod.__known_symbols__ # type: list[str]
else:
names = list(mod.__dict__)
for name in names:
known_symbols[name] = mod.__name__
return known_symbols

list[...] or dict[...] are used.
Use the pre-PEP585 symbols, such as from typing import List; List[...].

if TYPE_CHECKING:
from typing import Any, Tuple, List, Optional, Union as _UnionT

Currently Dict is not imported, so please change there as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant