4242 slice : "slice" ,
4343 Fraction : "fraction" ,
4444 OrderedDict : "ordereddict" ,
45- numpy .ndarray : "nparray"
45+ numpy .ndarray : "nparray" ,
4646}
4747
4848_numpy_scalar = {
@@ -71,7 +71,7 @@ def __init__(self, pretty):
7171 self .indent_level = 0
7272
7373 def indent (self ):
74- return " " * self .indent_level
74+ return " " * self .indent_level
7575
7676 def encode_none (self , x ):
7777 return "null"
@@ -167,8 +167,7 @@ def encode_npscalar(self, x):
167167 def encode (self , x ):
168168 ty = _encode_map .get (type (x ), None )
169169 if ty is None :
170- raise TypeError ("`{!r}` ({}) is not PYON serializable"
171- .format (x , type (x )))
170+ raise TypeError ("`{!r}` ({}) is not PYON serializable" .format (x , type (x )))
172171 return getattr (self , "encode_" + ty )(x )
173172
174173
@@ -201,7 +200,7 @@ def _npscalar(ty, data):
201200 "Fraction" : Fraction ,
202201 "OrderedDict" : OrderedDict ,
203202 "nparray" : _nparray ,
204- "npscalar" : _npscalar
203+ "npscalar" : _npscalar ,
205204}
206205
207206
@@ -215,7 +214,9 @@ def store_file(filename, x):
215214 """Encodes a Python object and writes it to the specified file."""
216215 contents = encode (x , True )
217216 directory = os .path .abspath (os .path .dirname (filename ))
218- with tempfile .NamedTemporaryFile ("w" , dir = directory , delete = False , encoding = "utf-8" ) as f :
217+ with tempfile .NamedTemporaryFile (
218+ "w" , dir = directory , delete = False , encoding = "utf-8"
219+ ) as f :
219220 f .write (contents )
220221 f .write ("\n " )
221222 tmpname = f .name
0 commit comments