Skip to content

[Issue #390]added the client._generate._get_known_symbols #391

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

Merged
merged 10 commits into from
Dec 7, 2022
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ coverage.xml
docs/_build/


custom location
.vscode


10 changes: 6 additions & 4 deletions comtypes/client/_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from comtypes.tools import codegenerator, tlbparser

if TYPE_CHECKING:
from typing import Any, Tuple, List, Optional, Union as _UnionT
from typing import Any, Tuple, List, Optional, Dict, Union as _UnionT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍



logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -247,8 +247,9 @@ def _create_wrapper_module(tlib, pathname):


def _get_known_symbols():
# type: () -> dict[str, str]
known_symbols = {} # type: dict[str, str]
# type: () -> Dict[str,str]

known_symbols = {} # type: Dict[str, str]
for mod_name in (
"comtypes.persist",
"comtypes.typeinfo",
Expand All @@ -259,7 +260,7 @@ def _get_known_symbols():
):
mod = importlib.import_module(mod_name)
if hasattr(mod, "__known_symbols__"):
names = mod.__known_symbols__ # type: list[str]
names = mod.__known_symbols__ # type: List[str]
else:
names = list(mod.__dict__)
for name in names:
Expand All @@ -268,6 +269,7 @@ def _get_known_symbols():

################################################################


if __name__ == "__main__":
# When started as script, generate typelib wrapper from .tlb file.
GetModule(sys.argv[1])