Skip to content

Commit

Permalink
Appease mypy.
Browse files Browse the repository at this point in the history
  • Loading branch information
sheriferson committed Dec 19, 2024
1 parent 471008d commit 7277230
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/aibs_informatics_core/models/aws/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,17 @@ def validate_url(
validate_url = mm_validate.Regexp(regex=_S3URI_PATTERN, error=error_msg)
validate_interpolation = mm.validate.ContainsNoneOf("{}", error=error_msg)

validate = mm_validate.And(
s3_validate = mm_validate.And(
validate_url,
validate_interpolation,
)
validate(candidate_url) # raises marshmallow.ValidationError if invalid
s3_validate(candidate_url) # raises marshmallow.ValidationError if invalid

bucket_match = re.match(_S3URI_PATTERN, candidate_url).group(1)
validate_bucket_characters = mm_validate.ContainsNoneOf("_ ", error=error_msg)
validate_bucket_characters(bucket_match)
bucket_match = re.match(_S3URI_PATTERN, candidate_url)
if bucket_match:
bucket_group = bucket_match.group(1)
validate_bucket_characters = mm_validate.ContainsNoneOf("_ ", error=error_msg)
validate_bucket_characters(bucket_group)

else:
validate = mm_validate.URL(
Expand Down

0 comments on commit 7277230

Please sign in to comment.