|
5 | 5 | from dataclasses import dataclass |
6 | 6 | from functools import partial |
7 | 7 | from operator import attrgetter |
| 8 | +from typing import Final |
8 | 9 |
|
9 | 10 | from fastapi import FastAPI, status |
10 | 11 | from models_library.emails import LowerCaseEmailStr |
@@ -68,11 +69,11 @@ def to_solver(self) -> Solver: |
68 | 69 |
|
69 | 70 | _exception_mapper = partial(service_exception_mapper, "Catalog") |
70 | 71 |
|
71 | | -_TRUNCATED_CATALOG_SERVICE_OUT_ADAPTER: TypeAdapter[ |
72 | | - TruncatedCatalogServiceOut |
| 72 | +TruncatedCatalogServiceOutAdapter: Final[ |
| 73 | + TypeAdapter[TruncatedCatalogServiceOut] |
73 | 74 | ] = TypeAdapter(TruncatedCatalogServiceOut) |
74 | | -_LIST_OF_TRUNCATED_CATALOG_SERVICE_OUT_ADAPTER: TypeAdapter[ |
75 | | - list[TruncatedCatalogServiceOut] |
| 75 | +TruncatedCatalogServiceOutListAdapter: Final[ |
| 76 | + TypeAdapter[list[TruncatedCatalogServiceOut]] |
76 | 77 | ] = TypeAdapter(list[TruncatedCatalogServiceOut]) |
77 | 78 |
|
78 | 79 |
|
@@ -110,8 +111,8 @@ async def list_solvers( |
110 | 111 | ] = await asyncio.get_event_loop().run_in_executor( |
111 | 112 | None, |
112 | 113 | _parse_response, |
113 | | - _LIST_OF_TRUNCATED_CATALOG_SERVICE_OUT_ADAPTER, |
114 | | - response.text, |
| 114 | + TruncatedCatalogServiceOutListAdapter, |
| 115 | + response, |
115 | 116 | ) |
116 | 117 | solvers = [] |
117 | 118 | for service in services: |
@@ -152,7 +153,7 @@ async def get_service( |
152 | 153 | service: ( |
153 | 154 | TruncatedCatalogServiceOut |
154 | 155 | ) = await asyncio.get_event_loop().run_in_executor( |
155 | | - None, _parse_response, _TRUNCATED_CATALOG_SERVICE_OUT_ADAPTER, response.text |
| 156 | + None, _parse_response, TruncatedCatalogServiceOutAdapter, response |
156 | 157 | ) |
157 | 158 | assert ( # nosec |
158 | 159 | service.service_type == ServiceType.COMPUTATIONAL |
|
0 commit comments