pubslish .instrumentation
This commit is contained in:
parent
faa96816f9
commit
ec72c46329
@ -22,7 +22,7 @@ class Instrumentation(Generic[IType]):
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def __enter__(self: IType) -> IType:
|
def __enter__(self: IType) -> IType:
|
||||||
self: Instrumentation
|
assert isinstance(self, Instrumentation)
|
||||||
assert not hasattr(self, '_method')
|
assert not hasattr(self, '_method')
|
||||||
assert not hasattr(self, '_wrap')
|
assert not hasattr(self, '_wrap')
|
||||||
method = getattr(self.target, self.methodname)
|
method = getattr(self.target, self.methodname)
|
||||||
@ -56,4 +56,5 @@ class Instrumentation(Generic[IType]):
|
|||||||
self.deinstrument()
|
self.deinstrument()
|
||||||
|
|
||||||
def enter(self: IType, stack: ExitStack) -> IType:
|
def enter(self: IType, stack: ExitStack) -> IType:
|
||||||
|
assert isinstance(self, Instrumentation)
|
||||||
return stack.enter_context(self)
|
return stack.enter_context(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user