in src/asfquart/auth.py [0:0]
def requirements_to_iter(args: typing.Any):
"""Converts any auth req args (single arg, list, tuple) to an iterable if not already one"""
# No args? return empty list
if args is None:
return []
# Single arg? Convert to list first
if not isinstance(args, collections.abc.Iterable):
args = [args]
# Test that each requirement is an allowed one (belongs to the Requirements class)
for req in args:
if not callable(req) or req != getattr(Requirements, req.__name__, None):
raise TypeError(
f"Authentication requirement {req} is not valid. Must belong to the asfquart.auth.Requirements class."
)
return args