Skip to content

Commit

Permalink
Merge pull request #41 from Guts/tooling/git-hooks-pyupgrade
Browse files Browse the repository at this point in the history
Outillage : ajoute pyupgrade comme git hook
  • Loading branch information
Dolite authored Jul 18, 2023
2 parents ecd969e + a0ced7f commit 14413aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ repos:
rev: 23.3.0
hooks:
- id: black

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args:
- "--py38-plus"
2 changes: 1 addition & 1 deletion src/rok4/Pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ def list_generator(self) -> Iterator[Tuple[Tuple[SlabType, str, int, int], Dict]
roots = {}
s3_cluster = self.storage_s3_cluster

with open(list_file, "r") as listin:
with open(list_file) as listin:
# Lecture des racines
for line in listin:
line = line.rstrip()
Expand Down
12 changes: 4 additions & 8 deletions src/rok4/Storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,11 +931,9 @@ def link(target_path: str, link_path: str, hard: bool = False) -> None:

try:
target_s3_client["client"].put_object(
Body=f"{__OBJECT_SYMLINK_SIGNATURE}{target_bucket}/{target_base_name}".encode(
"utf-8"
),
Bucket=link_bucket,
Key=link_base_name,
Body = f"{__OBJECT_SYMLINK_SIGNATURE}{target_bucket}/{target_base_name}".encode(),
Bucket = link_bucket,
Key = link_base_name
)
except Exception as e:
raise StorageError("S3", e)
Expand All @@ -944,9 +942,7 @@ def link(target_path: str, link_path: str, hard: bool = False) -> None:
ioctx = __get_ceph_ioctx(link_tray)

try:
ioctx.write_full(
link_base_name, f"{__OBJECT_SYMLINK_SIGNATURE}{target_path}".encode("utf-8")
)
ioctx.write_full(link_base_name, f"{__OBJECT_SYMLINK_SIGNATURE}{target_path}".encode())
except Exception as e:
raise StorageError("CEPH", e)

Expand Down

0 comments on commit 14413aa

Please sign in to comment.