gopen
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.
Example:
>>> f = open('txt', 'r')
>>> for source in ['txt', 'txt.gz', 'txt.bz2', f]:
... print('%r (%r)' % (list(gread(source)), source))
...
['Simple is\n', 'better than complex.'] ('txt')
['Simple is\n', 'better than complex.'] ('txt.gz')
['Simple is\n', 'better than complex.'] ('txt.bz2')
['Simple is\n', 'better than complex.'] (<_io.TextIOWrapper name='txt' mode='r' encoding='UTF-8'>)
>>> f.closed
False
Changes
0.6 (2019-05-27)
Python3 only (>= 3.4)
Metadata
Release files for gopen 0.6.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gopen-0.6.5.tar.gz | 4.2 kB | Without provenance | Details for gopen-0.6.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gopen-0.6.5-py3-none-any.whl | Python 3 | none | any | Details for gopen-0.6.5-py3-none-any.whl |
Total release size: 8.2 kB
Release files / gopen-0.6.5.tar.gz
| Download URL | gopen-0.6.5.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa7272782b4fa30ec05d098b8d831899b0e3560a2755ddc42a31c1d28315a6d5
|
|
BLAKE2b-256 checksum How to use checksums |
34422d4af87c247b5ac489fce8bb5db1dfd31a74dfcc48984df0db480209076e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7
|
Release files / gopen-0.6.5-py3-none-any.whl
| Download URL | gopen-0.6.5-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c2c7c968e4cbc7e1f556f528e323c1abdd0227ee671bb3ada48018129308ba8
|
|
BLAKE2b-256 checksum How to use checksums |
aa4c5667d43ae13b17e9fe4a387c824ce7c19f4947f8ea2f14e439f05b116eb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7
|
Security for gopen 0.6.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.