FileWrapper Module¶
This module provides wrappers for file-like objects for encoding and decoding.
-
class
knittingpattern.Dumper.FileWrapper.TextWrapper(binary_file, encoding)[source]¶ Bases:
objectUse this class if you have a binary-file but you want to write strings to it.
-
__init__(binary_file, encoding)[source]¶ Create a wrapper around
binary_filethat encodes strings to bytes usingencodingand writes them tobinary_file.Parameters:
-
__weakref__¶ list of weak references to the object (if defined)
-
-
class
knittingpattern.Dumper.FileWrapper.BytesWrapper(text_file, encoding)[source]¶ Bases:
objectUse this class if you have a text-file but you want to write bytes to it.
-
__init__(text_file, encoding)[source]¶ Create a wrapper around
text_filethat decodes bytes to string usingencodingand writes them totext_file.Parameters:
-
__weakref__¶ list of weak references to the object (if defined)
-