Skip to content

Commit 342f3c9

Browse files
committed
fix format
1 parent dbde2d4 commit 342f3c9

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

bigframes/core/log_adapter.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,22 @@ def wrap(cls):
149149
return wrap(decorated_cls)
150150

151151

152-
def method_logger(method = None, /, *, custom_base_name: Optional[str] = None):
152+
def method_logger(method=None, /, *, custom_base_name: Optional[str] = None):
153153
"""Decorator that adds logging functionality to a method."""
154154

155155
def outer_wrapper(method):
156-
157156
@functools.wraps(method)
158157
def wrapper(*args, **kwargs):
159158
api_method_name = getattr(method, LOG_OVERRIDE_NAME, method.__name__)
160159
if custom_base_name is None:
161-
qualname_parts = getattr(method, "__qualname__", method.__name__).split(".")
160+
qualname_parts = getattr(method, "__qualname__", method.__name__).split(
161+
"."
162+
)
162163
class_name = qualname_parts[-2] if len(qualname_parts) > 1 else ""
163164
base_name = (
164-
class_name if class_name else "_".join(method.__module__.split(".")[1:])
165+
class_name
166+
if class_name
167+
else "_".join(method.__module__.split(".")[1:])
165168
)
166169
else:
167170
base_name = custom_base_name
@@ -194,13 +197,13 @@ def wrapper(*args, **kwargs):
194197
_call_stack.pop()
195198

196199
return wrapper
197-
200+
198201
if method is None:
199202
# Called with parentheses
200203
return outer_wrapper
201204

202205
# Called without parentheses
203-
return outer_wrapper(method)
206+
return outer_wrapper(method)
204207

205208

206209
def property_logger(prop):

tests/unit/core/test_log_adapter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ def test_method_logging_with_custom_base_name(test_method_w_custom_base):
102102

103103

104104
def test_method_logging_with_custom_base__logger_as_decorator():
105-
106105
@log_adapter.method_logger(custom_base_name="pandas")
107106
def my_method():
108107
pass

0 commit comments

Comments
 (0)