Skip to content

Commit 40646d0

Browse files
asvetlovDreamsorcererdependabot[bot]
authored
Replace AbstractMatchInfo with UrlMappingMatchInfo. (#6135)
* Replace AbstractMatchInfo with UrlMappingMatchInfo. * Create 4748.bugfix * Bump multidict from 5.1.0 to 5.2.0 (#96) Bumps [multidict](https://github.com/aio-libs/multidict) from 5.1.0 to 5.2.0. - [Release notes](https://github.com/aio-libs/multidict/releases) - [Changelog](https://github.com/aio-libs/multidict/blob/master/CHANGES.rst) - [Commits](aio-libs/multidict@v5.1.0...v5.2.0) --- updated-dependencies: - dependency-name: multidict dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump sqren/backport-github-action from 1.0.40 to 1.0.41 (#99) Bumps [sqren/backport-github-action](https://github.com/sqren/backport-github-action) from 1.0.40 to 1.0.41. - [Release notes](https://github.com/sqren/backport-github-action/releases) - [Commits](sorenlouv/backport-github-action@v1.0.40...v1.0.41) --- updated-dependencies: - dependency-name: sqren/backport-github-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump coverage from 5.5 to 6.0.1 (#100) Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.5 to 6.0.1. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](nedbat/coveragepy@coverage-5.5...6.0.1) --- updated-dependencies: - dependency-name: coverage dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump yarl from 1.6.3 to 1.7.0 (#101) Bumps [yarl](https://github.com/aio-libs/yarl) from 1.6.3 to 1.7.0. - [Release notes](https://github.com/aio-libs/yarl/releases) - [Changelog](https://github.com/aio-libs/yarl/blob/master/CHANGES.rst) - [Commits](aio-libs/yarl@v1.6.3...v1.7.0) --- updated-dependencies: - dependency-name: yarl dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump multidict from 5.1.0 to 5.2.0 (#102) Bumps [multidict](https://github.com/aio-libs/multidict) from 5.1.0 to 5.2.0. - [Release notes](https://github.com/aio-libs/multidict/releases) - [Changelog](https://github.com/aio-libs/multidict/blob/master/CHANGES.rst) - [Commits](aio-libs/multidict@v5.1.0...v5.2.0) --- updated-dependencies: - dependency-name: multidict dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pytest-cov from 2.12.1 to 3.0.0 (#98) Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.12.1 to 3.0.0. - [Release notes](https://github.com/pytest-dev/pytest-cov/releases) - [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest-cov@v2.12.1...v3.0.0) --- updated-dependencies: - dependency-name: pytest-cov dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump flake8 from 3.9.2 to 4.0.0 (#103) Bumps [flake8](https://github.com/pycqa/flake8) from 3.9.2 to 4.0.0. - [Release notes](https://github.com/pycqa/flake8/releases) - [Commits](PyCQA/flake8@3.9.2...4.0.0) --- updated-dependencies: - dependency-name: flake8 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump coverage from 6.0.1 to 6.0.2 (#104) Bumps [coverage](https://github.com/nedbat/coveragepy) from 6.0.1 to 6.0.2. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](nedbat/coveragepy@6.0.1...6.0.2) --- updated-dependencies: - dependency-name: coverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump flake8 from 4.0.0 to 4.0.1 (#105) Bumps [flake8](https://github.com/pycqa/flake8) from 4.0.0 to 4.0.1. - [Release notes](https://github.com/pycqa/flake8/releases) - [Commits](PyCQA/flake8@4.0.0...4.0.1) --- updated-dependencies: - dependency-name: flake8 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/checkout from 2.3.4 to 2.3.5 (#106) Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.4 to 2.3.5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v2.3.4...v2.3.5) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump frozenlist from 1.1.1 to 1.2.0 (#108) Bumps [frozenlist](https://github.com/aio-libs/frozenlist) from 1.1.1 to 1.2.0. - [Release notes](https://github.com/aio-libs/frozenlist/releases) - [Changelog](https://github.com/aio-libs/frozenlist/blob/master/CHANGES.rst) - [Commits](aio-libs/frozenlist@v1.1.1...v1.2.0) --- updated-dependencies: - dependency-name: frozenlist dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump frozenlist from 1.1.1 to 1.2.0 (#109) Bumps [frozenlist](https://github.com/aio-libs/frozenlist) from 1.1.1 to 1.2.0. - [Release notes](https://github.com/aio-libs/frozenlist/releases) - [Changelog](https://github.com/aio-libs/frozenlist/blob/master/CHANGES.rst) - [Commits](aio-libs/frozenlist@v1.1.1...v1.2.0) --- updated-dependencies: - dependency-name: frozenlist dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump aiosignal from 1.1.2 to 1.2.0 (#107) Bumps [aiosignal](https://github.com/aio-libs/aiosignal) from 1.1.2 to 1.2.0. - [Release notes](https://github.com/aio-libs/aiosignal/releases) - [Changelog](https://github.com/aio-libs/aiosignal/blob/master/CHANGES.rst) - [Commits](aio-libs/aiosignal@v1.1.2...v1.2.0) --- updated-dependencies: - dependency-name: aiosignal dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump aiosignal from 1.1.2 to 1.2.0 (#110) Bumps [aiosignal](https://github.com/aio-libs/aiosignal) from 1.1.2 to 1.2.0. - [Release notes](https://github.com/aio-libs/aiosignal/releases) - [Changelog](https://github.com/aio-libs/aiosignal/blob/master/CHANGES.rst) - [Commits](aio-libs/aiosignal@v1.1.2...v1.2.0) --- updated-dependencies: - dependency-name: aiosignal dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sam Bull <[email protected]> Co-authored-by: Sam Bull <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 58f86f5 commit 40646d0

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

CHANGES/4748.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Change return type on URLDispatcher to UrlMappingMatchInfo to improve type annotations.

aiohttp/web_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ async def _handle(self, request: Request) -> StreamResponse:
332332
match_info.freeze()
333333

334334
resp = None
335-
request._match_info = match_info # type: ignore[assignment]
335+
request._match_info = match_info
336336
expect = request.headers.get(hdrs.EXPECT)
337337
if expect:
338338
resp = await match_info.expect_handler(request)

aiohttp/web_middlewares.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async def _check_request_resolves(request: Request, path: str) -> Tuple[bool, Re
2323
alt_request = request.clone(rel_url=path)
2424

2525
match_info = await request.app.router.resolve(alt_request)
26-
alt_request._match_info = match_info # type: ignore[assignment]
26+
alt_request._match_info = match_info
2727

2828
if match_info.http_exception is None:
2929
return True, alt_request

aiohttp/web_urldispatcher.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282

8383

8484
_ExpectHandler = Callable[[Request], Awaitable[None]]
85-
_Resolve = Tuple[Optional[AbstractMatchInfo], Set[str]]
85+
_Resolve = Tuple[Optional["UrlMappingMatchInfo"], Set[str]]
8686

8787

8888
class _InfoDict(TypedDict, total=False):
@@ -982,7 +982,7 @@ def __init__(self) -> None:
982982
self._resources = [] # type: List[AbstractResource]
983983
self._named_resources = {} # type: Dict[str, AbstractResource]
984984

985-
async def resolve(self, request: Request) -> AbstractMatchInfo:
985+
async def resolve(self, request: Request) -> UrlMappingMatchInfo:
986986
method = request.method
987987
allowed_methods = set() # type: Set[str]
988988

@@ -992,11 +992,11 @@ async def resolve(self, request: Request) -> AbstractMatchInfo:
992992
return match_dict
993993
else:
994994
allowed_methods |= allowed
995+
996+
if allowed_methods:
997+
return MatchInfoError(HTTPMethodNotAllowed(method, allowed_methods))
995998
else:
996-
if allowed_methods:
997-
return MatchInfoError(HTTPMethodNotAllowed(method, allowed_methods))
998-
else:
999-
return MatchInfoError(HTTPNotFound())
999+
return MatchInfoError(HTTPNotFound())
10001000

10011001
def __iter__(self) -> Iterator[str]:
10021002
return iter(self._named_resources)

requirements/test.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
-r base.txt
32
Brotli==1.0.9
43
coverage==6.0.2

0 commit comments

Comments
 (0)