Vega strike Python Modules doc
0.5.1
Documentation of the " Modules " folder of Vega strike
|
Public Member Functions | |
def | __init__ |
def | read |
def | readline |
def | readlines |
def | reset |
def | __getattr__ |
![]() | |
def | encode |
def | decode |
Data Fields | |
stream | |
errors | |
def __init__ | ( | self, | |
stream, | |||
errors = 'strict' |
|||
) |
Creates a StreamReader instance. stream must be a file-like object open for reading (binary) data. The StreamReader may implement different error handling schemes by providing the errors keyword argument. These parameters are defined: 'strict' - raise a ValueError (or a subclass) 'ignore' - ignore the character and continue with the next 'replace'- replace with a suitable replacement character;
Definition at line 170 of file codecs.py.
def __getattr__ | ( | self, | |
name, | |||
getattr = getattr |
|||
) |
Inherit all other methods from the underlying stream.
Definition at line 285 of file codecs.py.
References StreamWriter.stream, and StreamReader.stream.
def read | ( | self, | |
size = -1 |
|||
) |
Decodes data from the stream self.stream and returns the resulting object. size indicates the approximate maximum number of bytes to read from the stream for decoding purposes. The decoder can modify this setting as appropriate. The default value -1 indicates to read and decode as much as possible. size is intended to prevent having to decode huge files in one step. The method should use a greedy read strategy meaning that it should read as much data as is allowed within the definition of the encoding and the given size, e.g. if optional encoding endings or state markers are available on the stream, these should be read too.
Definition at line 189 of file codecs.py.
References Codec.decode(), StreamRecoder.decode, StreamWriter.errors, and StreamReader.errors.
def readline | ( | self, | |
size = None |
|||
) |
Read one line from the input stream and return the decoded data. Note: Unlike the .readlines() method, this method inherits the line breaking knowledge from the underlying stream's .readline() method -- there is currently no support for line breaking using the codec decoder due to lack of line buffering. Sublcasses should however, if possible, try to implement this method using their own knowledge of line breaking. size, if given, is passed as size argument to the stream's .readline() method.
Definition at line 231 of file codecs.py.
References Codec.decode(), StreamRecoder.decode, StreamWriter.errors, and StreamReader.errors.
def readlines | ( | self, | |
sizehint = None |
|||
) |
Read all lines available on the input stream and return them as list of lines. Line breaks are implemented using the codec's decoder method and are included in the list entries. sizehint, if given, is passed as size argument to the stream's .read() method.
Definition at line 255 of file codecs.py.
References Codec.decode(), StreamRecoder.decode, StreamWriter.errors, and StreamReader.errors.
def reset | ( | self) |
Resets the codec buffers used for keeping state. Note that no stream repositioning should take place. This method is primarily intended to be able to recover from decoding errors.