Skip to content

Commit 2dc69bd

Browse files
authored
Revert moving the module defining the GUID symbol. (#673)
* Revert parts of commit 5fbe2d4. * Align the import section. * Add the module-level docstring * Add the class-level docstring
1 parent 7b31899 commit 2dc69bd

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""comtypes.GUID module"""
2+
13
from ctypes import oledll, windll
24
from ctypes import byref, c_byte, c_ushort, c_ulong, c_wchar_p, Structure
35
from typing import Any, TYPE_CHECKING
@@ -28,6 +30,8 @@ def binary(obj: "GUID") -> bytes:
2830

2931

3032
class GUID(Structure):
33+
"""Globally unique identifier structure."""
34+
3135
_fields_ = [("Data1", DWORD), ("Data2", WORD), ("Data3", WORD), ("Data4", BYTE * 8)]
3236

3337
def __init__(self, name=None):

comtypes/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
else:
3636
_CData = _SimpleCData.__mro__[:-1][-1]
3737

38+
from comtypes.GUID import GUID
3839
from comtypes import patcher # noqa
3940
from comtypes._npsupport import interop as npsupport # noqa
4041
from comtypes._tlib_version_checker import _check_version # noqa
@@ -69,6 +70,8 @@ class ReturnHRESULT(Exception):
6970
# class IDLWarning(UserWarning):
7071
# "Warn about questionable type information"
7172

73+
_GUID = GUID
74+
IID = GUID
7275
DWORD = c_ulong
7376

7477
wireHWND = c_ulong
@@ -189,10 +192,7 @@ def CoUninitialize():
189192
################################################################
190193

191194
from comtypes._post_coinit.bstr import BSTR # noqa
192-
from comtypes._post_coinit.guid import GUID
193195

194-
_GUID = GUID
195-
IID = GUID
196196

197197
################################################################
198198
# IPersist is a trivial interface, which allows to ask an object about

comtypes/_post_coinit/misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
if TYPE_CHECKING:
1616
from comtypes import hints as hints # noqa # type: ignore
1717

18-
from comtypes._memberspec import COMMETHOD
18+
from comtypes import GUID
1919
from comtypes import CLSCTX_SERVER, CLSCTX_LOCAL_SERVER, CLSCTX_REMOTE_SERVER
2020
from comtypes import _ole32, oledll, DWORD
21+
from comtypes._memberspec import COMMETHOD
2122
from comtypes._post_coinit.unknwn import IUnknown
22-
from comtypes._post_coinit.guid import GUID
2323

2424

2525
def _is_object(obj):

comtypes/_post_coinit/unknwn.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
from typing import Optional
88
from typing import List, Type
99

10-
from comtypes import _ole32_nohresult, com_interface_registry
10+
from comtypes import GUID, _ole32_nohresult, com_interface_registry
1111
from comtypes._memberspec import ComMemberGenerator, DispMemberGenerator
1212
from comtypes._memberspec import STDMETHOD, _ComMemberSpec, _DispMemberSpec
1313
from comtypes._post_coinit import _cominterface_meta_patcher as _meta_patch
14-
from comtypes._post_coinit.guid import GUID
1514
from comtypes._post_coinit.instancemethod import instancemethod
1615

1716
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)