[ez] Use strip for arg sanitization in upload_metadata_file to improve readability (#144155)

Minor thing that improves readability.  I didn't realize you could specify characters for strip when I wrote this
Pull Request resolved: https://github.com/pytorch/pytorch/pull/144155
Approved by: https://github.com/huydhn, https://github.com/Skylion007
This commit is contained in:
Catherine Lee
2025-01-03 19:25:30 +00:00
committed by PyTorch MergeBot
parent 8b3479e361
commit 383ff4011c

View File

@ -35,12 +35,8 @@ def parse_args() -> argparse.Namespace:
# slashes
if args.bucket.startswith("s3://"):
args.bucket = args.bucket[5:]
if args.bucket.endswith("/"):
args.bucket = args.bucket[:-1]
if args.key_prefix.startswith("/"):
args.key_prefix = args.key_prefix[1:]
if args.key_prefix.endswith("/"):
args.key_prefix = args.key_prefix[:-1]
args.bucket = args.bucket.strip("/")
args.key_prefix = args.key_prefix.strip("/")
return args