4545
4646 # 3rd party
4747 from pprint36 import PrettyPrinter
48- from pprint36 ._pprint import _safe_key # type: ignore
48+ from pprint36 ._pprint import _safe_key # type: ignore[attr-defined]
4949
5050 supports_sort_dicts = True
5151
5252except ImportError :
5353
5454 # stdlib
55- from pprint import PrettyPrinter , _safe_key # type: ignore
55+ from pprint import PrettyPrinter , _safe_key # type: ignore[attr-defined]
5656
5757 supports_sort_dicts = sys .version_info >= (3 , 8 )
5858
@@ -107,21 +107,21 @@ def __init__(
107107 _dispatch : MutableMapping [Callable , Callable ]
108108 _indent_per_level : int
109109 _format_items : ClassVar [Callable [[PrettyPrinter , Any , Any , Any , Any , Any , Any ], None ]]
110- _dispatch = dict (PrettyPrinter ._dispatch ) # type: ignore
110+ _dispatch = dict (PrettyPrinter ._dispatch ) # type: ignore[attr-defined]
111111
112112 def _make_open (self , char : str , indent : int , obj ):
113113 if self ._indent_per_level > 1 :
114114 the_indent = ' ' * (indent + 1 )
115115 else :
116116 the_indent = ' ' * (indent + self ._indent_per_level )
117117
118- if obj and not self ._compact : # type: ignore
118+ if obj and not self ._compact : # type: ignore[attr-defined]
119119 return f"{ char } \n { the_indent } "
120120 else :
121121 return char
122122
123123 def _make_close (self , char : str , indent : int , obj ):
124- if obj and not self ._compact : # type: ignore
124+ if obj and not self ._compact : # type: ignore[attr-defined]
125125 return f",\n { ' ' * (indent + self ._indent_per_level )} { char } "
126126 else :
127127 return char
@@ -143,14 +143,14 @@ def _pprint_dict(
143143 write ((self ._indent_per_level - 1 ) * ' ' )
144144
145145 if obj :
146- self ._format_dict_items ( # type: ignore
147- obj .items (),
148- stream ,
149- indent ,
150- allowance + 1 ,
151- context ,
152- level ,
153- )
146+ self ._format_dict_items ( # type: ignore[attr-defined]
147+ obj .items (),
148+ stream ,
149+ indent ,
150+ allowance + 1 ,
151+ context ,
152+ level ,
153+ )
154154
155155 write (self ._make_close ('}' , indent , obj ))
156156
@@ -243,7 +243,7 @@ def _format_attribute_items(self, items, stream, indent, allowance, context, lev
243243 last = i == last_index
244244 write (key )
245245 write ('=' )
246- self ._format ( # type: ignore
246+ self ._format ( # type: ignore[attr-defined]
247247 ent ,
248248 stream ,
249249 indent + len (key ) + 2 ,
@@ -284,7 +284,7 @@ def __repr__(self) -> str:
284284 __repr__ .__name__ = "__repr__"
285285 __repr__ .__module__ = obj .__module__
286286 __repr__ .__qualname__ = f"{ obj .__module__ } .__repr__"
287- obj .__repr__ = __repr__ # type: ignore
287+ obj .__repr__ = __repr__ # type: ignore[assignment]
288288
289289 return obj
290290
0 commit comments