diff --git a/aiohttp_session/__init__.py b/aiohttp_session/__init__.py index d301e2b6..4d238335 100644 --- a/aiohttp_session/__init__.py +++ b/aiohttp_session/__init__.py @@ -57,7 +57,7 @@ def __init__( new: bool, max_age: Optional[int] = None, ) -> None: - self._changed = False + self._changed: bool = False self._mapping: Dict[str, Any] = {} self._identity = identity if data != {} else None self._new = new if data != {} else True diff --git a/demo/login_required_example.py b/demo/login_required_example.py index eba7f269..ccb64920 100644 --- a/demo/login_required_example.py +++ b/demo/login_required_example.py @@ -30,7 +30,7 @@ async def wrapped( # actually load user from your database (e.g. with aiopg) user = DATABASE[user_id] app["user"] = user - return await fn(request, *args, **kwargs) # type: ignore[call-arg] + return await fn(request, *args, **kwargs) return wrapped diff --git a/requirements-dev.txt b/requirements-dev.txt index 0025c144..fc8608dd 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -12,7 +12,7 @@ flake8-bugbear==21.11.29 flake8-import-order==0.18.1 flake8-requirements==1.5.1 multidict==5.2.0 -mypy==0.910 +mypy==0.930 pep257==0.7.0 pre-commit==2.16.0 pynacl==1.4.0 diff --git a/tests/test_session_dict.py b/tests/test_session_dict.py index b6f6ffde..13b329de 100644 --- a/tests/test_session_dict.py +++ b/tests/test_session_dict.py @@ -85,7 +85,8 @@ def test_invalidate() -> None: s.invalidate() assert s == cast(MutableMapping[str, Any], {}) assert s._changed - assert s.created is not None + # Mypy bug: https://github.com/python/mypy/issues/11853 + assert s.created is not None # type: ignore[unreachable] def test_invalidate2() -> None: @@ -96,7 +97,8 @@ def test_invalidate2() -> None: s.invalidate() assert s == cast(MutableMapping[str, Any], {}) assert s._changed - assert s.created is not None + # Mypy bug: https://github.com/python/mypy/issues/11853 + assert s.created is not None # type: ignore[unreachable] def test_operations() -> None: @@ -153,5 +155,6 @@ def test_change() -> None: s.changed() assert s._changed + # Mypy bug: https://github.com/python/mypy/issues/11853 + assert s.created == created # type: ignore[unreachable] assert cast(MutableMapping[str, Any], {"a": {"key": "value", "key2": "val2"}}) == s - assert s.created == created