FileResourceHandle

class lsst.resources._resourceHandles._fileResourceHandle.FileResourceHandle(mode: str, log: Logger, *, filename: str, encoding: str | None, newline: str = '\n')

Bases: BaseResourceHandle[U]

File based specialization of BaseResourceHandle

Parameters:
modestr

Handle modes as described in the python io module

logLogger

Logger to used when writing messages

filenamestr

Name of the file on the filesystem to use.

encodingstr or None

Optionally supply the encoding of the file.

newlinestr

When doing multiline operations, break the stream on given character. Defaults to newline. If a file is opened in binary mode, this argument is not used, as binary files will only split lines on the binary newline representation.

Notes

Documentation on the methods of this class line should refer to the corresponding methods in the io module.

Attributes Summary

closed

isatty

mode

Methods Summary

close()

fileno()

flush()

read([size])

readable()

readline([size])

readlines([hint])

seek(offset[, whence])

seekable()

tell()

truncate([size])

writable()

write(b)

writelines(lines)

Attributes Documentation

closed
isatty
mode

Methods Documentation

close() None
fileno() int
flush() None
read(size: int = -1) U
readable() bool
readline(size: int = -1) U
readlines(hint: int = -1) Iterable[U]
seek(offset: int, whence: int = 0) int
seekable() bool
tell() int
truncate(size: int | None = None) int
writable() bool
write(b: U) int
writelines(lines: Iterable) None