|
10 | 10 | import io |
11 | 11 | import itertools |
12 | 12 | import json |
13 | | -from typing import Iterable, Type, Iterator, Tuple, Optional, List, Union, Dict, Callable, TypeVar |
| 13 | +from typing import Iterable, Type, Iterator, Tuple, Optional, List, Union, Dict, Callable, TypeVar, Any |
14 | 14 |
|
15 | 15 | import werkzeug.exceptions |
16 | 16 | import werkzeug.routing |
@@ -320,14 +320,14 @@ def json_list(cls, data: Union[str, bytes], expect_type: Type[T], stripped: bool |
320 | 320 | # TODO: json deserialization will always create an ModelReference[Submodel], xml deserialization determines |
321 | 321 | # that automatically |
322 | 322 | mapping = { |
323 | | - model.ModelReference: decoder._construct_model_reference, # type: ignore[assignment] |
324 | | - model.AssetInformation: decoder._construct_asset_information, # type: ignore[assignment] |
325 | | - model.SpecificAssetId: decoder._construct_specific_asset_id, # type: ignore[assignment] |
326 | | - model.Reference: decoder._construct_reference, # type: ignore[assignment] |
327 | | - model.Qualifier: decoder._construct_qualifier, # type: ignore[assignment] |
| 323 | + model.ModelReference: decoder._construct_model_reference, |
| 324 | + model.AssetInformation: decoder._construct_asset_information, |
| 325 | + model.SpecificAssetId: decoder._construct_specific_asset_id, |
| 326 | + model.Reference: decoder._construct_reference, |
| 327 | + model.Qualifier: decoder._construct_qualifier, |
328 | 328 | } |
329 | 329 |
|
330 | | - constructor: Optional[Callable[..., T]] = mapping.get(expect_type) |
| 330 | + constructor: Optional[Callable[..., T]] = mapping.get(expect_type) # type: ignore[assignment] |
331 | 331 | args = [] |
332 | 332 | if expect_type is model.ModelReference: |
333 | 333 | args.append(model.Submodel) |
@@ -418,12 +418,12 @@ def request_body_list(cls, request: Request, expect_type: Type[T], stripped: boo |
418 | 418 | # Für jedes Element wird die Konvertierung angewandt. |
419 | 419 | return [cls._convert_single_json_item(item, expect_type, stripped) for item in parsed] # type: ignore |
420 | 420 | else: |
421 | | - return cls._convert_single_json_item(parsed, expect_type, stripped) |
| 421 | + return [cls._convert_single_json_item(parsed, expect_type, stripped)] |
422 | 422 | else: |
423 | | - return cls.xml(request.get_data(), expect_type, stripped) |
| 423 | + return [cls.xml(request.get_data(), expect_type, stripped)] |
424 | 424 |
|
425 | 425 | @classmethod |
426 | | - def _convert_single_json_item(cls, data: any, expect_type: Type[T], stripped: bool) -> T: |
| 426 | + def _convert_single_json_item(cls, data: Any, expect_type: Type[T], stripped: bool) -> T: |
427 | 427 | """ |
428 | 428 | Converts a single JSON-Object (as a Python-Dict) to an object of type expect_type. |
429 | 429 | Here the dictionary is first serialized back to a JSON-string and returned as bytes. |
|
0 commit comments