MCPcopy Create free account
hub / github.com/pywebio/PyWebIO / __call__

Method __call__

pywebio/output.py:2161–2183  ·  view source on GitHub ↗

decorator implement

(self, func)

Source from the content-addressed store, hash-verified

2159 return False # Propagate Exception
2160
2161 def __call__(self, func):
2162 """decorator implement"""
2163
2164 @wraps(func)
2165 def wrapper(*args, **kwargs):
2166 self.__enter__()
2167 try:
2168 return func(*args, **kwargs)
2169 finally:
2170 self.__exit__(None, None, None)
2171
2172 @wraps(func)
2173 async def coro_wrapper(*args, **kwargs):
2174 self.__enter__()
2175 try:
2176 return await func(*args, **kwargs)
2177 finally:
2178 self.__exit__(None, None, None)
2179
2180 if iscoroutinefunction(func):
2181 return coro_wrapper
2182 else:
2183 return wrapper

Callers

nothing calls this directly

Calls 1

iscoroutinefunctionFunction · 0.85

Tested by

no test coverage detected