99
1010__all__ = ['debug' , 'class_method_debug' , 'check_time' , 'debugTkinterEvent' , 'pprint_debug' ]
1111
12+ DEFAULT_TAG = '\n _______________________________ "{0}" _______________________________'
1213
13-
14- def class_method_debug (cls : str or type , tag : str = '\n ________________________________________________________________' ):
14+ def class_method_debug (cls : str or type , tag : str = DEFAULT_TAG ):
1515 """
1616 Print the function signature and return value
1717
@@ -38,7 +38,7 @@ def wrapper_debug(*args, **kwargs):
3838
3939 signature = ", " .join (args_repr + kwargs_repr ) # 3
4040
41- print (f"{ tag } \n { cls } .{ func .__name__ } ({ signature } )" )
41+ print (f"{ tag . format ( f' { func . __module__ } . { func . __qualname__ } ' ) } \n { cls } .{ func .__name__ } (\n { signature } \n )" )
4242 result = func (* args , ** kwargs )
4343 print (f"{ func .__name__ } returned { result !r} \n " ) # 4
4444
@@ -48,7 +48,7 @@ def wrapper_debug(*args, **kwargs):
4848
4949
5050
51- def debug (func : callable , tag : str = ' \n ________________________________________________________________' ):
51+ def debug (func : callable , tag : str = DEFAULT_TAG ):
5252 """
5353 Print the function signature and return value
5454
@@ -65,7 +65,7 @@ def wrapper_debug(*args, **kwargs):
6565
6666 signature = ", " .join (args_repr + kwargs_repr ) # 3
6767
68- print (f"{ tag } \n { func .__name__ } ( { signature } )" )
68+ print (f"{ tag . format ( f' { func . __module__ } . { func . __qualname__ } ' ) } \n { func .__qualname__ } ( \n { signature } \n )" )
6969 result = func (* args , ** kwargs )
7070 print (f"{ func .__name__ } returned { result !r} \n " ) # 4
7171
@@ -74,7 +74,7 @@ def wrapper_debug(*args, **kwargs):
7474
7575
7676
77- def pprint_debug (func : callable , tag : str = ' \n ________________________________________________________________' ):
77+ def pprint_debug (func : callable , tag : str = DEFAULT_TAG ):
7878 """
7979 Print the function signature and return value
8080
@@ -84,9 +84,8 @@ def pprint_debug(func: callable, tag: str = '\n_________________________________
8484 """
8585 @functools .wraps (func )
8686 def wrapper_debug (* args , ** kwargs ):
87- signature = getPPrintStr ({'args' : kwargs , 'kwargs' : args , })
88-
89- print (f"{ tag } \n { func .__name__ } ({ signature } )" )
87+ signature = getPPrintStr ({'kwargs' : kwargs , 'args' : args , })
88+ print (f"{ tag .format (f'{ func .__module__ } .{ func .__qualname__ } ' )} \n { func .__qualname__ } (\n { signature } \n )" )
9089 result = func (* args , ** kwargs )
9190 print (f"{ func .__name__ } returned { result !r} \n " )
9291
@@ -95,7 +94,7 @@ def wrapper_debug(*args, **kwargs):
9594
9695
9796
98- def check_time (* , cls : str or type = None , print_signature : bool = True , tag : str = ' \n _______________________________check_time_______________________________' ):
97+ def check_time (* , cls : str or type = None , print_signature : bool = True , tag : str = DEFAULT_TAG ):
9998 """
10099 Print the function signature and return value
101100
@@ -135,10 +134,10 @@ def timed(*args, **kwargs):
135134
136135
137136
138- def debugTkinterEvent (func : callable , tag : str = '_______________________________TkinterEvent_______________________________' ):
137+ def debugTkinterEvent (func : callable , tag : str = DEFAULT_TAG ):
139138 @functools .wraps (func )
140139 def wrapper_debug (self , event : Event , * args , ** kwargs ):
141- PRINT (f'{ tag } \n { func .__class__ } .{ func .__name__ } .{ Event .__class__ } ' , event .__dict__ )
140+ PRINT (f'{ tag . format ( "TkinterEvent" ) } \n { func .__class__ } .{ func .__name__ } .{ Event .__class__ } ' , event .__dict__ )
142141
143142 result = func (self , event , * args , ** kwargs )
144143
0 commit comments