@@ -76,7 +76,7 @@ class PrettyPrinter(_PrettyPrinter):
7676 }
7777
7878 def __init__ (self , indent = 1 , width = 80 , depth = None , stream = None , signs_colors : _Dict [str , str ] = None , * ,
79- compact = False , ** kwargs ):
79+ compact = False , sort_dicts = True , underscore_numbers = False , ** kwargs ):
8080 super ().__init__ (indent = indent , width = width , depth = depth , stream = stream , compact = compact , ** kwargs )
8181 self ._depth = depth
8282 self ._indent_per_level = indent
@@ -86,6 +86,8 @@ def __init__(self, indent=1, width=80, depth=None, stream=None, signs_colors: _D
8686 else :
8787 self ._stream = _sys .stdout
8888 self ._compact = bool (compact )
89+ self ._sort_dicts = sort_dicts
90+ self ._underscore_numbers = underscore_numbers
8991 if signs_colors :
9092 for sign , color in signs_colors .items ():
9193 self .signs_colors [sign .lower ()] = _gc (color )
@@ -560,7 +562,8 @@ def _pprint_user_string(self, obj, stream, indent, allowance, context, level):
560562 _dispatch [_collections .UserString .__repr__ ] = _pprint_user_string
561563
562564
563- def pformat (obj , indent = 1 , width = 80 , depth = None , signs_colors : _Dict [str , str ] = None , * , compact = False , ** kwargs ):
565+ def pformat (obj , indent = 1 , width = 80 , depth = None , signs_colors : _Dict [str , str ] = None , * , compact = False ,
566+ sort_dicts = True , underscore_numbers = False , ** kwargs ):
564567 """Format a Python object into a pretty-printed representation."""
565568 return PrettyPrinter (indent = indent , width = width , depth = depth , compact = compact , signs_colors = signs_colors ,
566- ** kwargs ).pformat (obj )
569+ sort_dicts = True , underscore_numbers = False , ** kwargs ).pformat (obj )
0 commit comments