This commit is contained in:
ton
2023-10-05 02:52:21 +07:00
parent 63ca0049be
commit d76e4b2916
5451 changed files with 3 additions and 919197 deletions

View File

@@ -1,20 +0,0 @@
import functools
# from jaraco.functools 3.5
def pass_none(func):
"""
Wrap func so it's not called if its first param is None
>>> print_text = pass_none(print)
>>> print_text('text')
text
>>> print_text(None)
"""
@functools.wraps(func)
def wrapper(param, *args, **kwargs):
if param is not None:
return func(param, *args, **kwargs)
return wrapper