Skip to main content

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.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

gopen-0.6.2-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file gopen-0.6.2.tar.gz.

File metadata

  • Download URL: gopen-0.6.2.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

Hashes for gopen-0.6.2.tar.gz
Algorithm Hash digest
SHA256 1310382eb8a8066f0977e2d79c27ed9556d2f96d420a37e84fb86387670f54d1
MD5 3c64b073da7ad7ce7d684557267c75f8
BLAKE2b-256 2a9195e10a40e892f1fb21b230ca29e6e52234e38ff8029f7ddc7c4d62aa9ac6

See more details on using hashes here.

File details

Details for the file gopen-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: gopen-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 3.6 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

Hashes for gopen-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eba070bd678fcc9a074b6e7f9aad58dc6f60e2b83616161e0346351731e5cefa
MD5 ff33a6ac373eace2f0aa1b61ab063f4c
BLAKE2b-256 aa7aabdfaec29a69be0f90aeaf3b40345b88625f33078dc24d4b3e6f639de15d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page