Skip to content

Commit 14396f6

Browse files
refactoring: Lots of refactoring of the code
1 parent 56daac5 commit 14396f6

File tree

13 files changed

+601
-616
lines changed

13 files changed

+601
-616
lines changed

diracx-client/src/diracx/client/_generated/aio/operations/_operations.py

Lines changed: 146 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
build_pilots_clear_pilots_request,
6262
build_pilots_create_pilot_secrets_request,
6363
build_pilots_delete_pilots_request,
64-
build_pilots_get_pilot_info_request,
64+
build_pilots_search_request,
6565
build_pilots_update_pilot_fields_request,
6666
build_well_known_get_installation_metadata_request,
6767
build_well_known_get_jwks_request,
@@ -2883,151 +2883,6 @@ async def clear_pilots(
28832883
if cls:
28842884
return cls(pipeline_response, None, {}) # type: ignore
28852885

2886-
@overload
2887-
async def get_pilot_info(
2888-
self,
2889-
body: Optional[_models.SearchParams] = None,
2890-
*,
2891-
page: int = 1,
2892-
per_page: int = 100,
2893-
content_type: str = "application/json",
2894-
**kwargs: Any,
2895-
) -> List[Dict[str, Any]]:
2896-
"""Get Pilot Info.
2897-
2898-
Retrieve information about pilots.
2899-
2900-
:param body: Default value is None.
2901-
:type body: ~_generated.models.SearchParams
2902-
:keyword page: Default value is 1.
2903-
:paramtype page: int
2904-
:keyword per_page: Default value is 100.
2905-
:paramtype per_page: int
2906-
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
2907-
Default value is "application/json".
2908-
:paramtype content_type: str
2909-
:return: list of dict mapping str to any
2910-
:rtype: list[dict[str, any]]
2911-
:raises ~azure.core.exceptions.HttpResponseError:
2912-
"""
2913-
2914-
@overload
2915-
async def get_pilot_info(
2916-
self,
2917-
body: Optional[IO[bytes]] = None,
2918-
*,
2919-
page: int = 1,
2920-
per_page: int = 100,
2921-
content_type: str = "application/json",
2922-
**kwargs: Any,
2923-
) -> List[Dict[str, Any]]:
2924-
"""Get Pilot Info.
2925-
2926-
Retrieve information about pilots.
2927-
2928-
:param body: Default value is None.
2929-
:type body: IO[bytes]
2930-
:keyword page: Default value is 1.
2931-
:paramtype page: int
2932-
:keyword per_page: Default value is 100.
2933-
:paramtype per_page: int
2934-
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
2935-
Default value is "application/json".
2936-
:paramtype content_type: str
2937-
:return: list of dict mapping str to any
2938-
:rtype: list[dict[str, any]]
2939-
:raises ~azure.core.exceptions.HttpResponseError:
2940-
"""
2941-
2942-
@distributed_trace_async
2943-
async def get_pilot_info(
2944-
self,
2945-
body: Optional[Union[_models.SearchParams, IO[bytes]]] = None,
2946-
*,
2947-
page: int = 1,
2948-
per_page: int = 100,
2949-
**kwargs: Any,
2950-
) -> List[Dict[str, Any]]:
2951-
"""Get Pilot Info.
2952-
2953-
Retrieve information about pilots.
2954-
2955-
:param body: Is either a SearchParams type or a IO[bytes] type. Default value is None.
2956-
:type body: ~_generated.models.SearchParams or IO[bytes]
2957-
:keyword page: Default value is 1.
2958-
:paramtype page: int
2959-
:keyword per_page: Default value is 100.
2960-
:paramtype per_page: int
2961-
:return: list of dict mapping str to any
2962-
:rtype: list[dict[str, any]]
2963-
:raises ~azure.core.exceptions.HttpResponseError:
2964-
"""
2965-
error_map: MutableMapping = {
2966-
401: ClientAuthenticationError,
2967-
404: ResourceNotFoundError,
2968-
409: ResourceExistsError,
2969-
304: ResourceNotModifiedError,
2970-
}
2971-
error_map.update(kwargs.pop("error_map", {}) or {})
2972-
2973-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
2974-
_params = kwargs.pop("params", {}) or {}
2975-
2976-
content_type: Optional[str] = kwargs.pop(
2977-
"content_type", _headers.pop("Content-Type", None)
2978-
)
2979-
cls: ClsType[List[Dict[str, Any]]] = kwargs.pop("cls", None)
2980-
2981-
content_type = content_type or "application/json"
2982-
_json = None
2983-
_content = None
2984-
if isinstance(body, (IOBase, bytes)):
2985-
_content = body
2986-
else:
2987-
if body is not None:
2988-
_json = self._serialize.body(body, "SearchParams")
2989-
else:
2990-
_json = None
2991-
2992-
_request = build_pilots_get_pilot_info_request(
2993-
page=page,
2994-
per_page=per_page,
2995-
content_type=content_type,
2996-
json=_json,
2997-
content=_content,
2998-
headers=_headers,
2999-
params=_params,
3000-
)
3001-
_request.url = self._client.format_url(_request.url)
3002-
3003-
_stream = False
3004-
pipeline_response: PipelineResponse = (
3005-
await self._client._pipeline.run( # pylint: disable=protected-access
3006-
_request, stream=_stream, **kwargs
3007-
)
3008-
)
3009-
3010-
response = pipeline_response.http_response
3011-
3012-
if response.status_code not in [200, 206]:
3013-
map_error(
3014-
status_code=response.status_code, response=response, error_map=error_map
3015-
)
3016-
raise HttpResponseError(response=response)
3017-
3018-
response_headers = {}
3019-
if response.status_code == 206:
3020-
response_headers["Content-Range"] = self._deserialize(
3021-
"str", response.headers.get("Content-Range")
3022-
)
3023-
3024-
deserialized = self._deserialize("[{object}]", pipeline_response.http_response)
3025-
3026-
if cls:
3027-
return cls(pipeline_response, deserialized, response_headers) # type: ignore
3028-
3029-
return deserialized # type: ignore
3030-
30312886
@overload
30322887
async def create_pilot_secrets(
30332888
self,
@@ -3460,3 +3315,148 @@ async def associate_pilot_with_jobs(
34603315

34613316
if cls:
34623317
return cls(pipeline_response, None, {}) # type: ignore
3318+
3319+
@overload
3320+
async def search(
3321+
self,
3322+
body: Optional[_models.SearchParams] = None,
3323+
*,
3324+
page: int = 1,
3325+
per_page: int = 100,
3326+
content_type: str = "application/json",
3327+
**kwargs: Any,
3328+
) -> List[Dict[str, Any]]:
3329+
"""Search.
3330+
3331+
Retrieve information about pilots.
3332+
3333+
:param body: Default value is None.
3334+
:type body: ~_generated.models.SearchParams
3335+
:keyword page: Default value is 1.
3336+
:paramtype page: int
3337+
:keyword per_page: Default value is 100.
3338+
:paramtype per_page: int
3339+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
3340+
Default value is "application/json".
3341+
:paramtype content_type: str
3342+
:return: list of dict mapping str to any
3343+
:rtype: list[dict[str, any]]
3344+
:raises ~azure.core.exceptions.HttpResponseError:
3345+
"""
3346+
3347+
@overload
3348+
async def search(
3349+
self,
3350+
body: Optional[IO[bytes]] = None,
3351+
*,
3352+
page: int = 1,
3353+
per_page: int = 100,
3354+
content_type: str = "application/json",
3355+
**kwargs: Any,
3356+
) -> List[Dict[str, Any]]:
3357+
"""Search.
3358+
3359+
Retrieve information about pilots.
3360+
3361+
:param body: Default value is None.
3362+
:type body: IO[bytes]
3363+
:keyword page: Default value is 1.
3364+
:paramtype page: int
3365+
:keyword per_page: Default value is 100.
3366+
:paramtype per_page: int
3367+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
3368+
Default value is "application/json".
3369+
:paramtype content_type: str
3370+
:return: list of dict mapping str to any
3371+
:rtype: list[dict[str, any]]
3372+
:raises ~azure.core.exceptions.HttpResponseError:
3373+
"""
3374+
3375+
@distributed_trace_async
3376+
async def search(
3377+
self,
3378+
body: Optional[Union[_models.SearchParams, IO[bytes]]] = None,
3379+
*,
3380+
page: int = 1,
3381+
per_page: int = 100,
3382+
**kwargs: Any,
3383+
) -> List[Dict[str, Any]]:
3384+
"""Search.
3385+
3386+
Retrieve information about pilots.
3387+
3388+
:param body: Is either a SearchParams type or a IO[bytes] type. Default value is None.
3389+
:type body: ~_generated.models.SearchParams or IO[bytes]
3390+
:keyword page: Default value is 1.
3391+
:paramtype page: int
3392+
:keyword per_page: Default value is 100.
3393+
:paramtype per_page: int
3394+
:return: list of dict mapping str to any
3395+
:rtype: list[dict[str, any]]
3396+
:raises ~azure.core.exceptions.HttpResponseError:
3397+
"""
3398+
error_map: MutableMapping = {
3399+
401: ClientAuthenticationError,
3400+
404: ResourceNotFoundError,
3401+
409: ResourceExistsError,
3402+
304: ResourceNotModifiedError,
3403+
}
3404+
error_map.update(kwargs.pop("error_map", {}) or {})
3405+
3406+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
3407+
_params = kwargs.pop("params", {}) or {}
3408+
3409+
content_type: Optional[str] = kwargs.pop(
3410+
"content_type", _headers.pop("Content-Type", None)
3411+
)
3412+
cls: ClsType[List[Dict[str, Any]]] = kwargs.pop("cls", None)
3413+
3414+
content_type = content_type or "application/json"
3415+
_json = None
3416+
_content = None
3417+
if isinstance(body, (IOBase, bytes)):
3418+
_content = body
3419+
else:
3420+
if body is not None:
3421+
_json = self._serialize.body(body, "SearchParams")
3422+
else:
3423+
_json = None
3424+
3425+
_request = build_pilots_search_request(
3426+
page=page,
3427+
per_page=per_page,
3428+
content_type=content_type,
3429+
json=_json,
3430+
content=_content,
3431+
headers=_headers,
3432+
params=_params,
3433+
)
3434+
_request.url = self._client.format_url(_request.url)
3435+
3436+
_stream = False
3437+
pipeline_response: PipelineResponse = (
3438+
await self._client._pipeline.run( # pylint: disable=protected-access
3439+
_request, stream=_stream, **kwargs
3440+
)
3441+
)
3442+
3443+
response = pipeline_response.http_response
3444+
3445+
if response.status_code not in [200, 206]:
3446+
map_error(
3447+
status_code=response.status_code, response=response, error_map=error_map
3448+
)
3449+
raise HttpResponseError(response=response)
3450+
3451+
response_headers = {}
3452+
if response.status_code == 206:
3453+
response_headers["Content-Range"] = self._deserialize(
3454+
"str", response.headers.get("Content-Range")
3455+
)
3456+
3457+
deserialized = self._deserialize("[{object}]", pipeline_response.http_response)
3458+
3459+
if cls:
3460+
return cls(pipeline_response, deserialized, response_headers) # type: ignore
3461+
3462+
return deserialized # type: ignore

0 commit comments

Comments
 (0)