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

Merge drop_py2 #509

Merged
merged 51 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d7a8f28
update `appveyor.yml` (#398)
junkmd Dec 11, 2022
1b739ba
just remove trailing whitespaces (#410)
junkmd Dec 21, 2022
08d66ef
adjust comments (#411)
junkmd Dec 21, 2022
fd45ea6
adjust comments (#412)
junkmd Dec 22, 2022
9c8b59e
adjust comments (#413)
junkmd Dec 22, 2022
1ab713b
adjust comments (#414)
junkmd Dec 22, 2022
9170c21
adjust comments (#415)
junkmd Dec 23, 2022
6becabb
adjust comments (#416)
junkmd Dec 23, 2022
1dad2a9
adjust comments (#417)
junkmd Dec 23, 2022
cfaba6f
adjust comments and brackets (#420)
junkmd Dec 24, 2022
9d3906e
unify styles for `__all__` and `__known_symbols__` (#421)
junkmd Dec 25, 2022
03c244b
Improve error message on non Win (#423)
CristiFati Dec 26, 2022
ebb7757
adjust styles of `client/__init__.py` (#424)
junkmd Dec 27, 2022
449e9cb
add auto-formatter GHA triggered by PR (#427)
junkmd Dec 30, 2022
a87a226
fix GHA settings (#431)
junkmd Dec 30, 2022
7067b20
fix passing keyword arguments in `client.dynamic` (#432)
junkmd Dec 31, 2022
da25955
remove `__cmp__` methods in `client.dynamic` (#434)
junkmd Dec 31, 2022
e6f1ef1
remove `sys.version_info` bridges (#436)
junkmd Dec 31, 2022
c83ceb0
remove `hints.AnnoField` (#437)
junkmd Dec 31, 2022
2cd4d20
adjust import part and references (#439)
junkmd Dec 31, 2022
c69c763
add tests for `client.dynamic` (#440)
junkmd Jan 1, 2023
2a1e918
fix `client.dynamic._Dispatch.QueryInterface` (#442)
junkmd Jan 1, 2023
d9737d7
add type annotations other than `Dispatch` func (#444)
junkmd Jan 1, 2023
4064086
fix importing `typing` under `if TYPE_CHECKING:` (#448)
junkmd Jan 3, 2023
893f9dc
remove `sys.version_info` bridges (#449)
junkmd Jan 4, 2023
97f5db2
fix `IPersist.GetClassID` to `TYPE_CHECKING` only method from `Callab…
junkmd Jan 4, 2023
c5dc7d7
remove skip marks (#452)
junkmd Jan 5, 2023
16afa49
fix type hints to inline annotations (#453)
junkmd Jan 5, 2023
a4f51b5
change type hints from comment annotations to inline annotations in `…
junkmd Jan 6, 2023
4764081
change type hints from comment annotations to inline annotations in `…
junkmd Jan 7, 2023
d5159f1
change type hints from comment annotations to inline annotations in `…
junkmd Jan 7, 2023
ee7ae9b
Update `codegenerator` type annotations (#457)
junkmd Jan 7, 2023
d683179
Update `tlbparser` type annotations (#459)
junkmd Jan 7, 2023
1eb9a3d
Update type annotations in `typedesc` and `typedesc_base` (#461)
junkmd Jan 7, 2023
60bfc3a
remove raising `unittest.SkipTest` from `test_getactiveobj` (#462)
junkmd Jan 8, 2023
a227354
add `black` style checking to GHA settings (#465)
junkmd Jan 8, 2023
2f3dc61
modernize `test_client` (#466)
junkmd Jan 9, 2023
d384eeb
fix `__next__()` in IEnum code generator (#467)
jonschz Jan 14, 2023
9385467
correcting type hint for CreateObject (#470)
jonschz Jan 15, 2023
c4ed5de
Add unit test for generated IEnum (#468) (#471)
jonschz Jan 16, 2023
e80a0b6
make explicit the symbols that imports from the wrapper module into t…
junkmd Jan 17, 2023
5968c70
remove `'Programming Language :: Python :: 2.7'` (#483)
junkmd Jun 2, 2023
ac7126d
change `_MemberSpec`s to `NamedTuple`s (#484)
junkmd Jun 4, 2023
ae3f6e9
split `DISPPARAMS` instantiation in `IDispatch.Invoke` method with `_…
junkmd Jun 5, 2023
9941db6
477 Move clear_comtypes_cache to be a callable module (#478)
bennyrowland Jun 13, 2023
cad33e8
delint long lines (#487)
junkmd Jun 15, 2023
7ea23f3
remove `from ctypes import *` (#488)
junkmd Jun 16, 2023
63c744f
remove dead optional `for_stub` arg (#489)
junkmd Jun 16, 2023
dacd5c9
importing the wrapper-module into the friendly-module using an abstra…
junkmd Jul 12, 2023
eac707c
Fix old index bug in `call_with_inout` (#473)
jonschz Jan 10, 2024
ab05ffc
Fix rendering emojis in `CONTRIBUTING.md` and remove "Breaking troubl…
junkmd Jan 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/autofmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
pull_request:
branches: [drop_py2] # TODO: add `master`

jobs:
formatter:
name: auto-formatter
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install black
run: pip install black==22.12.0
# PRs from the forked repo will trigger format-checking only.
# Auto-commit to the branch from a forked repo will fail without
# any access tokens or permissions.
# So formatting and auto-commit will be triggered by PRs from the
# base repo only.
- if: github.repository != github.event.pull_request.head.repo.full_name
name: Check style
run: python -m black comtypes/. --check --diff --color
- if: github.repository == github.event.pull_request.head.repo.full_name
name: Format
run: python -m black comtypes/.
- if: github.repository == github.event.pull_request.head.repo.full_name
name: Auto-commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.head_ref }}
commit_message: apply automatic formatter
commit_user_name: github-actions[bot]
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
17 changes: 8 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ We appreciate all contributions, from reporting bugs to implementing new feature
## Table of contents
- [To keep the community healthy and sustainable :busts_in_silhouette:](#to-keep-the-community-healthy-and-sustainable-busts_in_silhouette)
- [Reporting bugs :bug:](#reporting-bugs-bug)
- [Breaking troubles down :flashlight:](#breaking-troubles-down-flashlight)
- [Suggesting enhancements :sparkles:](#suggesting-enhancements-sparkles)
- [Contributing to the codebase :open_file_folder:](#contributing-to-the-codebase-open_file_folder)
- [Contributing to documentation :books:](#contributing-to-documentation-books)
Expand All @@ -19,19 +18,19 @@ We appreciate all contributions, from reporting bugs to implementing new feature

If you have to understand all that this package has to offer, it would require an enormous amount of knowledge.

- `Python`:snake:
- `C`-lang:computer:
- COM interface, implementation, client and server:door:
- COM type library functionalities:wrench:
- `Python` :snake:
- `C`-lang :computer:
- COM interface, implementation, client and server :door:
- COM type library functionalities :wrench:

However, there is **no means to say** that you must understand all of these things to be a contributor.

The purpose of this document is to provide a pathway for you to contribute to this community even if you only know a small portion of this package.

Please keep the followings in your mind:
- :point_right:Please follow the following guidelines when posting a [GitHub Pull Request](https://github.com/enthought/comtypes/pulls) or filing a [GitHub Issue](https://github.com/enthought/comtypes/issues) on this project.
- :bow:The community may not be able to process and reply to your issue or PR right-away. Participants in the community have a lot of work to do besides `comtypes`, but they would try their best.
- :book:For code of conduct, please read [Contributor Covenant](https://www.contributor-covenant.org/).
- :point_right: Please follow the following guidelines when posting a [GitHub Pull Request](https://github.com/enthought/comtypes/pulls) or filing a [GitHub Issue](https://github.com/enthought/comtypes/issues) on this project.
- :bow: The community may not be able to process and reply to your issue or PR right-away. Participants in the community have a lot of work to do besides `comtypes`, but they would try their best.
- :book: For code of conduct, please read [Contributor Covenant](https://www.contributor-covenant.org/).

## Reporting bugs :bug:

Expand Down Expand Up @@ -91,7 +90,7 @@ Those `.py` files act like ”caches”.

If there are some problems with the developing code base, partial or non-executable modules might be created in `.../comtypes/gen/...`.
Importing them will cause some error.
If that happens, you should run `python -m clear_comtypes_cache` to clear those caches.
If that happens, you should run `python -m comtypes.clear_cache` to clear those caches.
The command will delete the entire `.../comtypes/gen` directory.
Importing `comtypes.client` will restore the directory and `__init__.py` file.

Expand Down
2 changes: 0 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ shallow_clone: true

environment:
matrix:
- py: Python27
- py: Python27-x64
- py: Python37
- py: Python37-x64
- py: Python38
Expand Down
57 changes: 0 additions & 57 deletions clear_comtypes_cache.py

This file was deleted.

40 changes: 14 additions & 26 deletions comtypes/GUID.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
from ctypes import *
import sys

if sys.version_info >= (2, 6):
def binary(obj):
return bytes(obj)
else:
def binary(obj):
return buffer(obj)

if sys.version_info >= (3, 0):
text_type = str
base_text_type = str
else:
text_type = unicode
base_text_type = basestring

def binary(obj):
return bytes(obj)


BYTE = c_byte
WORD = c_ushort
Expand All @@ -31,25 +22,24 @@ def binary(obj):
# Note: Comparing GUID instances by comparing their buffers
# is slightly faster than using ole32.IsEqualGUID.


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

def __init__(self, name=None):
if name is not None:
_CLSIDFromString(text_type(name), byref(self))
_CLSIDFromString(str(name), byref(self))

def __repr__(self):
return 'GUID("%s")' % text_type(self)
return 'GUID("%s")' % str(self)

def __unicode__(self):
p = c_wchar_p()
_StringFromCLSID(byref(self), byref(p))
result = p.value
_CoTaskMemFree(p)
return result

__str__ = __unicode__

def __cmp__(self, other):
Expand All @@ -61,29 +51,27 @@ def __bool__(self):
return self != GUID_null

def __eq__(self, other):
return isinstance(other, GUID) and \
binary(self) == binary(other)
return isinstance(other, GUID) and binary(self) == binary(other)

def __hash__(self):
# We make GUID instances hashable, although they are mutable.
return hash(binary(self))

def copy(self):
return GUID(text_type(self))
return GUID(str(self))

@classmethod
def from_progid(cls, progid):
"""Get guid from progid, ...
"""
"""Get guid from progid, ..."""
if hasattr(progid, "_reg_clsid_"):
progid = progid._reg_clsid_
if isinstance(progid, cls):
return progid
elif isinstance(progid, base_text_type):
elif isinstance(progid, str):
if progid.startswith("{"):
return cls(progid)
inst = cls()
_CLSIDFromProgID(text_type(progid), byref(inst))
_CLSIDFromProgID(str(progid), byref(inst))
return inst
else:
raise TypeError("Cannot construct guid from %r" % progid)
Expand Down
Loading