From 75ad935477d1916ca552f93f0c6a9929e4471a2d Mon Sep 17 00:00:00 2001 From: Julien Moura Date: Wed, 31 May 2023 15:54:36 +0200 Subject: [PATCH 1/2] Add pyupgrade git hook --- .pre-commit-config.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ddc5f9b..a451eb9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,3 +20,10 @@ repos: args: [--pytest-test-first] - id: trailing-whitespace args: [--markdown-linebreak-ext=md] + + - repo: https://github.com/asottile/pyupgrade + rev: v3.3.1 + hooks: + - id: pyupgrade + args: + - "--py38-plus" From 87ca6420b188ccf8ff038b1bf8df8a475a01c1bb Mon Sep 17 00:00:00 2001 From: Julien Moura Date: Wed, 31 May 2023 15:58:44 +0200 Subject: [PATCH 2/2] Apply pyupgrade git hook --- src/rok4/Pyramid.py | 2 +- src/rok4/Storage.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rok4/Pyramid.py b/src/rok4/Pyramid.py index 75b433c..a72e800 100644 --- a/src/rok4/Pyramid.py +++ b/src/rok4/Pyramid.py @@ -736,7 +736,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: diff --git a/src/rok4/Storage.py b/src/rok4/Storage.py index 3e22fd3..e28bd6b 100644 --- a/src/rok4/Storage.py +++ b/src/rok4/Storage.py @@ -806,7 +806,7 @@ 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'), + Body = f"{__OBJECT_SYMLINK_SIGNATURE}{target_bucket}/{target_base_name}".encode(), Bucket = link_bucket, Key = link_base_name ) @@ -818,7 +818,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)