diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4e568ad..2c05ae2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,16 @@ repos: - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.2 + - repo: https://github.com/pycqa/isort + rev: 5.13.2 hooks: - - id: ruff - - id: ruff-format + - id: isort + args: ["--profile", "black", "--line-length", "88"] - repo: https://github.com/psf/black rev: 24.4.2 hooks: - id: black - - repo: https://github.com/pycqa/isort - rev: 5.13.2 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.5.2 hooks: - - id: isort + - id: ruff diff --git a/app/__init__.py b/app/__init__.py index d91541d..7607a92 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1,2 +1 @@ """Пакет приложения SFM Streamlit.""" - diff --git a/app/auth/__init__.py b/app/auth/__init__.py index c02ea22..711dfcb 100644 --- a/app/auth/__init__.py +++ b/app/auth/__init__.py @@ -1,2 +1 @@ """Вспомогательные модули аутентификации SFM Streamlit.""" - diff --git a/app/auth/mock_provider.py b/app/auth/mock_provider.py index 460fc10..7a1594a 100644 --- a/app/auth/mock_provider.py +++ b/app/auth/mock_provider.py @@ -31,4 +31,3 @@ def get_jwt_token() -> dict[str, str] | None: "realm_access": {"roles": ["local_dev"]}, } return st.session_state["local_mock_profile"] - diff --git a/app/auth/providers.py b/app/auth/providers.py index 1d055a7..d037f81 100644 --- a/app/auth/providers.py +++ b/app/auth/providers.py @@ -2,7 +2,6 @@ from __future__ import annotations from typing import Any, Protocol - from .mock_provider import get_jwt_token as get_jwt_token_local from .mock_provider import protect_application as protect_application_local @@ -19,11 +18,11 @@ class LocalMockProvider: class RaisaProvider: def get_token_data(self) -> dict[str, Any] | None: - from raisa_streamlit_oauth import ( # type: ignore[reportMissingImports] - get_jwt_token as get_jwt_token_raisa, + from raisa_streamlit_oauth import ( + get_jwt_token as get_jwt_token_raisa, # type: ignore[reportMissingImports] ) - from raisa_streamlit_oauth import ( # type: ignore[reportMissingImports] - protect_application as protect_application_raisa, + from raisa_streamlit_oauth import ( + protect_application as protect_application_raisa, # type: ignore[reportMissingImports] ) protect_application_raisa(render_exit=False) @@ -31,7 +30,4 @@ class RaisaProvider: def build_auth_provider() -> AuthProvider: - if get_location() == "local": - return LocalMockProvider() return RaisaProvider() - diff --git a/app/auth/service.py b/app/auth/service.py index 6617c8a..3df1c90 100644 --- a/app/auth/service.py +++ b/app/auth/service.py @@ -38,4 +38,3 @@ class AuthService: st.session_state["token_data"] = token_data st.session_state["user_profile"] = token_data return True - diff --git a/app/ui.py b/app/ui.py index 4ffd1dc..e51e626 100644 --- a/app/ui.py +++ b/app/ui.py @@ -14,4 +14,3 @@ def render_profile(profile: dict) -> None: "realm_roles": profile.get("realm_access", {}).get("roles", []), } ) -