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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: gopen-0.6.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for gopen-0.6.tar.gz
Algorithm Hash digest
SHA256 96bbce30d0d9e6f34f37dd2558c9b7c7fc9d599e0bfd8d60872c3d72ca283e3b
MD5 cda5b9dda1dcecf26bb31c4432bdbcf3
BLAKE2b-256 295302043f6b3a7433ce41eb22288a81a2bc80fdfe0d5695c97d19d2fd34a6e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gopen-0.6-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.18.4 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for gopen-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5c4349d5cf27d1cd785a1987f05fffc76362fa360ac64dc6a02b2e3f44942f45
MD5 a90caa26868e94b905548d8866f6ba59
BLAKE2b-256 4a16bf659628c880eb1a9aaa8fcabeddbb45f761304f9b83afc4a9f2a790ffb4

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