enter_conditional
This commit is contained in:
parent
add1e7cdbf
commit
e9fba7b064
@ -58,3 +58,10 @@ class Instrumentation(Generic[IType]):
|
|||||||
def enter(self: IType, stack: ExitStack) -> IType:
|
def enter(self: IType, stack: ExitStack) -> IType:
|
||||||
assert isinstance(self, Instrumentation)
|
assert isinstance(self, Instrumentation)
|
||||||
return stack.enter_context(self)
|
return stack.enter_context(self)
|
||||||
|
|
||||||
|
def enter_conditional(self: IType, stack: ExitStack) -> IType | None:
|
||||||
|
assert isinstance(self, Instrumentation)
|
||||||
|
if hasattr(self.target, self.methodname):
|
||||||
|
return self.enter(stack)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user