From bbdd3bf0fde3bd02209ee5f915e95153d9ea31cc Mon Sep 17 00:00:00 2001 From: David Lord Date: Fri, 1 Apr 2022 12:40:17 -0700 Subject: [PATCH 1/2] update requirements --- .pre-commit-config.yaml | 8 ++++---- requirements/dev.txt | 14 +++++++------- requirements/docs.txt | 12 ++++++------ requirements/tests.txt | 8 ++++---- requirements/typing.txt | 10 +++++----- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 557033fab..144698549 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,12 +3,12 @@ ci: autoupdate_schedule: monthly repos: - repo: https://github.com/asottile/pyupgrade - rev: v2.31.0 + rev: v2.31.1 hooks: - id: pyupgrade args: ["--py37-plus"] - repo: https://github.com/asottile/reorder_python_imports - rev: v2.7.1 + rev: v3.0.1 hooks: - id: reorder-python-imports name: Reorder Python imports (src, tests) @@ -21,7 +21,7 @@ repos: args: ["--application-directories", "examples"] additional_dependencies: ["setuptools>60.9"] - repo: https://github.com/psf/black - rev: 22.1.0 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 @@ -32,7 +32,7 @@ repos: - flake8-bugbear - flake8-implicit-str-concat - repo: https://github.com/peterdemin/pip-compile-multi - rev: v2.4.3 + rev: v2.4.4 hooks: - id: pip-compile-multi-verify - repo: https://github.com/pre-commit/pre-commit-hooks diff --git a/requirements/dev.txt b/requirements/dev.txt index 2a5368609..54fe3e8d1 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -10,29 +10,29 @@ -r typing.txt cfgv==3.3.1 # via pre-commit -click==8.0.3 +click==8.1.2 # via # pip-compile-multi # pip-tools distlib==0.3.4 # via virtualenv -filelock==3.4.2 +filelock==3.6.0 # via # tox # virtualenv greenlet==1.1.2 ; python_version < "3.11" # via -r requirements/tests.in -identify==2.4.8 +identify==2.4.12 # via pre-commit nodeenv==1.6.0 # via pre-commit pep517==0.12.0 # via pip-tools -pip-compile-multi==2.4.3 +pip-compile-multi==2.4.4 # via -r requirements/dev.in -pip-tools==6.5.0 +pip-tools==6.5.1 # via pip-compile-multi -platformdirs==2.4.1 +platformdirs==2.5.1 # via virtualenv pre-commit==2.17.0 # via -r requirements/dev.in @@ -50,7 +50,7 @@ toposort==1.7 # via pip-compile-multi tox==3.24.5 # via -r requirements/dev.in -virtualenv==20.13.1 +virtualenv==20.14.0 # via # pre-commit # tox diff --git a/requirements/docs.txt b/requirements/docs.txt index 8d714854c..8b24c6f31 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -11,7 +11,7 @@ babel==2.9.1 # via sphinx certifi==2021.10.8 # via requests -charset-normalizer==2.0.11 +charset-normalizer==2.0.12 # via requests docutils==0.17.1 # via sphinx @@ -19,9 +19,9 @@ idna==3.3 # via requests imagesize==1.3.0 # via sphinx -jinja2==3.0.3 +jinja2==3.1.1 # via sphinx -markupsafe==2.0.1 +markupsafe==2.1.1 # via jinja2 packaging==21.3 # via @@ -33,13 +33,13 @@ pygments==2.11.2 # via sphinx pyparsing==3.0.7 # via packaging -pytz==2021.3 +pytz==2022.1 # via babel requests==2.27.1 # via sphinx snowballstemmer==2.2.0 # via sphinx -sphinx==4.4.0 +sphinx==4.5.0 # via # -r requirements/docs.in # pallets-sphinx-themes @@ -61,5 +61,5 @@ sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.5 # via sphinx -urllib3==1.26.8 +urllib3==1.26.9 # via requests diff --git a/requirements/tests.txt b/requirements/tests.txt index 1809a563e..66c687af4 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -9,7 +9,7 @@ attrs==21.4.0 # via pytest cffi==1.15.0 # via cryptography -cryptography==36.0.1 +cryptography==36.0.2 # via -r requirements/tests.in ephemeral-port-reserve==1.1.4 # via -r requirements/tests.in @@ -29,7 +29,7 @@ pycparser==2.21 # via cffi pyparsing==3.0.7 # via packaging -pytest==7.0.0 +pytest==7.1.1 # via # -r requirements/tests.in # pytest-timeout @@ -38,7 +38,7 @@ pytest-timeout==2.1.0 # via -r requirements/tests.in pytest-xprocess==0.18.1 # via -r requirements/tests.in -tomli==2.0.0 +tomli==2.0.1 # via pytest -watchdog==2.1.6 +watchdog==2.1.7 # via -r requirements/tests.in diff --git a/requirements/typing.txt b/requirements/typing.txt index 6d868f7c7..1e3b1ba83 100644 --- a/requirements/typing.txt +++ b/requirements/typing.txt @@ -5,17 +5,17 @@ # # pip-compile-multi # -mypy==0.931 +mypy==0.942 # via -r requirements/typing.in mypy-extensions==0.4.3 # via mypy -tomli==2.0.0 +tomli==2.0.1 # via mypy -types-contextvars==2.4.2 +types-contextvars==2.4.4 # via -r requirements/typing.in types-dataclasses==0.6.4 # via -r requirements/typing.in -types-setuptools==57.4.9 +types-setuptools==57.4.11 # via -r requirements/typing.in -typing-extensions==4.0.1 +typing-extensions==4.1.1 # via mypy From 7df72f9143ce9e56a4cc5194aaeb882f696b6ce4 Mon Sep 17 00:00:00 2001 From: David Lord Date: Fri, 1 Apr 2022 12:51:34 -0700 Subject: [PATCH 2/2] fix latest mypy findings --- src/werkzeug/datastructures.pyi | 21 +++++++++++++++------ src/werkzeug/local.py | 2 +- src/werkzeug/routing.py | 6 ++---- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/werkzeug/datastructures.pyi b/src/werkzeug/datastructures.pyi index 9fefa0a1e..6050f3508 100644 --- a/src/werkzeug/datastructures.pyi +++ b/src/werkzeug/datastructures.pyi @@ -20,6 +20,7 @@ from typing import Tuple from typing import Type from typing import TypeVar from typing import Union +from _typeshed import SupportsKeysAndGetItem from _typeshed.wsgi import WSGIEnvironment from typing_extensions import Literal @@ -96,9 +97,12 @@ class UpdateDictMixin(Dict[K, V]): def __delitem__(self, key: K) -> None: ... def clear(self) -> None: ... def popitem(self) -> Tuple[K, V]: ... - def update( - self, *args: Union[Mapping[K, V], Iterable[Tuple[K, V]]], **kwargs: V - ) -> None: ... + @overload + def update(self, __m: SupportsKeysAndGetItem[K, V], **kwargs: V) -> None: ... + @overload + def update(self, __m: Iterable[Tuple[K, V]], **kwargs: V) -> None: ... + @overload + def update(self, **kwargs: V) -> None: ... class TypeConversionDict(Dict[K, V]): @overload @@ -274,11 +278,16 @@ class Headers(Dict[str, str]): def __setitem__(self, key: int, value: Tuple[str, HV]) -> None: ... @overload def __setitem__(self, key: slice, value: Iterable[Tuple[str, HV]]) -> None: ... + @overload def update( - self, - *args: Union[Mapping[str, HV], Iterable[Tuple[str, HV]]], - **kwargs: Union[HV, Iterable[HV]], + self, __m: SupportsKeysAndGetItem[str, HV], **kwargs: Union[HV, Iterable[HV]] + ) -> None: ... + @overload + def update( + self, __m: Iterable[Tuple[str, HV]], **kwargs: Union[HV, Iterable[HV]] ) -> None: ... + @overload + def update(self, **kwargs: Union[HV, Iterable[HV]]) -> None: ... def to_wsgi_list(self) -> List[Tuple[str, str]]: ... def copy(self) -> Headers: ... def __copy__(self) -> Headers: ... diff --git a/src/werkzeug/local.py b/src/werkzeug/local.py index 7c584aefd..e297f3836 100644 --- a/src/werkzeug/local.py +++ b/src/werkzeug/local.py @@ -280,7 +280,7 @@ def __get__(self, instance: "LocalProxy", owner: t.Optional[type] = None) -> t.A if self.fallback is None: raise - fallback = self.fallback.__get__(instance, owner) # type: ignore + fallback = self.fallback.__get__(instance, owner) if self.is_attr: # __class__ and __doc__ are attributes, not methods. diff --git a/src/werkzeug/routing.py b/src/werkzeug/routing.py index 49e4449e1..1d3027b6d 100644 --- a/src/werkzeug/routing.py +++ b/src/werkzeug/routing.py @@ -882,11 +882,9 @@ def _build_regex(rule: str) -> None: self._trace.append((False, "/")) self._build: t.Callable[..., t.Tuple[str, str]] - self._build = self._compile_builder(False).__get__(self, None) # type: ignore + self._build = self._compile_builder(False).__get__(self, None) self._build_unknown: t.Callable[..., t.Tuple[str, str]] - self._build_unknown = self._compile_builder(True).__get__( # type: ignore - self, None - ) + self._build_unknown = self._compile_builder(True).__get__(self, None) if self.build_only: return