Vega strike Python Modules doc
0.5.1
Documentation of the " Modules " folder of Vega strike
|
Data Structures | |
class | Codec |
Codec base classes (defining the API) More... | |
class | StreamWriter |
class | StreamReader |
class | StreamReaderWriter |
class | StreamRecoder |
Functions | |
def | open |
def | EncodedFile |
def | getencoder |
Helpers for codec lookup. More... | |
def | getdecoder |
def | getreader |
def | getwriter |
def | make_identity_dict |
Helpers for charmap-based codecs. More... | |
def | make_encoding_map |
Variables | |
list | __all__ |
tuple | BOM = struct.pack('=H', 0xFEFF) |
Constants. More... | |
string | BOM_BE = '\376\377' |
string | BOM_LE = '\377\376' |
string | BOM64_BE = '\000\000\376\377' |
string | BOM64_LE = '\377\376\000\000' |
int | _false = 0 |
codecs -- Python Codec Registry, API and helpers. Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
def codecs.EncodedFile | ( | file, | |
data_encoding, | |||
file_encoding = None , |
|||
errors = 'strict' |
|||
) |
Return a wrapped version of file which provides transparent encoding translation. Strings written to the wrapped file are interpreted according to the given data_encoding and then written to the original file as string using file_encoding. The intermediate encoding will usually be Unicode but depends on the specified codecs. Strings are read from the file using file_encoding and then passed back to the caller as string using data_encoding. If file_encoding is not given, it defaults to data_encoding. errors may be given to define the error handling. It defaults to 'strict' which causes ValueErrors to be raised in case an encoding error occurs. The returned wrapped file object provides two extra attributes .data_encoding and .file_encoding which reflect the given parameters of the same name. The attributes can be used for introspection by Python programs.
Definition at line 505 of file codecs.py.
References cgitb.lookup().
def codecs.getdecoder | ( | encoding) |
Lookup up the codec for the given encoding and return its decoder function. Raises a LookupError in case the encoding cannot be found.
Definition at line 554 of file codecs.py.
References cgitb.lookup().
def codecs.getencoder | ( | encoding) |
Helpers for codec lookup.
Lookup up the codec for the given encoding and return its encoder function. Raises a LookupError in case the encoding cannot be found.
Definition at line 544 of file codecs.py.
References cgitb.lookup().
def codecs.getreader | ( | encoding) |
Lookup up the codec for the given encoding and return its StreamReader class or factory function. Raises a LookupError in case the encoding cannot be found.
Definition at line 564 of file codecs.py.
References cgitb.lookup().
def codecs.getwriter | ( | encoding) |
Lookup up the codec for the given encoding and return its StreamWriter class or factory function. Raises a LookupError in case the encoding cannot be found.
Definition at line 574 of file codecs.py.
References cgitb.lookup().
def codecs.make_encoding_map | ( | decoding_map) |
Creates an encoding map from a decoding map. If a target mapping in the decoding map occurrs multiple times, then that target is mapped to None (undefined mapping), causing an exception when encountered by the charmap codec during translation. One example where this happens is cp875.py which decodes multiple character to \u001a.
Definition at line 599 of file codecs.py.
def codecs.make_identity_dict | ( | rng) |
def codecs.open | ( | filename, | |
mode = 'rb' , |
|||
encoding = None , |
|||
errors = 'strict' , |
|||
buffering = 1 |
|||
) |
Open an encoded file using the given mode and return a wrapped version providing transparent encoding/decoding. Note: The wrapped version will only accept the object format defined by the codecs, i.e. Unicode objects for most builtin codecs. Output is also codec dependent and will usually by Unicode as well. Files are always opened in binary mode, even if no binary mode was specified. Thisis done to avoid data loss due to encodings using 8-bit values. The default file mode is 'rb' meaning to open the file in binary read mode. encoding specifies the encoding which is to be used for the the file. errors may be given to define the error handling. It defaults to 'strict' which causes ValueErrors to be raised in case an encoding error occurs. buffering has the same meaning as for the builtin open() API. It defaults to line buffered. The returned wrapped file object provides an extra attribute .encoding which allows querying the used encoding. This attribute is only available if an encoding was specified as parameter.
Definition at line 461 of file codecs.py.
References cgitb.lookup().
list __all__ |