From dbbba2942293be5445b1ebabaf89a607340710ba Mon Sep 17 00:00:00 2001 From: fstagni Date: Wed, 18 Oct 2023 06:54:27 +0200 Subject: [PATCH] style: pre-commit fixes --- .pre-commit-config.yaml | 2 +- environment.yml | 2 +- pyproject.toml | 13 ++++++++++++- setup.cfg | 2 +- src/diracx/core/extensions.py | 2 -- src/diracx/routers/job_manager/sandboxes.py | 10 +--------- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9f140cb8..afc13383 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: hooks: - id: mypy additional_dependencies: - - pydantic==1.10.10 + - pydantic==1.10.13 - sqlalchemy - types-PyYAML - types-cachetools diff --git a/environment.yml b/environment.yml index b54959fc..8a11e992 100644 --- a/environment.yml +++ b/environment.yml @@ -31,7 +31,7 @@ dependencies: - isodate - mypy - opensearch-py - - pydantic =1.10.10 + - pydantic =1.10.13 - pyjwt - pytest - pytest-asyncio diff --git a/pyproject.toml b/pyproject.toml index 1fa2feb7..599daabd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,12 +7,23 @@ build-backend = "setuptools.build_meta" [tool.setuptools_scm] [tool.ruff] -select = ["E", "F", "B", "I", "PLE"] +select = [ + "E", # pycodestyle errrors + "F", # pyflakes + "B", # flake8-bugbear + "I", # isort + "PLE", # pylint errors + # "UP", # pyUpgrade + "FLY", # flynt +] ignore = ["B905", "B008", "B006"] line-length = 120 src = ["src", "tests"] exclude = ["src/diracx/client/"] +[tool.isort] +profile = "black" + [tool.ruff.flake8-bugbear] # Allow default arguments like, e.g., `data: List[str] = fastapi.Query(None)`. extend-immutable-calls = ["fastapi.Depends", "fastapi.Query", "fastapi.Path", "fastapi.Body", "fastapi.Header"] diff --git a/setup.cfg b/setup.cfg index 75823123..0006c316 100644 --- a/setup.cfg +++ b/setup.cfg @@ -42,7 +42,7 @@ install_requires = isodate mypy opensearch-py - pydantic ==1.10.10 + pydantic ==1.10.13 python-dotenv python-jose python-multipart diff --git a/src/diracx/core/extensions.py b/src/diracx/core/extensions.py index 46786a96..72d98808 100644 --- a/src/diracx/core/extensions.py +++ b/src/diracx/core/extensions.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - __all__ = ("select_from_extension",) import os diff --git a/src/diracx/routers/job_manager/sandboxes.py b/src/diracx/routers/job_manager/sandboxes.py index 280ff6fc..5a4e7ffe 100644 --- a/src/diracx/routers/job_manager/sandboxes.py +++ b/src/diracx/routers/job_manager/sandboxes.py @@ -175,15 +175,7 @@ async def get_sandbox_file( pfn = pfn.split("|", 1)[-1] required_prefix = ( "/" - + "/".join( - [ - "S3", - settings.bucket_name, - user_info.vo, - user_info.dirac_group, - user_info.preferred_username, - ] - ) + + f"S3/{settings.bucket_name}/{user_info.vo}/{user_info.dirac_group}/{user_info.preferred_username}" + "/" ) if not pfn.startswith(required_prefix):