From 3856686e4c3e7b6ad24f46ebaab1e3c4efcb1e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Tue, 29 Jul 2025 18:36:32 +0200 Subject: [PATCH] chore: add support for flake8-return --- scaleway-async/pyproject.toml | 1 + scaleway-async/tests/utils.py | 3 +-- scaleway-core/pyproject.toml | 1 + scaleway-core/tests/utils.py | 3 +-- scaleway/pyproject.toml | 1 + scaleway/scaleway/instance/v1/custom_api.py | 4 +--- scaleway/tests/utils.py | 3 +-- 7 files changed, 7 insertions(+), 9 deletions(-) diff --git a/scaleway-async/pyproject.toml b/scaleway-async/pyproject.toml index 24fc88aa4..b08a0ecdf 100644 --- a/scaleway-async/pyproject.toml +++ b/scaleway-async/pyproject.toml @@ -46,6 +46,7 @@ select = [ "FBT", # https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt "FIX", # https://docs.astral.sh/ruff/rules/#flake8-fixme-fix "FURB", # https://docs.astral.sh/ruff/rules/#refurb-furb + "RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret "T10", # https://docs.astral.sh/ruff/rules/#flake8-debugger-t10 "YTT", # https://docs.astral.sh/ruff/rules/#flake8-2020-ytt ] diff --git a/scaleway-async/tests/utils.py b/scaleway-async/tests/utils.py index 97dde0d80..0be040c24 100644 --- a/scaleway-async/tests/utils.py +++ b/scaleway-async/tests/utils.py @@ -26,8 +26,7 @@ def random_date(min: Union[str, datetime], max: Union[str, datetime]) -> datetim min_time = min if isinstance(min, datetime) else string_to_datetime(min) max_time = max if isinstance(max, datetime) else string_to_datetime(max) - random_time = min_time + system_random.random() * (max_time - min_time) - return random_time + return min_time + system_random.random() * (max_time - min_time) def datetime_to_string(date: datetime) -> str: diff --git a/scaleway-core/pyproject.toml b/scaleway-core/pyproject.toml index 0c9646f8e..50a4029f0 100644 --- a/scaleway-core/pyproject.toml +++ b/scaleway-core/pyproject.toml @@ -46,6 +46,7 @@ select = [ "ERA", # https://docs.astral.sh/ruff/rules/#eradicate-era "FIX", # https://docs.astral.sh/ruff/rules/#flake8-fixme-fix "FURB", # https://docs.astral.sh/ruff/rules/#refurb-furb + "RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret "T10", # https://docs.astral.sh/ruff/rules/#flake8-debugger-t10 "YTT", # https://docs.astral.sh/ruff/rules/#flake8-2020-ytt ] diff --git a/scaleway-core/tests/utils.py b/scaleway-core/tests/utils.py index 97dde0d80..0be040c24 100644 --- a/scaleway-core/tests/utils.py +++ b/scaleway-core/tests/utils.py @@ -26,8 +26,7 @@ def random_date(min: Union[str, datetime], max: Union[str, datetime]) -> datetim min_time = min if isinstance(min, datetime) else string_to_datetime(min) max_time = max if isinstance(max, datetime) else string_to_datetime(max) - random_time = min_time + system_random.random() * (max_time - min_time) - return random_time + return min_time + system_random.random() * (max_time - min_time) def datetime_to_string(date: datetime) -> str: diff --git a/scaleway/pyproject.toml b/scaleway/pyproject.toml index 0701c29c5..2967791bd 100644 --- a/scaleway/pyproject.toml +++ b/scaleway/pyproject.toml @@ -47,6 +47,7 @@ select = [ "FBT", # https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt "FIX", # https://docs.astral.sh/ruff/rules/#flake8-fixme-fix "FURB", # https://docs.astral.sh/ruff/rules/#refurb-furb + "RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret "T10", # https://docs.astral.sh/ruff/rules/#flake8-debugger-t10 "YTT", # https://docs.astral.sh/ruff/rules/#flake8-2020-ytt ] diff --git a/scaleway/scaleway/instance/v1/custom_api.py b/scaleway/scaleway/instance/v1/custom_api.py index 1892caf86..24a599705 100644 --- a/scaleway/scaleway/instance/v1/custom_api.py +++ b/scaleway/scaleway/instance/v1/custom_api.py @@ -95,9 +95,7 @@ def get_all_server_user_data( print("value: ", value) user_data[key] = value.content - res = GetAllServerUserDataResponse(user_data=user_data) - - return res + return GetAllServerUserDataResponse(user_data=user_data) def set_all_server_user_data( self, diff --git a/scaleway/tests/utils.py b/scaleway/tests/utils.py index 97dde0d80..0be040c24 100644 --- a/scaleway/tests/utils.py +++ b/scaleway/tests/utils.py @@ -26,8 +26,7 @@ def random_date(min: Union[str, datetime], max: Union[str, datetime]) -> datetim min_time = min if isinstance(min, datetime) else string_to_datetime(min) max_time = max if isinstance(max, datetime) else string_to_datetime(max) - random_time = min_time + system_random.random() * (max_time - min_time) - return random_time + return min_time + system_random.random() * (max_time - min_time) def datetime_to_string(date: datetime) -> str: