FileWrapper
Module¶
This module provides wrappers for file-like objects for encoding and decoding.
-
class
knittingpattern.Dumper.FileWrapper.
TextWrapper
(binary_file, encoding)[source]¶ Bases:
object
Use 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_file
that encodes strings to bytes usingencoding
and 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:
object
Use 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_file
that decodes bytes to string usingencoding
and writes them totext_file
.Parameters:
-
__weakref__
¶ list of weak references to the object (if defined)
-