mosquito / aio-pika

AMQP 0.9 client designed for asyncio and humans.
https://aio-pika.readthedocs.org/
Apache License 2.0
1.18k stars 186 forks source link

Improve type hints for queue.get() #542

Closed asvetlov closed 1 year ago

asvetlov commented 1 year ago

The master assumes that the message should be checked for not-none even if fail=True (default) and None is never returned.

msg = await queue.get()
assert msg is not None

The proposal avoids the need for such asserts by using typing.Literal and method overloads.

mosquito commented 1 year ago

Hi @asvetlov glad to see you.

This is really useful fix for me, but it not keeps the project code style. So the linter job has been failed.

coveralls commented 1 year ago

Coverage Status

Coverage: 88.803% (-0.06%) from 88.862% when pulling 46645cbb8f01a39cef98f72a7e9341fbe2b05b7c on asvetlov:master into 1ccc35deca640761c449d0ee3f28c431559cf314 on mosquito:master.

mosquito commented 1 year ago

Released in aio-pika==9.0.6

asvetlov commented 1 year ago

@mosquito sorry, I didn't find a way to execute linters locally. Next time I know what to do :)

mosquito commented 1 year ago

@asvetlov just run poetry run pylama && poetry run mypy.

asvetlov commented 1 year ago

Ok, thanks for letting me know