Skip to content

Commit

Permalink
Replace AbstractMatchInfo with UrlMappingMatchInfo. (#6135)
Browse files Browse the repository at this point in the history
* 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] <support@github.com>

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] <support@github.com>

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] <support@github.com>

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] <support@github.com>

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] <support@github.com>

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] <support@github.com>

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] <support@github.com>

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] <support@github.com>

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] <support@github.com>

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] <support@github.com>

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] <support@github.com>

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] <support@github.com>

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] <support@github.com>

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] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Co-authored-by: Sam Bull <git@sambull.org>
Co-authored-by: Sam Bull <aa6bs0@sambull.org>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
4 people committed Oct 27, 2021
1 parent 58f86f5 commit 40646d0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES/4748.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change return type on URLDispatcher to UrlMappingMatchInfo to improve type annotations.
2 changes: 1 addition & 1 deletion aiohttp/web_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ async def _handle(self, request: Request) -> StreamResponse:
match_info.freeze()

resp = None
request._match_info = match_info # type: ignore[assignment]
request._match_info = match_info
expect = request.headers.get(hdrs.EXPECT)
if expect:
resp = await match_info.expect_handler(request)
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/web_middlewares.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async def _check_request_resolves(request: Request, path: str) -> Tuple[bool, Re
alt_request = request.clone(rel_url=path)

match_info = await request.app.router.resolve(alt_request)
alt_request._match_info = match_info # type: ignore[assignment]
alt_request._match_info = match_info

if match_info.http_exception is None:
return True, alt_request
Expand Down
12 changes: 6 additions & 6 deletions aiohttp/web_urldispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@


_ExpectHandler = Callable[[Request], Awaitable[None]]
_Resolve = Tuple[Optional[AbstractMatchInfo], Set[str]]
_Resolve = Tuple[Optional["UrlMappingMatchInfo"], Set[str]]


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

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

Expand All @@ -992,11 +992,11 @@ async def resolve(self, request: Request) -> AbstractMatchInfo:
return match_dict
else:
allowed_methods |= allowed

if allowed_methods:
return MatchInfoError(HTTPMethodNotAllowed(method, allowed_methods))
else:
if allowed_methods:
return MatchInfoError(HTTPMethodNotAllowed(method, allowed_methods))
else:
return MatchInfoError(HTTPNotFound())
return MatchInfoError(HTTPNotFound())

def __iter__(self) -> Iterator[str]:
return iter(self._named_resources)
Expand Down
1 change: 0 additions & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

-r base.txt
Brotli==1.0.9
coverage==6.0.2
Expand Down

0 comments on commit 40646d0

Please sign in to comment.