From 666b0dadf972ab078a66e86fde398bc535a1994a Mon Sep 17 00:00:00 2001 From: Omer Zuarets Date: Sun, 27 Oct 2024 14:46:31 +0200 Subject: [PATCH] fix pre-commit --- horizon/data_manager/policy_store.py | 12 +++++++----- horizon/local/api.py | 16 +++++++++------- horizon/tests/test_local_api.py | 10 ++++++---- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/horizon/data_manager/policy_store.py b/horizon/data_manager/policy_store.py index 184503cc..07b0bb40 100644 --- a/horizon/data_manager/policy_store.py +++ b/horizon/data_manager/policy_store.py @@ -123,12 +123,14 @@ async def list_facts_by_type( per_page: int = 30, filters: dict[str, Any] | None = None, ) -> aiohttp.ClientResponse: - logger.info("Performing list facts for '{fact_type}' fact type from the External Data Manager", - fact_type=fact_type) + logger.info( + "Performing list facts for '{fact_type}' fact type from the External Data Manager", + fact_type=fact_type, + ) query_params = { - "page": page, - "per_page": per_page, - } | (filters or {}) + "page": page, + "per_page": per_page, + } | (filters or {}) res = await self.client.get( f"/v1/facts/{fact_type}", params=query_params, diff --git a/horizon/local/api.py b/horizon/local/api.py index 1aaff116..a8aaa881 100644 --- a/horizon/local/api.py +++ b/horizon/local/api.py @@ -18,7 +18,8 @@ RoleAssignment, ListRoleAssignmentsFilters, ListRoleAssignmentsPDPBody, - WrappedResponse, ListRoleAssignmentsPagination, + WrappedResponse, + ListRoleAssignmentsPagination, ) @@ -92,27 +93,27 @@ async def list_role_assignments( user: Optional[str] = Query( None, description="optional user filter, " - "will only return role assignments granted to this user.", + "will only return role assignments granted to this user.", ), role: Optional[str] = Query( None, description="optional role filter, " - "will only return role assignments granting this role.", + "will only return role assignments granting this role.", ), tenant: Optional[str] = Query( None, description="optional tenant filter, " - "will only return role assignments granted in that tenant.", + "will only return role assignments granted in that tenant.", ), resource: Optional[str] = Query( None, description="optional resource **type** filter, " - "will only return role assignments granted on that resource type.", + "will only return role assignments granted on that resource type.", ), resource_instance: Optional[str] = Query( None, description="optional resource instance filter, " - "will only return role assignments granted on that resource instance.", + "will only return role assignments granted on that resource instance.", ), page: int = Query( default=1, @@ -164,7 +165,7 @@ async def legacy_list_role_assignments() -> list[RoleAssignment]: if not isinstance(policy_store, DataManagerPolicyStoreClient): logger.warning( "External Data Manager is enabled by policy store is not set to {store_type}", - store_type=DataManagerPolicyStoreClient.__name__ + store_type=DataManagerPolicyStoreClient.__name__, ) return await legacy_list_role_assignments() else: @@ -172,4 +173,5 @@ async def legacy_list_role_assignments() -> list[RoleAssignment]: return parse_obj_as(list[RoleAssignment], await res.json()) else: return await legacy_list_role_assignments() + return router diff --git a/horizon/tests/test_local_api.py b/horizon/tests/test_local_api.py index 3ac08f58..5cca027a 100644 --- a/horizon/tests/test_local_api.py +++ b/horizon/tests/test_local_api.py @@ -28,9 +28,11 @@ def __init__(self, opal: OpalClient | None = None): class MockDataManagerPermitPDP(MockPermitPDP): def __init__(self): - super().__init__(opal=DataManagerClient( - shard_id=sidecar_config.SHARD_ID, data_topics=self._fix_data_topics() - )) + super().__init__( + opal=DataManagerClient( + shard_id=sidecar_config.SHARD_ID, data_topics=self._fix_data_topics() + ) + ) sidecar = MockPermitPDP() @@ -145,7 +147,7 @@ async def test_list_role_assignments_external_data_store() -> None: "tenant": "tenant1", "resource_instance": "resource_instance1", } - ] + ], ) response = _client.get(