diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6ed1f96e8..739ac051d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - markdown - rst - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.9.6 hooks: - id: ruff-format - id: ruff @@ -47,7 +47,7 @@ repos: docs/spelling_wordlist.txt| .gitignore - repo: https://github.com/sirosen/check-jsonschema - rev: 0.30.0 + rev: 0.31.1 hooks: - id: check-github-actions - id: check-github-workflows diff --git a/platform_api/handlers/jobs_handler.py b/platform_api/handlers/jobs_handler.py index a0806a38b..325735e19 100644 --- a/platform_api/handlers/jobs_handler.py +++ b/platform_api/handlers/jobs_handler.py @@ -465,9 +465,9 @@ def convert_disk_volume_to_json(volume: DiskContainerVolume) -> dict[str, Any]: def convert_job_to_job_response(job: Job) -> dict[str, Any]: - assert ( - job.cluster_name - ), "empty cluster name must be already replaced with `default`" + assert job.cluster_name, ( + "empty cluster name must be already replaced with `default`" + ) history = job.status_history current_status = history.current response_payload: dict[str, Any] = { diff --git a/platform_api/orchestrator/jobs_service.py b/platform_api/orchestrator/jobs_service.py index 35aea0fbb..8b6d544d8 100644 --- a/platform_api/orchestrator/jobs_service.py +++ b/platform_api/orchestrator/jobs_service.py @@ -192,7 +192,7 @@ async def _setup_pass_config( ) -> JobRequest: if NEURO_PASSED_CONFIG in job_request.container.env: raise JobsServiceException( - f"Cannot pass config: ENV '{NEURO_PASSED_CONFIG}' " "already specified" + f"Cannot pass config: ENV '{NEURO_PASSED_CONFIG}' already specified" ) token = await self._make_pass_config_token( user.name, cluster_name, job_request.job_id diff --git a/platform_api/orchestrator/kube_client.py b/platform_api/orchestrator/kube_client.py index 4e6d3be2a..efc0f7ab2 100644 --- a/platform_api/orchestrator/kube_client.py +++ b/platform_api/orchestrator/kube_client.py @@ -1975,8 +1975,7 @@ def _networking_v1beta1_namespace_url(self) -> str: @property def _networking_v1_namespace_url(self) -> str: return ( - f"{self._base_url}/apis/networking.k8s.io/v1" - f"/namespaces/{self._namespace}" + f"{self._base_url}/apis/networking.k8s.io/v1/namespaces/{self._namespace}" ) @property diff --git a/platform_api/utils/update_notifier.py b/platform_api/utils/update_notifier.py index 90b1deece..40cb06674 100644 --- a/platform_api/utils/update_notifier.py +++ b/platform_api/utils/update_notifier.py @@ -94,8 +94,7 @@ async def listen_to_updates( ) -> AsyncIterator[Subscription]: def _listener(*args: Any, **kwargs: Any) -> None: logger.info( - f"{type(self).__qualname__}: Notified " - f"from channel {self._channel!r}" + f"{type(self).__qualname__}: Notified from channel {self._channel!r}" ) listener() diff --git a/tests/integration/api.py b/tests/integration/api.py index 2fb98b788..3f264f770 100644 --- a/tests/integration/api.py +++ b/tests/integration/api.py @@ -309,9 +309,9 @@ async def delete_job( url, headers=headers or self._headers ) as response: if assert_success: - assert ( - response.status == HTTPNoContent.status_code - ), await response.text() + assert response.status == HTTPNoContent.status_code, ( + await response.text() + ) async def drop_job( self, @@ -322,9 +322,9 @@ async def drop_job( url = self._api_config.generate_job_url(job_id) + "/drop" async with self._client.post(url, headers=headers or self._headers) as response: if assert_success: - assert ( - response.status == HTTPNoContent.status_code - ), await response.text() + assert response.status == HTTPNoContent.status_code, ( + await response.text() + ) async def drop_progress( self, @@ -341,9 +341,9 @@ async def drop_progress( url, json=payload, headers=headers or self._headers ) as response: if assert_success: - assert ( - response.status == HTTPNoContent.status_code - ), await response.text() + assert response.status == HTTPNoContent.status_code, ( + await response.text() + ) @pytest.fixture diff --git a/tests/integration/test_api.py b/tests/integration/test_api.py index 821f9131d..f66c809c6 100644 --- a/tests/integration/test_api.py +++ b/tests/integration/test_api.py @@ -4635,9 +4635,9 @@ async def test_get_jobs_return_corrects_id( async with client.post( url, headers=regular_user.headers, json=job_submit ) as response: - assert ( - response.status == HTTPAccepted.status_code - ), await response.text() + assert response.status == HTTPAccepted.status_code, ( + await response.text() + ) result = await response.json() assert result["status"] in ["pending"] job_id = result["id"] @@ -4958,9 +4958,9 @@ async def test_set_job_status_no_reason( assert result["error"] == f"Job {{id={job_id}}} has changed" ok = False else: - assert ( - response.status == HTTPNoContent.status_code - ), await response.text() + assert response.status == HTTPNoContent.status_code, ( + await response.text() + ) ok = True if ok: @@ -4997,9 +4997,9 @@ async def test_set_job_status_with_details( assert result["error"] == f"Job {{id={job_id}}} has changed" ok = False else: - assert ( - response.status == HTTPNoContent.status_code - ), await response.text() + assert response.status == HTTPNoContent.status_code, ( + await response.text() + ) ok = True if ok: diff --git a/tests/unit/test_job_service.py b/tests/unit/test_job_service.py index b2a24da02..25733fbcf 100644 --- a/tests/unit/test_job_service.py +++ b/tests/unit/test_job_service.py @@ -509,8 +509,7 @@ async def test_create_job_pass_config_env_present( mock_job_request.container.env[NEURO_PASSED_CONFIG] = "anything" with pytest.raises( JobsServiceException, - match=f"Cannot pass config: ENV '{NEURO_PASSED_CONFIG}' " - "already specified", + match=f"Cannot pass config: ENV '{NEURO_PASSED_CONFIG}' already specified", ): await jobs_service.create_job( job_request=mock_job_request,