Skip to content

Commit 8a5f0b2

Browse files
committed
Merge branch 'master' of github.com:rok4/core-python
2 parents 80e7499 + 90c9466 commit 8a5f0b2

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ exclude: ".venv|__pycache__|tests/dev/|tests/fixtures/"
22
fail_fast: false
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.4.0
5+
rev: v4.5.0
66
hooks:
77
- id: check-added-large-files
88
args: ["--maxkb=1024"]
@@ -22,25 +22,25 @@ repos:
2222
args: [--markdown-linebreak-ext=md]
2323

2424
- repo: https://github.com/astral-sh/ruff-pre-commit
25-
rev: "v0.0.291"
25+
rev: "v0.1.9"
2626
hooks:
2727
- id: ruff
2828
args: ["--fix-only", "--target-version=py38"]
2929

3030
- repo: https://github.com/psf/black
31-
rev: 23.9.1
31+
rev: 23.12.1
3232
hooks:
3333
- id: black
3434
args: ["--target-version=py38"]
3535

3636
- repo: https://github.com/pycqa/isort
37-
rev: 5.12.0
37+
rev: 5.13.2
3838
hooks:
3939
- id: isort
4040
args: ["--profile", "black", "--filter-files"]
4141

4242
- repo: https://github.com/asottile/pyupgrade
43-
rev: v3.13.0
43+
rev: v3.15.0
4444
hooks:
4545
- id: pyupgrade
4646
args:

src/rok4/storage.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def __get_cached_data_binary(path: str, ttl_hash: int, range: Tuple[int, int] =
366366
)
367367

368368
except botocore.exceptions.ClientError as e:
369-
if e.response["Error"]["Code"] == "404":
369+
if e.response["Error"]["Code"] == "NoSuchKey":
370370
raise FileNotFoundError(f"{storage_type.value}{path}")
371371
else:
372372
raise StorageError("S3", e)
@@ -443,6 +443,9 @@ def get_data_binary(path: str, range: Tuple[int, int] = None) -> str:
443443
Returns:
444444
str: Data binary content
445445
"""
446+
print("########################################")
447+
print(f"get_data_binary {path}")
448+
print("########################################")
446449
return __get_cached_data_binary(path, __get_ttl_hash(), range)
447450

448451

@@ -573,7 +576,7 @@ def exists(path: str) -> bool:
573576
s3_client["client"].head_object(Bucket=bucket_name, Key=base_name)
574577
return True
575578
except botocore.exceptions.ClientError as e:
576-
if e.response["Error"]["Code"] == "404":
579+
if e.response["Error"]["Code"] == "NoSuchKey":
577580
return False
578581
else:
579582
raise StorageError("S3", e)

tests/test_storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ def test_exists_s3_ok(mocked_s3_client):
809809
assert False, f"S3 exists raises an exception: {exc}"
810810

811811
s3_instance.head_object.side_effect = botocore.exceptions.ClientError(
812-
operation_name="InvalidKeyPair.Duplicate", error_response={"Error": {"Code": "404"}}
812+
operation_name="InvalidKeyPair.Duplicate", error_response={"Error": {"Code": "NoSuchKey"}}
813813
)
814814
try:
815815
assert not exists("s3://bucket/object.ext")

0 commit comments

Comments
 (0)