Skip to content

Add missing type hints and fix README examples - #594

Open
pctablet505 wants to merge 1 commit into
aio-libs:masterfrom
pctablet505:fix/type-hints-and-readme-571
Open

Add missing type hints and fix README examples#594
pctablet505 wants to merge 1 commit into
aio-libs:masterfrom
pctablet505:fix/type-hints-and-readme-571

Conversation

@pctablet505

Copy link
Copy Markdown

Summary

  • Add type hints to ResourceOptions.__init__/__new__, custom_cors, CorsConfig.add/_CorsConfigImpl.add, and aiohttp_cors.setup. Several of these had = None defaults on non-Optional parameter types, which mypy's strict mode (PEP 484 implicit-optional) rejects.
  • Fix a README example that referenced ResourceOption (missing the trailing s).
  • Replace the deprecated @asyncio.coroutine decorator with async def in the README usage examples.

Fixes #571

Test plan

  • mypy --strict on the touched modules no longer reports the implicit-optional / missing-annotation errors described in the issue
  • flake8, black --check, isort --check all pass
  • pytest unit tests pass at parity with master (pre-existing failures in this environment are unrelated Python 3.14 / asyncio-mode issues already tracked by other open PRs)

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
pctablet505 marked this pull request as ready for review July 16, 2026 13:49
@pctablet505
pctablet505 marked this pull request as draft July 16, 2026 15:12
@pctablet505
pctablet505 marked this pull request as ready for review July 17, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing type hints & readme updates

1 participant