File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,9 @@ def wrapper(*args, **kwargs):
107107 return wrapper
108108
109109
110- def log_method_calls (exclude_dunder : bool = True ) -> Callable [[type ], type ]:
110+ def log_method_calls (
111+ exclude_properties : bool = True , exclude_private : bool = True , exclude_dunder : bool = True
112+ ) -> Callable [[type ], type ]:
111113 """
112114 Class decorator to log calls to all methods of a class. Arguments and returned values are
113115 included in the log.
@@ -121,6 +123,10 @@ def class_decorator(cls: type) -> type:
121123 if callable (attr_value ):
122124 if exclude_dunder and attr_name .startswith ("__" ) and attr_name .endswith ("__" ):
123125 continue
126+ if exclude_private and attr_name .startswith ("_" ):
127+ continue
128+ if exclude_properties and isinstance (getattr (cls , attr_name , None ), property ):
129+ continue
124130 decorated_attr = log_calls (attr_value )
125131 setattr (cls , attr_name , decorated_attr )
126132 return cls
Original file line number Diff line number Diff line change 8585ViewStyle = Annotated [str , Predicate (lambda x : x in ("list" , "board" , "calendar" ))]
8686
8787
88- @log_method_calls (exclude_dunder = True )
88+ @log_method_calls ()
8989class TodoistAPI :
9090 """
9191 Client for the Todoist API.
You can’t perform that action at this time.
0 commit comments