diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 31a1cee..683bef8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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" diff --git a/src/rok4/Pyramid.py b/src/rok4/Pyramid.py index a3d7144..360212b 100644 --- a/src/rok4/Pyramid.py +++ b/src/rok4/Pyramid.py @@ -778,7 +778,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() diff --git a/src/rok4/Storage.py b/src/rok4/Storage.py index 11d59f1..41df631 100644 --- a/src/rok4/Storage.py +++ b/src/rok4/Storage.py @@ -841,11 +841,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) @@ -854,9 +852,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)