File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ --- venv/lib/python3.12/site-packages/aiohttp/web_urldispatcher.py 2024-08-01 13:01:32
2+ +++ /tmp/web_urldispatcher.py 2024-08-01 22:37:19
3+ @@ -1132,15 +1132,7 @@
4+ def _get_resource_index_key(self, resource: AbstractResource) -> str:
5+ """Return a key to index the resource in the resource index."""
6+ # strip at the first { to allow for variables
7+ - #return resource.canonical.partition("{")[0].rstrip("/") or "/"
8+ - if "{" in (index_key := resource.canonical):
9+ - # strip at the first { to allow for variables, and than
10+ - # rpartition at / to allow for variable parts in the path
11+ - # For example if the canonical path is `/core/locations{tail:.*}`
12+ - # the index key will be `/core` since index is based on the
13+ - # url parts split by `/`
14+ - index_key = index_key.partition("{")[0].rpartition("/")[0]
15+ - return index_key.rstrip("/") or "/"
16+ + return resource.canonical.partition("{")[0].rstrip("/") or "/"
17+
18+ def index_resource(self, resource: AbstractResource) -> None:
19+ """Add a resource to the resource index."""
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ pre-commit install
2626pre-commit install-hooks
2727pip install uv
2828uv pip install -r requirements_test.txt -r requirements_commit.txt
29+ # TODO: Remove after update of aiohttp beyond 3.10.0
30+ uv pip show aiohttp | grep -q " Version: 3.10.0" && (grep -q " core.locations" venv/lib/python* /site-packages/aiohttp/web_urldispatcher.py && echo " *** aiohttp already patched" || ( echo " Patching aiohttp 3.10.0 for tests" ; patch -tRup0 venv/lib/python* /site-packages/aiohttp/web_urldispatcher.py < patch/aiohttp310.patch && echo " *** aiohttp Patched!" || echo " *** aiohttp patch failed?" )) || ( echo " ***" ; echo " *** WE CAN REMOVE THE PATCH FOR aiohttp 3.10.0 from $0 " ; echo " ***" )
2931
3032set +u
3133
You can’t perform that action at this time.
0 commit comments