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

fix client.GetClassObject type annotations and add tests #458

Open
junkmd opened this issue Jan 7, 2023 · 1 comment
Open

fix client.GetClassObject type annotations and add tests #458

junkmd opened this issue Jan 7, 2023 · 1 comment
Labels
good first issue Good for newcomers

Comments

@junkmd
Copy link
Collaborator

junkmd commented Jan 7, 2023

Remaining tasks for #456.

if TYPE_CHECKING:
@overload
def GetClassObject(progid, clsctx=None, pServerInfo=None):
# type: (_UnionT[str, CoClass, GUID], Optional[int], Optional[comtypes.COSERVERINFO]) -> hints.IClassFactory
pass
@overload
def GetClassObject(progid, clsctx=None, pServerInfo=None, interface=None):
# type: (_UnionT[str, CoClass, GUID], Optional[int], Optional[comtypes.COSERVERINFO], Optional[Type[_T_IUnknown]]) -> _T_IUnknown
pass
def GetClassObject(progid, clsctx=None, pServerInfo=None, interface=None):
# type: (_UnionT[str, CoClass, GUID], Optional[int], Optional[comtypes.COSERVERINFO], Optional[Type[IUnknown]]) -> IUnknown
"""Create and return the class factory for a COM object.
'clsctx' specifies how to create the object, use the CLSCTX_... constants.
'pServerInfo', if used, must be a pointer to a comtypes.COSERVERINFO instance
'interface' may be used to request an interface other than IClassFactory
"""
clsid = GUID.from_progid(progid)
return comtypes.CoGetClassObject(clsid, clsctx, pServerInfo, interface)

I hope someone who actually uses client.GetClassObject will PR along with the introduction of use cases, because I had not use this function.

@junkmd junkmd added good first issue Good for newcomers drop_py2 dev based on supporting only Python3, see #392 labels Jan 7, 2023
@junkmd
Copy link
Collaborator Author

junkmd commented Jan 7, 2023

This is related to #453.

Since comtypes.CoGetClassObject is also untested, we should avoid a situation where no tests without using unittest.mock.patch.

@junkmd junkmd removed the drop_py2 dev based on supporting only Python3, see #392 label Feb 5, 2024
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

No branches or pull requests

1 participant