Added Python 3.5 “async for” compatibility#542
Conversation
|
|
|
OK! but i don’t get the last point. what do you mean by “supported”? we can only add one we could of course add explicit asnc generator functions, e.g.
so:
|
|
Well, Something like Does it make sense? Default iteration for StreamReader should be line-mode, sure -- like iteration over opened text file. |
|
OK, then we’re on the same page 😄 we now only need a way to indicate in the docs that those methods are only available on python 3.5. is there a sphinx directive for that? maybe we should also version-gate them? class StreamReader(...):
def __init__(self, ...):
...
if python_version > (3, 5):
def iter_any(self):
... |
|
Yes, lease use check like https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/client.py#L447 I believe just versionadded directive with text like "available for Python 3.5+ only" should be enough. We dropped Py3.3, I'm converting the doc to use async/await syntax so Py3.5 is preferable version for next release. |
|
OK. final thing for now: do i only need to document the |
|
Magic methods should not be documented itself but I would see usage example in class section, e.g. http://aiohttp.readthedocs.org/en/latest/client_reference.html#aiohttp.ClientResponse |
|
OK! |
|
hmm, i have this can i force autodoc to treat the methods of /edit: got it! |
|
I believe we should document StreamReader manually, without autodoc. |
|
maybe after this is done? |
|
ok, you can use autodoc for now if you want. |
29fa81b to
3c8ef3d
Compare
|
done. this got more complex than i thought due to tests pass, flake8 also (why the hell does it complain about “unused variable _”? every other tool recognizes that as placeholder) |
There was a problem hiding this comment.
Just drop the file.
test_py35 is not a package.
There was a problem hiding this comment.
i explained that in the file:
This file allows files in here to be called the same as other test files.
if there is e.g. /tests/test_streams and /tests/test_py35/test_streams, then /tests/test_py35/__init__.py has to exist due to the module cache. try it if you don’t believe me 😄
Hmm. Looks like a bug. I think |
Instead of while True: msg = await dataqueue.read() ... do: async for msg in dataqueue: ...
|
done! |
|
@asvetlov good to merge? |
|
@asvetlov ping |
|
Thanks! |
Instead of
do:
TODO: how to handle
EofStream?