Package: apyio
=====apyio=====*Async wrappers for standard Python io streams.*Example Usage=============For simple use cases this package provides the same high level utilities asthe Python `io` module:.. code-block:: pythonimport apyiostring_buff = apyio.StringIO()bytes_buff = apyio.BytesIO()file_handle = apyio.open('somefile.txt', 'r')The `write`, `writelines`, and `close` methods are left as normal functionsjust as they are for the asyncio streams. However, any function which mightresult in a read operation, such as `read`, `readline`, `readlines`, `read1`,`seek`, `tell`, and `truncate`, are now `async def` functions that must be`await`ed... code-block:: pythonimport apyioasync with apyio.open('somefile.txt', 'w') as file_handle:file_handle.write('some data')await file_handle.drain()  # Same as flush().async with apyio.open('somefile.txt', 'r') as file_handle:data = await file_handle.read()print(data)file_handle = apyio.open('somefile.txt', 'r')async for line in file_handle:print(line)For more advanced use cases, this package also contains async wrappers for allclasses defined in the Python `io` module. The wrappers are named using thepattern `Async<>Wrapper`. For example, `BufferedReader` becomes`AsyncBufferedReaderWrapper` and `FileIO` becomes `AsyncFileIOWrapper`. Allwrapper classes accept one argument in the constructor which must be theoriginal, synchronous stream... code-block:: pythonimport ioimport apyiosync_stream = io.FileIO('somefile.txt', 'r')async_stream = apyio.AsyncFileIOWrapper(sync_stream)print(sync_stream.readline())print((await async_stream.readline()))If a file was opened using the built-in `open()` function it may not be aninstance of `io.FileIO`. Depending on the options given to `open()` differentkinds of streams may be returned. To help with wrapping arbitrary `open()`return values use the `apyio.wrap_file()` helper... code-block:: pythonimport apyiofile_handle = open('somefile.bin', 'r+b')async_handle = apyio.wrap_file(file_handle)Testing=======All tests are stored in the '/tests' subdirectory. All tests are expected topass for Python 3.5 and above. To run tests create a virtualenv and installthe test-requirements.txt list. After that using the `tox` command will launchthe test suite.License=======Copyright 2015 Kevin ConwayLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.Contributing============Firstly, if you're putting in a patch then thank you! Here are some tips forgetting your patch merged:Style-----As long as the code passes the PEP8 and PyFlakes gates then the style isacceptable.Docs----The PEP257 gate will check that all public methods have docstrings. If you'readding additional wrappers from the `io` module try to preserve the originaldocstrings if possible. If you're adding something new, like a helper function,try out the`napoleon style of docstrings <https://pypi.python.org/pypi/sphinxcontrib-napoleon>`_.Tests-----Make sure the patch passes all the tests. If you're adding a new feature don'tforget to throw in a test or two. If you're fixing a bug then definitely addat least one test to prevent regressions.