Add missing type hints and fix README examples - #594
Open
pctablet505 wants to merge 1 commit into
Open
Conversation
ResourceOptions, custom_cors, and CorsConfig.add/setup accepted Optional-typed defaults without declaring Optional, which mypy --strict rejects (PEP 484 implicit-optional). Add proper parameter and return annotations. Also fix the README: a code example used ResourceOption instead of ResourceOptions, and replace the deprecated @asyncio.coroutine decorator with async def in the usage examples. Fixes aio-libs#571
pctablet505
marked this pull request as ready for review
July 16, 2026 13:49
pctablet505
marked this pull request as draft
July 16, 2026 15:12
pctablet505
marked this pull request as ready for review
July 17, 2026 12:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ResourceOptions.__init__/__new__,custom_cors,CorsConfig.add/_CorsConfigImpl.add, andaiohttp_cors.setup. Several of these had= Nonedefaults on non-Optionalparameter types, which mypy's strict mode (PEP 484 implicit-optional) rejects.ResourceOption(missing the trailings).@asyncio.coroutinedecorator withasync defin the README usage examples.Fixes #571
Test plan
mypy --stricton the touched modules no longer reports the implicit-optional / missing-annotation errors described in the issueflake8,black --check,isort --checkall passpytestunit tests pass at parity withmaster(pre-existing failures in this environment are unrelated Python 3.14 / asyncio-mode issues already tracked by other open PRs)