@@ -59,8 +59,7 @@ def write(self, data):
5959 try :
6060 decoded = base64 .b64decode (val )
6161 except binascii .Error :
62- raise DecodeError ('There was an error raised while decoding '
63- 'base64-encoded data.' )
62+ raise DecodeError ("There was an error raised while decoding base64-encoded data." )
6463
6564 self .underlying .write (decoded )
6665
@@ -69,7 +68,7 @@ def write(self, data):
6968 if remaining_len > 0 :
7069 self .cache = data [- remaining_len :]
7170 else :
72- self .cache = b''
71+ self .cache = b""
7372
7473 # Return the length of the data to indicate no error.
7574 return len (data )
@@ -78,7 +77,7 @@ def close(self):
7877 """Close this decoder. If the underlying object has a `close()`
7978 method, this function will call it.
8079 """
81- if hasattr (self .underlying , ' close' ):
80+ if hasattr (self .underlying , " close" ):
8281 self .underlying .close ()
8382
8483 def finalize (self ):
@@ -91,11 +90,11 @@ def finalize(self):
9190 call it.
9291 """
9392 if len (self .cache ) > 0 :
94- raise DecodeError ('There are %d bytes remaining in the '
95- ' Base64Decoder cache when finalize() is called'
96- % len ( self . cache ) )
93+ raise DecodeError (
94+ "There are %d bytes remaining in the Base64Decoder cache when finalize() is called" % len ( self . cache )
95+ )
9796
98- if hasattr (self .underlying , ' finalize' ):
97+ if hasattr (self .underlying , " finalize" ):
9998 self .underlying .finalize ()
10099
101100 def __repr__ (self ):
@@ -111,8 +110,9 @@ class QuotedPrintableDecoder:
111110
112111 :param underlying: the underlying object to pass writes to
113112 """
113+
114114 def __init__ (self , underlying ):
115- self .cache = b''
115+ self .cache = b""
116116 self .underlying = underlying
117117
118118 def write (self , data ):
@@ -128,11 +128,11 @@ def write(self, data):
128128 # If the last 2 characters have an '=' sign in it, then we won't be
129129 # able to decode the encoded value and we'll need to save it for the
130130 # next decoding step.
131- if data [- 2 :].find (b'=' ) != - 1 :
131+ if data [- 2 :].find (b"=" ) != - 1 :
132132 enc , rest = data [:- 2 ], data [- 2 :]
133133 else :
134134 enc = data
135- rest = b''
135+ rest = b""
136136
137137 # Encode and write, if we have data.
138138 if len (enc ) > 0 :
@@ -146,7 +146,7 @@ def close(self):
146146 """Close this decoder. If the underlying object has a `close()`
147147 method, this function will call it.
148148 """
149- if hasattr (self .underlying , ' close' ):
149+ if hasattr (self .underlying , " close" ):
150150 self .underlying .close ()
151151
152152 def finalize (self ):
@@ -161,10 +161,10 @@ def finalize(self):
161161 # If we have a cache, write and then remove it.
162162 if len (self .cache ) > 0 :
163163 self .underlying .write (binascii .a2b_qp (self .cache ))
164- self .cache = b''
164+ self .cache = b""
165165
166166 # Finalize our underlying stream.
167- if hasattr (self .underlying , ' finalize' ):
167+ if hasattr (self .underlying , " finalize" ):
168168 self .underlying .finalize ()
169169
170170 def __repr__ (self ):
0 commit comments