Skip to content

Commit

Permalink
Format import blocks in tools/**/*.py and _post_coinit/*.py. (ent…
Browse files Browse the repository at this point in the history
…hought#794)

* Format the import block in `_post_coinit/bstr.py`.

* Format the import block in `_post_coinit/instancemethod.py`.

* Format the import block in `_post_coinit/_cominterface_meta_patcher.py`.

* Format the import block in `tools/tlbparser.py`.

* Format the import block in `tools/typedesc_base.py`.

* Format the import block in `tools/typedesc.py`.

* Format the import block in `tools/codegenerator/namespaces.py`.

* Format the import block in `tools/codegenerator/typeannotator.py`.
  • Loading branch information
junkmd authored Feb 3, 2025
1 parent 5e26958 commit 51c930f
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 18 deletions.
1 change: 0 additions & 1 deletion comtypes/_post_coinit/_cominterface_meta_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from comtypes import patcher


_all_slice = slice(None, None, None)


Expand Down
4 changes: 2 additions & 2 deletions comtypes/_post_coinit/bstr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ctypes import _SimpleCData, WinDLL
from typing import Any, Callable, TYPE_CHECKING
from ctypes import WinDLL, _SimpleCData
from typing import TYPE_CHECKING, Any, Callable

if TYPE_CHECKING:
from comtypes import hints # type: ignore
Expand Down
3 changes: 1 addition & 2 deletions comtypes/_post_coinit/instancemethod.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ctypes import pythonapi, py_object

from ctypes import py_object, pythonapi

pythonapi.PyInstanceMethod_New.argtypes = [py_object]
pythonapi.PyInstanceMethod_New.restype = py_object
Expand Down
18 changes: 13 additions & 5 deletions comtypes/tools/codegenerator/namespaces.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
from collections import Counter
import textwrap
from typing import overload
from typing import Optional, Union as _UnionT
from typing import Dict, List, Set, Tuple
from typing import Iterator, Mapping, Sequence
import warnings
from collections import Counter
from typing import (
Dict,
Iterator,
List,
Mapping,
Optional,
Sequence,
Set,
Tuple,
overload,
)
from typing import Union as _UnionT


class ImportedNamespaces(object):
Expand Down
16 changes: 13 additions & 3 deletions comtypes/tools/codegenerator/typeannotator.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import abc
import keyword
from typing import Any, Generic, Protocol, TypeVar
from typing import Dict, List, Optional, Sequence, Tuple
from typing import Iterable, Iterator
from typing import (
Any,
Dict,
Generic,
Iterable,
Iterator,
List,
Optional,
Protocol,
Sequence,
Tuple,
TypeVar,
)

from comtypes.tools import typedesc

Expand Down
2 changes: 1 addition & 1 deletion comtypes/tools/tlbparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,9 +759,9 @@ def get_tlib_filename(tlib: typeinfo.ITypeLib) -> Optional[str]:

def _py2exe_hint():
# If the tlbparser is frozen, we need to include these
import comtypes.automation
import comtypes.persist
import comtypes.typeinfo
import comtypes.automation


# -eof-
5 changes: 3 additions & 2 deletions comtypes/tools/typedesc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
# in typedesc_base

import ctypes
from typing import Any, List, Optional, Sequence, Tuple, Union as _UnionT
from typing import Any, List, Optional, Sequence, Tuple
from typing import Union as _UnionT

from comtypes import typeinfo
from comtypes.typeinfo import ITypeLib, TLIBATTR
from comtypes.tools.typedesc_base import *
from comtypes.typeinfo import TLIBATTR, ITypeLib


class TypeLib(object):
Expand Down
4 changes: 2 additions & 2 deletions comtypes/tools/typedesc_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# typedesc.py - classes representing C type descriptions
from typing import Any, SupportsInt
from typing import List, Optional, Tuple, Union as _UnionT
from typing import Any, List, Optional, SupportsInt, Tuple
from typing import Union as _UnionT

import comtypes

Expand Down

0 comments on commit 51c930f

Please sign in to comment.