gruvoc.fileutils: Common file analysis tools¶
This module provides functions for opening or analyzing files.
- cape.gruvoc.fileutils.isfile(fp) bool¶
Check if a variable is a file handle
- Class:
>>> q = isfile(fp)
- Inputs:
- fp:
file| any Any variable, usually file handle or file name
- fp:
- Outputs:
- q:
True|False Whether or not fp is a file handle
- q:
- cape.gruvoc.fileutils.keep_pos(func)¶
- cape.gruvoc.fileutils.openfile(fname_or_fp: str | IOBase, mode: str = 'rb')¶
Process a file handle or name and save attributes
- Call:
>>> fb = openfile(fname, mode="rb") >>> fb = openfile(fp, mode="rb") >>> fb = openfile(fb, mode="rb") >>> fb = openfile(None, mode="rb")
- Inputs:
- Outputs:
- fp:
io.IOBase File handle open in mode mode
- fp: