Skip to content

Commit ee438e4

Browse files
committed
format: run black
1 parent 26e92d0 commit ee438e4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

s3_bucket_validator.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66

77
def is_bucket_accessible(bucket_name):
8-
s3 = boto3.client('s3')
8+
s3 = boto3.client("s3")
99
try:
1010
s3.head_bucket(Bucket=bucket_name)
1111
return True
1212
except ClientError as e:
13-
error_code = int(e.response['Error']['Code'])
13+
error_code = int(e.response["Error"]["Code"])
1414
if error_code == 403:
1515
print(f"Bucket {bucket_name} exists, but you don't have permission to access it.")
1616
elif error_code == 404:
@@ -19,11 +19,12 @@ def is_bucket_accessible(bucket_name):
1919
print(f"Error checking bucket {bucket_name}: {e}")
2020
return False
2121

22+
2223
def validate_s3_references(file_path):
23-
with open(file_path, 'r') as file:
24+
with open(file_path, "r") as file:
2425
content = file.read()
2526

26-
s3_pattern = re.compile(r's3:\/\/([a-zA-Z0-9._-]+)')
27+
s3_pattern = re.compile(r"s3:\/\/([a-zA-Z0-9._-]+)")
2728
matches = s3_pattern.findall(content)
2829

2930
invalid_buckets = []
@@ -33,8 +34,10 @@ def validate_s3_references(file_path):
3334

3435
return invalid_buckets
3536

37+
3638
if __name__ == "__main__":
3739
import sys
40+
3841
if len(sys.argv) < 2:
3942
print("Usage: python s3_bucket_validator.py <file_path>")
4043
sys.exit(1)
@@ -46,4 +49,4 @@ def validate_s3_references(file_path):
4649
print(f"Invalid or inaccessible S3 buckets found: {', '.join(invalid_buckets)}")
4750
sys.exit(1)
4851
else:
49-
print("All referenced S3 buckets are valid and accessible.")
52+
print("All referenced S3 buckets are valid and accessible.")

0 commit comments

Comments
 (0)