requests-cache / aiohttp-client-cache

An async persistent cache for aiohttp requests
MIT License
118 stars 20 forks source link

fix: suppress Mypy error #202

Closed alessio-locatelli closed 11 months ago

alessio-locatelli commented 11 months ago
mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

aiohttp_client_cache/response.py:136: error: Cannot override writeable attribute with read-only property  [override]
aiohttp_client_cache/response.py:136: error: Signature of "_headers" incompatible with supertype "HeadersMixin"  [override]
aiohttp_client_cache/response.py:136: note:      Superclass:
aiohttp_client_cache/response.py:136: note:          MultiMapping[str]
aiohttp_client_cache/response.py:136: note:      Subclass:
aiohttp_client_cache/response.py:136: note:          CIMultiDictProxy[str]
Found 2 errors in 1 file (checked 38 source files)

Based on the code, I decided that you override a returned type intentionally, so instead of changing a type I suppressed a warning.

JWCook commented 11 months ago

Hmm, I thought that matched the original type here (and note here), but maybe the signature changed in aiohttp 3.9.0? Either way, ignoring it seems fine, since MultiMapping is just the abstract base class used by multidict. Thanks!