Skip to content

Commit

Permalink
Add typehint to type_constructors dict
Browse files Browse the repository at this point in the history
  • Loading branch information
zrgt committed Nov 15, 2023
1 parent aaaaa88 commit 5366d6a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions basyx/aas/adapter/xml/xml_deserialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,9 +1315,8 @@ def read_aas_xml_element(file: IO, construct: XMLConstructables, failsafe: bool
:return: The constructed object or None, if an error occurred in failsafe mode.
"""
decoder_ = _select_decoder(failsafe, stripped, decoder)
constructor: Callable[..., object]

type_constructors = {
type_constructors: Dict[XMLConstructables, Callable[..., object]] = {
XMLConstructables.KEY: decoder_.construct_key,
XMLConstructables.REFERENCE: decoder_.construct_reference,
XMLConstructables.MODEL_REFERENCE: decoder_.construct_model_reference,
Expand Down Expand Up @@ -1361,6 +1360,7 @@ def read_aas_xml_element(file: IO, construct: XMLConstructables, failsafe: bool
XMLConstructables.VALUE_LIST: decoder_.construct_value_list,
}

constructor: Callable[..., object]
if construct in type_constructors:
constructor = type_constructors[construct]
else:
Expand Down

0 comments on commit 5366d6a

Please sign in to comment.