A generic context manager for readable files.
Project description
Provides the gopen.readable() and gopen.gread() functions.
readable(source) supports with statements for readable file objects:
>>> with gopen.readable(source) as f: >>> <read from f>
gread(source) returns an iterator over input lines:
>>> from gopen import gread >>> lines = gread(source) >>> lines <generator object gread at 0x7f45752ebf10>
<source> can be:
a readable file object,
a file descriptor and
a file pathname.
gzip and bzip2-compressed files will be decompressed on the fly. No side effects: if source is a file descriptor or a file handle, it will not be closed.
Changes
0.6 (2019-05-27)
Python3 only (>= 3.4)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gopen-0.6.3.tar.gz
(3.9 kB
view details)
Built Distribution
gopen-0.6.3-py3-none-any.whl
(3.7 kB
view details)
File details
Details for the file gopen-0.6.3.tar.gz
.
File metadata
- Download URL: gopen-0.6.3.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
ece903f6c24e848e878b1967f1c5c5810bab28e9815640386c6c9a0fe5547553
|
|
MD5 |
e97b544a53f2eec3fca392259ae34d17
|
|
BLAKE2b-256 |
cc708851526063f4a345f6f0fc2dbfe7ba63354a70bdfbdb41a9aa5e66b162b4
|
File details
Details for the file gopen-0.6.3-py3-none-any.whl
.
File metadata
- Download URL: gopen-0.6.3-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
aabf5105ac4392df42771403330d43b619a335aa7e7c476217180fd109be15e1
|
|
MD5 |
65ff01bcc9227d6b03ebfa9a46250236
|
|
BLAKE2b-256 |
4a915fe1351716febc52bbc111926cf0e601cf96d3bcaaf1ede03feb9365c0c2
|