@@ -116,56 +116,57 @@ def _make_close(self, char: str, indent: int, obj):
116116 else :
117117 return char
118118
119- def _pprint_dict (self , object , stream , indent , allowance , context , level ):
119+ def _pprint_dict (self , object , stream , indent , allowance , context , level ): # noqa: A002
120+ obj = object
120121 write = stream .write
121- write (self ._make_open ('{' , indent , object ))
122+ write (self ._make_open ('{' , indent , obj ))
122123
123124 if self ._indent_per_level > 1 :
124125 write ((self ._indent_per_level - 1 ) * ' ' )
125126
126- if len (object ):
127+ if len (obj ):
127128 self ._format_dict_items ( # type: ignore
128- object .items (),
129- stream ,
130- indent ,
131- allowance + 1 ,
132- context ,
133- level ,
134- )
129+ obj .items (),
130+ stream ,
131+ indent ,
132+ allowance + 1 ,
133+ context ,
134+ level ,
135+ )
135136
136- write (self ._make_close ('}' , indent , object ))
137+ write (self ._make_close ('}' , indent , obj ))
137138
138139 _dispatch [dict .__repr__ ] = _pprint_dict
139140
140- def _pprint_list (self , object , stream , indent , allowance , context , level ):
141- stream .write (self ._make_open ('[' , indent , object ))
142- self ._format_items (object , stream , indent , allowance + 1 , context , level )
143- stream .write (self ._make_close (']' , indent , object ))
141+ def _pprint_list (self , obj , stream , indent , allowance , context , level ):
142+ stream .write (self ._make_open ('[' , indent , obj ))
143+ self ._format_items (obj , stream , indent , allowance + 1 , context , level )
144+ stream .write (self ._make_close (']' , indent , obj ))
144145
145146 _dispatch [list .__repr__ ] = _pprint_list
146147
147- def _pprint_tuple (self , object , stream , indent , allowance , context , level ):
148- stream .write (self ._make_open ('(' , indent , object ))
149- endchar = ",)" if len (object ) == 1 else self ._make_close (')' , indent , object )
150- self ._format_items (object , stream , indent , allowance + len (endchar ), context , level )
148+ def _pprint_tuple (self , obj , stream , indent , allowance , context , level ):
149+ stream .write (self ._make_open ('(' , indent , obj ))
150+ endchar = ",)" if len (obj ) == 1 else self ._make_close (')' , indent , obj )
151+ self ._format_items (obj , stream , indent , allowance + len (endchar ), context , level )
151152 stream .write (endchar )
152153
153154 _dispatch [tuple .__repr__ ] = _pprint_tuple
154155
155- def _pprint_set (self , object , stream , indent , allowance , context , level ):
156- if not len (object ):
157- stream .write (repr (object ))
156+ def _pprint_set (self , obj , stream , indent , allowance , context , level ):
157+ if not len (obj ):
158+ stream .write (repr (obj ))
158159 return
159- typ = object .__class__
160+ typ = obj .__class__
160161 if typ is set :
161- stream .write (self ._make_open ('{' , indent , object ))
162- endchar = self ._make_close ('}' , indent , object )
162+ stream .write (self ._make_open ('{' , indent , obj ))
163+ endchar = self ._make_close ('}' , indent , obj )
163164 else :
164165 stream .write (typ .__name__ + f"({{\n { ' ' * (indent + self ._indent_per_level + len (typ .__name__ ) + 1 )} " )
165166 endchar = f",\n { ' ' * (indent + self ._indent_per_level + len (typ .__name__ ) + 1 )} }})"
166167 indent += len (typ .__name__ ) + 1
167- object = sorted (object , key = _safe_key )
168- self ._format_items (object , stream , indent , allowance + len (endchar ), context , level )
168+ obj = sorted (obj , key = _safe_key )
169+ self ._format_items (obj , stream , indent , allowance + len (endchar ), context , level )
169170 stream .write (endchar )
170171
171172 _dispatch [set .__repr__ ] = _pprint_set
@@ -215,7 +216,7 @@ def _format_attribute_items(self, items, stream, indent, allowance, context, lev
215216
216217 write = stream .write
217218 indent += self ._indent_per_level
218- delimnl = ' ,\n ' + ' ' * indent
219+ delimnl = " ,\n " + ' ' * indent
219220 last_index = len (items ) - 1
220221
221222 for i , (key , ent ) in enumerate (items ):
0 commit comments