99
1010from fastapi import FastAPI , status
1111from models_library .emails import LowerCaseEmailStr
12+ from models_library .products import ProductName
1213from models_library .services import ServiceMetaDataPublished , ServiceType
14+ from models_library .users import UserID
1315from pydantic import ConfigDict , TypeAdapter , ValidationError
1416from settings_library .catalog import CatalogSettings
1517from settings_library .tracing import TracingSettings
@@ -70,9 +72,9 @@ def to_solver(self) -> Solver:
7072
7173_exception_mapper = partial (service_exception_mapper , service_name = "Catalog" )
7274
73- TruncatedCatalogServiceOutAdapter : Final [
74- TypeAdapter [ TruncatedCatalogServiceOut ]
75- ] = TypeAdapter ( TruncatedCatalogServiceOut )
75+ TruncatedCatalogServiceOutAdapter : Final [TypeAdapter [ TruncatedCatalogServiceOut ]] = (
76+ TypeAdapter ( TruncatedCatalogServiceOut )
77+ )
7678TruncatedCatalogServiceOutListAdapter : Final [
7779 TypeAdapter [list [TruncatedCatalogServiceOut ]]
7880] = TypeAdapter (list [TruncatedCatalogServiceOut ])
@@ -97,8 +99,8 @@ class CatalogApi(BaseServiceClientApi):
9799 async def list_solvers (
98100 self ,
99101 * ,
100- user_id : int ,
101- product_name : str ,
102+ user_id : UserID ,
103+ product_name : ProductName ,
102104 predicate : Callable [[Solver ], bool ] | None = None ,
103105 ) -> list [Solver ]:
104106
@@ -140,7 +142,12 @@ async def list_solvers(
140142 http_status_map = {status .HTTP_404_NOT_FOUND : SolverOrStudyNotFoundError }
141143 )
142144 async def get_service (
143- self , * , user_id : int , name : SolverKeyId , version : VersionStr , product_name : str
145+ self ,
146+ * ,
147+ user_id : UserID ,
148+ name : SolverKeyId ,
149+ version : VersionStr ,
150+ product_name : ProductName ,
144151 ) -> Solver :
145152
146153 assert version != LATEST_VERSION # nosec
@@ -171,8 +178,13 @@ async def get_service(
171178 http_status_map = {status .HTTP_404_NOT_FOUND : SolverOrStudyNotFoundError }
172179 )
173180 async def get_service_ports (
174- self , * , user_id : int , name : SolverKeyId , version : VersionStr , product_name : str
175- ):
181+ self ,
182+ * ,
183+ user_id : UserID ,
184+ name : SolverKeyId ,
185+ version : VersionStr ,
186+ product_name : ProductName ,
187+ ) -> list [SolverPort ]:
176188
177189 assert version != LATEST_VERSION # nosec
178190
@@ -190,7 +202,7 @@ async def get_service_ports(
190202 return TypeAdapter (list [SolverPort ]).validate_python (response .json ())
191203
192204 async def list_latest_releases (
193- self , * , user_id : int , product_name : str
205+ self , * , user_id : UserID , product_name : ProductName
194206 ) -> list [Solver ]:
195207 solvers : list [Solver ] = await self .list_solvers (
196208 user_id = user_id , product_name = product_name
@@ -205,7 +217,7 @@ async def list_latest_releases(
205217 return list (latest_releases .values ())
206218
207219 async def list_solver_releases (
208- self , * , user_id : int , solver_key : SolverKeyId , product_name : str
220+ self , * , user_id : UserID , solver_key : SolverKeyId , product_name : ProductName
209221 ) -> list [Solver ]:
210222 def _this_solver (solver : Solver ) -> bool :
211223 return solver .id == solver_key
@@ -216,7 +228,7 @@ def _this_solver(solver: Solver) -> bool:
216228 return releases
217229
218230 async def get_latest_release (
219- self , * , user_id : int , solver_key : SolverKeyId , product_name : str
231+ self , * , user_id : UserID , solver_key : SolverKeyId , product_name : ProductName
220232 ) -> Solver :
221233 releases = await self .list_solver_releases (
222234 user_id = user_id , solver_key = solver_key , product_name = product_name
0 commit comments