pypath.share.curl.FileOpener§

class pypath.share.curl.FileOpener(file_param, compr=None, extract=True, _open=True, set_fileobj=True, files_needed=None, large=True, default_mode='r', encoding='utf-8')[source]§

Bases: Logger

This class opens a file, extracts it in case it is a gzip, tar.gz, tar.bz2 or zip archive, selects the requested files if you only need certain files from a multifile archive, reads the data from the file, or returns the file pointer, as you request. It examines the file type and size.

__init__(file_param, compr=None, extract=True, _open=True, set_fileobj=True, files_needed=None, large=True, default_mode='r', encoding='utf-8')[source]§

Make this instance a logger.

Parameters:
  • name – The label of this instance that will be prepended to all messages it sends to the logger.

  • module – Send the messages by the logger of this module.

Methods

__init__(file_param[, compr, extract, ...])

Make this instance a logger.

extract()

Calls the extracting method for compressed files.

get_type()

iterfile(fileobj)

open()

Opens the file if exists.

open_gz()

open_plain()

open_tgz()

Extracts files from tar gz.

open_zip()

Attributes

FORBIDDEN_CHARS

extract()[source]§

Calls the extracting method for compressed files.

open()[source]§

Opens the file if exists.

open_tgz()[source]§

Extracts files from tar gz.