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 | write |
def | writelines |
def | reset |
def | __getattr__ |
Data Fields | |
stream | |
encode | |
decode | |
reader | |
writer | |
errors | |
Static Public Attributes | |
string | data_encoding = 'unknown' |
string | file_encoding = 'unknown' |
StreamRecoder instances provide a frontend - backend view of encoding data. They use the complete set of APIs returned by the codecs.lookup() function to implement their task. Data written to the stream is first decoded into an intermediate format (which is dependent on the given codec combination) and then written to the stream using an instance of the provided Writer class. In the other direction, data is read from the stream using a Reader instance and then return encoded data to the caller.
def __init__ | ( | self, | |
stream, | |||
encode, | |||
decode, | |||
Reader, | |||
Writer, | |||
errors = 'strict' |
|||
) |
Creates a StreamRecoder instance which implements a two-way conversion: encode and decode work on the frontend (the input to .read() and output of .write()) while Reader and Writer work on the backend (reading and writing to the stream). You can use these objects to do transparent direct recodings from e.g. latin-1 to utf-8 and back. stream must be a file-like object. encode, decode must adhere to the Codec interface, Reader, Writer must be factory functions or classes providing the StreamReader, StreamWriter interface resp. encode and decode are needed for the frontend translation, Reader and Writer for the backend translation. Unicode is used as intermediate encoding. Error handling is done in the same way as defined for the StreamWriter/Readers.
Definition at line 380 of file codecs.py.
def __getattr__ | ( | self, | |
name, | |||
getattr = getattr |
|||
) |
Inherit all other methods from the underlying stream.
Definition at line 453 of file codecs.py.
References StreamWriter.stream, StreamReader.stream, StreamReaderWriter.stream, and StreamRecoder.stream.
def read | ( | self, | |
size = -1 |
|||
) |
Definition at line 412 of file codecs.py.
References StreamRecoder.encode, StreamWriter.errors, StreamReader.errors, StreamReaderWriter.errors, and StreamRecoder.errors.
def readline | ( | self, | |
size = None |
|||
) |
Definition at line 418 of file codecs.py.
References StreamRecoder.encode, StreamWriter.errors, StreamReader.errors, StreamReaderWriter.errors, and StreamRecoder.errors.
def readlines | ( | self, | |
sizehint = None |
|||
) |
Definition at line 427 of file codecs.py.
References StreamRecoder.encode, StreamWriter.errors, StreamReader.errors, StreamReaderWriter.errors, and StreamRecoder.errors.
def reset | ( | self) |
Definition at line 447 of file codecs.py.
References StreamRecoder.__getattr__().
def write | ( | self, | |
data | |||
) |
Definition at line 436 of file codecs.py.
References StreamRecoder.decode, StreamWriter.errors, StreamReader.errors, StreamReaderWriter.errors, and StreamRecoder.errors.
def writelines | ( | self, | |
list | |||
) |
Definition at line 441 of file codecs.py.
References StreamRecoder.decode, StreamWriter.errors, StreamReader.errors, StreamReaderWriter.errors, StreamRecoder.errors, and dospath.join().