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

Class Decorator

pywebio/platform/page.py:332–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330 configs = locals()
331
332 class Decorator:
333 def __init__(self):
334 self.called = False
335
336 def __call__(self, func):
337 self.called = True
338
339 @functools.wraps(func)
340 def wrapper(*args, **kwargs):
341 return func(*args, **kwargs)
342
343 try:
344 for key, val in configs.items():
345 if val:
346 setattr(wrapper, '_pywebio_%s' % key, val)
347 except Exception:
348 pass
349 return wrapper
350
351 def __del__(self): # if not called as decorator, set the config to global
352 if self.called:
353 return
354
355 global _global_config
356 _global_config = configs
357
358 return Decorator()

Callers 1

configFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…