Use S3(*args) to simplify conditions in __parse_location().

This commit is contained in:
Vitaly Baranov 2023-11-12 23:49:25 +01:00
parent 8a8afc54fc
commit 6807e52d2c

View File

@ -1016,12 +1016,8 @@ class Location:
)
if name == "S3":
if len(args) == 1:
return S3(args[0])
elif len(args) == 2:
return S3(args[0], args[1])
elif len(args) == 3:
return S3(args[0], args[1], args[2])
if 1 <= len(args) and len(args) <= 3:
return S3(*args)
else:
raise Exception(
f"Couldn't parse a location from '{desc}': S3(<uri> [, <access_key_id>, <secret_access_key>]) requires from 1 to 3 arguments, got {len(args)} arguments"