Skip to content

Commit

Permalink
add types to io_windows (#2761)
Browse files Browse the repository at this point in the history
* add types to io_windows

* add changes to gen_exports

* Statically type some Windows CFFI functions

* This accepts any value, not bools

* Update some configuration

* Type the stuff

* Update verify_types files

* CRLF -> LF

* Try to fix CI warnings

* Bunch of stupid type ignores

* Update pip-compile'd files

* Woes of working on Windows

* PR comments

* regen io_windows and verify_types

* remove redundant Mapping import

* Attempt to fix some type errors

* Oops; update type completeness file

* PR review pass 1

* Update `verify_types_windows.json`

---------

Co-authored-by: Spencer Brown <spencerb21@live.com>
Co-authored-by: A5rocks <git@helvetica.moe>
Co-authored-by: CoolCat467 <52022020+CoolCat467@users.noreply.github.com>
  • Loading branch information
4 people authored Sep 25, 2023
1 parent 1e8327b commit 4ee5413
Show file tree
Hide file tree
Showing 12 changed files with 449 additions and 265 deletions.
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ disallow_untyped_calls = false
# files not yet fully typed
[[tool.mypy.overrides]]
module = [
# 2761
"trio/_core/_generated_io_windows",
"trio/_core/_io_windows",

# internal
"trio/_windows_pipes",

Expand Down
1 change: 1 addition & 0 deletions test-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ codespell
# https://github.com/python-trio/trio/pull/654#issuecomment-420518745
mypy-extensions; implementation_name == "cpython"
typing-extensions
types-cffi; implementation_name == "cpython"

# Trio's own dependencies
cffi; os_name == "nt"
Expand Down
4 changes: 4 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ tomlkit==0.12.1
# via pylint
trustme==1.1.0
# via -r test-requirements.in
types-cffi==1.15.1.15 ; implementation_name == "cpython"
# via -r test-requirements.in
types-pyopenssl==23.2.0.2 ; implementation_name == "cpython"
# via -r test-requirements.in
types-setuptools==68.1.0.0
# via types-cffi
typing-extensions==4.7.1
# via
# -r test-requirements.in
Expand Down
38 changes: 26 additions & 12 deletions trio/_core/_generated_io_windows.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion trio/_core/_io_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

if TYPE_CHECKING:
from ._io_epoll import EpollWaiters
from ._io_windows import AFDWaiters


# Utility function shared between _io_epoll and _io_windows
def wake_all(waiters: EpollWaiters, exc: BaseException) -> None:
def wake_all(waiters: EpollWaiters | AFDWaiters, exc: BaseException) -> None:
try:
current_task = _core.current_task()
except RuntimeError:
Expand Down
Loading

0 comments on commit 4ee5413

Please sign in to comment.