-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify type of stream_reader_factory
#208
base: master
Are you sure you want to change the base?
Conversation
Fixes: aioresponses\compat.py:31: error: All conditional function variants must have identical signatures [misc]
Codecov Report
@@ Coverage Diff @@
## master #208 +/- ##
==========================================
+ Coverage 95.75% 95.77% +0.01%
==========================================
Files 3 3
Lines 283 284 +1
==========================================
+ Hits 271 272 +1
Misses 12 12
Continue to review full report at Codecov.
|
|
||
stream_reader_factory: Callable[ | ||
[Optional[asyncio.AbstractEventLoop]], StreamReader | ||
] | ||
if AIOHTTP_VERSION >= parse_version('3.0.0'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If mypy reports that error: All conditional function variants must have identical signatures [misc]
, wouldn't it be better to just add correct type annotations to both variants of stream_reader_factory
?
if AIOHTTP_VERSION >= parse_version('3.0.0'):
from aiohttp.client_proto import ResponseHandler
def stream_reader_factory(
loop: Optional[asyncio.AbstractEventLoop] = None
) -> StreamReader:
protocol = ResponseHandler(loop=loop)
return StreamReader(protocol, limit=2 ** 16, loop=loop)
else:
def stream_reader_factory(
loop: Optional[asyncio.AbstractEventLoop] = None
) -> StreamReader:
return StreamReader()
Actually, this whole |
You're right. Merging #224 would make this PR obsolete :) |
Fixes mypy warning