From 0794a9392dd9479e501012a24ef10d91524ecd73 Mon Sep 17 00:00:00 2001 From: timofey Date: Fri, 25 Aug 2023 09:16:41 +0000 Subject: [PATCH] style fix --- starbot/starbot/instrumentation.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/starbot/starbot/instrumentation.py b/starbot/starbot/instrumentation.py index abeeb36..261458a 100644 --- a/starbot/starbot/instrumentation.py +++ b/starbot/starbot/instrumentation.py @@ -4,7 +4,7 @@ import functools from contextlib import ExitStack from typing import Callable, Self -__all__ = ('Instrumentation',) +__all__ = ("Instrumentation",) class Instrumentation: @@ -14,9 +14,9 @@ class Instrumentation: def __init__(self, target, methodname: str): if not isinstance(methodname, str): - raise TypeError('methodname must be str') + raise TypeError("methodname must be str") if not callable(getattr(target, methodname)): - raise TypeError('target.methodname must be callable') + raise TypeError("target.methodname must be callable") self.target = target self.methodname = methodname @@ -24,7 +24,7 @@ class Instrumentation: return method(*args, **kwargs) def __enter__(self) -> Self: - if hasattr(self, '_method') or hasattr(self, '_wrap'): + if hasattr(self, "_method") or hasattr(self, "_wrap"): raise RuntimeError method = getattr(self.target, self.methodname) if not callable(method): @@ -59,7 +59,7 @@ class Instrumentation: def enter(self, stack: ExitStack) -> Self: return stack.enter_context(self) - + def enter_conditional(self, stack: ExitStack) -> Self | None: if hasattr(self.target, self.methodname): return self.enter(stack)