Commit Graph

7 Commits

Author SHA1 Message Date
Mahmoud Hashemi 45c6fc24ff integrate MultiFileReader into sphinx docs 2017-07-29 19:25:17 -07:00
David Bannon 5d87249fe0
Update ioutils documentation
* Fix some typos
* Remove duplicated code from the zipfile download example
* Update the zipfile download example to use requests context manager
2017-06-23 09:44:19 +01:00
Mahmoud Hashemi fc8a694194 ioutils docs: another quick heading tweak 2017-03-18 17:25:25 -07:00
Mahmoud Hashemi 585be1a2da ioutils docs: maintain title consistency and uniqueness 2017-03-18 12:52:12 -07:00
Brant Watson c7fa81ccf5 Add more example documentation 2016-10-24 07:06:12 -05:00
Brant Watson 9b964c361c Added example documentation 2016-10-21 17:56:19 -05:00
Brant Watson 580142da3b Add ioutils module
Spooled Temporary Files are file-like objects
that start out mapped to in-memory objects, but
automatically roll over to a temporary file once
they reach a certain (configurable) threshhold.
Unfortunately the built-in SpooledTemporaryFile
class in Python does not implement the exact API
that some common classes like StringIO do.
SpooledTemporaryFile also spools all of it's in-memory
files as cStringIO instances. cStringIO instances cannot
be deep-copied, and they don't work with the zip
library either. This along with the incompatible api makes
it useless for several use-cases.

To combat this but still gain the memory savings and
usefulness of a true spooled file-like-object, two custom
classes have been implemented which have a compatible API.

SpooledBytesIO is a spooled file-like-object that only
accepts bytes. On Python 2.x this means the 'str' type; on
Python 3.x this means the 'bytes' type. Bytes are written
in and retrieved exactly as given, but it will raise TypeErrors
if something other than bytes are written.

SpooledStringIO is a spooled file-like-object that only accepts
unicode values. On Python 2.x this means the 'unicode' type and
on Python 3.x this means the 'str' type. Values are accepted as
unicode and then coerced into utf-8 encoded bytes for storage. On
retrieval, the values are returned as unicode.
2016-10-21 16:13:44 -05:00