Skip to content

Commit e56e503

Browse files
committed
fix MyPy issues
1 parent 8e98ddf commit e56e503

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

server/app/interfaces/base.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import io
1111
import itertools
1212
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
1414

1515
import werkzeug.exceptions
1616
import werkzeug.routing
@@ -320,14 +320,14 @@ def json_list(cls, data: Union[str, bytes], expect_type: Type[T], stripped: bool
320320
# TODO: json deserialization will always create an ModelReference[Submodel], xml deserialization determines
321321
# that automatically
322322
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,
328328
}
329329

330-
constructor: Optional[Callable[..., T]] = mapping.get(expect_type)
330+
constructor: Optional[Callable[..., T]] = mapping.get(expect_type) # type: ignore[assignment]
331331
args = []
332332
if expect_type is model.ModelReference:
333333
args.append(model.Submodel)
@@ -418,12 +418,12 @@ def request_body_list(cls, request: Request, expect_type: Type[T], stripped: boo
418418
# Für jedes Element wird die Konvertierung angewandt.
419419
return [cls._convert_single_json_item(item, expect_type, stripped) for item in parsed] # type: ignore
420420
else:
421-
return cls._convert_single_json_item(parsed, expect_type, stripped)
421+
return [cls._convert_single_json_item(parsed, expect_type, stripped)]
422422
else:
423-
return cls.xml(request.get_data(), expect_type, stripped)
423+
return [cls.xml(request.get_data(), expect_type, stripped)]
424424

425425
@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:
427427
"""
428428
Converts a single JSON-Object (as a Python-Dict) to an object of type expect_type.
429429
Here the dictionary is first serialized back to a JSON-string and returned as bytes.

0 commit comments

Comments
 (0)