|
|
|
@ -62,19 +62,6 @@ def noKwargs(f: TV_func) -> TV_func: |
|
|
|
|
return f(*wrapped_args, **wrapped_kwargs) |
|
|
|
|
return T.cast('TV_func', wrapped) |
|
|
|
|
|
|
|
|
|
def stringArgs(f: TV_func) -> TV_func: |
|
|
|
|
@wraps(f) |
|
|
|
|
def wrapped(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any: |
|
|
|
|
args = get_callee_args(wrapped_args)[1] |
|
|
|
|
if not isinstance(args, list): |
|
|
|
|
mlog.debug('Not a list:', str(args)) |
|
|
|
|
raise InvalidArguments('Argument not a list.') |
|
|
|
|
if not all(isinstance(s, str) for s in args): |
|
|
|
|
mlog.debug('Element not a string:', str(args)) |
|
|
|
|
raise InvalidArguments('Arguments must be strings.') |
|
|
|
|
return f(*wrapped_args, **wrapped_kwargs) |
|
|
|
|
return T.cast('TV_func', wrapped) |
|
|
|
|
|
|
|
|
|
def noArgsFlattening(f: TV_func) -> TV_func: |
|
|
|
|
setattr(f, 'no-args-flattening', True) # noqa: B010 |
|
|
|
|
return f |
|
|
|
|