Skip to content
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

Remove for_stub=True conditional branch from the tools.codegenerator.ImportedNamespaces.getvalue #463

Closed
junkmd opened this issue Jan 8, 2023 · 0 comments · Fixed by #489
Labels
drop_py2 dev based on supporting only Python3, see #392 good first issue Good for newcomers
Milestone

Comments

@junkmd
Copy link
Collaborator

junkmd commented Jan 8, 2023

THIS IS FOR drop_py2 PLAN! Please see #392.

The ImportedNamespaces is a "sprout class" that generates import parts strings of comtypes.gen._xxxxxxxxxxxx_xxxxxxxx_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxx_x_x_x.

In the past, an optional argument for_stub is added to the getvalues method, since we were trying to add the functionality to generate type stubs at the same time as the executable module under the comtypes.gen(#355).

def getvalue(self, for_stub=False):

However, as you can see in #400, the plan has been revised and type hints will be added to executable modules with inline annotations as part of the drop_py2 plan.

So it is no longer necessary to take a for_stub argument or conditional branch based on it.

Also, the following doctests are no longer required.

>>> print(imports.getvalue(for_stub=True))
from ctypes import *
import datetime
from decimal import Decimal as Decimal
from comtypes import (
BSTR as BSTR,
CoClass as CoClass,
COMMETHOD as COMMETHOD,
dispid as dispid,
DISPMETHOD as DISPMETHOD,
DISPPROPERTY as DISPPROPERTY,
GUID as GUID,
IUnknown as IUnknown,
)
import ctypes.wintypes

Before PR, run python -m doctest -v comtypes/tools/codegenerator.py and make sure the test passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
drop_py2 dev based on supporting only Python3, see #392 good first issue Good for newcomers
Projects
None yet
1 participant