Skip to content

Commit

Permalink
Revert moving the module defining the GUID symbol. (#673)
Browse files Browse the repository at this point in the history
* Revert parts of  commit 5fbe2d4.

* Align the import section.

* Add the module-level docstring

* Add the class-level docstring
  • Loading branch information
junkmd authored Nov 28, 2024
1 parent 7b31899 commit 2dc69bd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions comtypes/_post_coinit/guid.py → comtypes/GUID.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""comtypes.GUID module"""

from ctypes import oledll, windll
from ctypes import byref, c_byte, c_ushort, c_ulong, c_wchar_p, Structure
from typing import Any, TYPE_CHECKING
Expand Down Expand Up @@ -28,6 +30,8 @@ def binary(obj: "GUID") -> bytes:


class GUID(Structure):
"""Globally unique identifier structure."""

_fields_ = [("Data1", DWORD), ("Data2", WORD), ("Data3", WORD), ("Data4", BYTE * 8)]

def __init__(self, name=None):
Expand Down
6 changes: 3 additions & 3 deletions comtypes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
else:
_CData = _SimpleCData.__mro__[:-1][-1]

from comtypes.GUID import GUID
from comtypes import patcher # noqa
from comtypes._npsupport import interop as npsupport # noqa
from comtypes._tlib_version_checker import _check_version # noqa
Expand Down Expand Up @@ -69,6 +70,8 @@ class ReturnHRESULT(Exception):
# class IDLWarning(UserWarning):
# "Warn about questionable type information"

_GUID = GUID
IID = GUID
DWORD = c_ulong

wireHWND = c_ulong
Expand Down Expand Up @@ -189,10 +192,7 @@ def CoUninitialize():
################################################################

from comtypes._post_coinit.bstr import BSTR # noqa
from comtypes._post_coinit.guid import GUID

_GUID = GUID
IID = GUID

################################################################
# IPersist is a trivial interface, which allows to ask an object about
Expand Down
4 changes: 2 additions & 2 deletions comtypes/_post_coinit/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
if TYPE_CHECKING:
from comtypes import hints as hints # noqa # type: ignore

from comtypes._memberspec import COMMETHOD
from comtypes import GUID
from comtypes import CLSCTX_SERVER, CLSCTX_LOCAL_SERVER, CLSCTX_REMOTE_SERVER
from comtypes import _ole32, oledll, DWORD
from comtypes._memberspec import COMMETHOD
from comtypes._post_coinit.unknwn import IUnknown
from comtypes._post_coinit.guid import GUID


def _is_object(obj):
Expand Down
3 changes: 1 addition & 2 deletions comtypes/_post_coinit/unknwn.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
from typing import Optional
from typing import List, Type

from comtypes import _ole32_nohresult, com_interface_registry
from comtypes import GUID, _ole32_nohresult, com_interface_registry
from comtypes._memberspec import ComMemberGenerator, DispMemberGenerator
from comtypes._memberspec import STDMETHOD, _ComMemberSpec, _DispMemberSpec
from comtypes._post_coinit import _cominterface_meta_patcher as _meta_patch
from comtypes._post_coinit.guid import GUID
from comtypes._post_coinit.instancemethod import instancemethod

logger = logging.getLogger(__name__)
Expand Down

0 comments on commit 2dc69bd

Please sign in to comment.