Skip to content

Commit

Permalink
<Enhancement>[]: <Untangle V11 Format Update IX>
Browse files Browse the repository at this point in the history
[
* Appropriate naming
]

[#53]
  • Loading branch information
Humberto Sanchez II committed Sep 4, 2023
1 parent 6ce0db4 commit ee58a91
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 95 deletions.
98 changes: 49 additions & 49 deletions untanglepyut/XmlConstants.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@

X10_ELEMENT_FIELD: str = 'Field'
X10_ELEMENT_METHOD: str = 'Method'
X10_ELEMENT_PARAMETER: str = 'Param'

X10_ATTR_ID: str = 'id'
X10_ATTR_NAME: str = 'name'
X10_ATTR_TYPE: str = 'type'
X10_ATTR_STEREOTYPE: str = 'stereotype'
X10_ATTR_DEFAULT_VALUE: str = 'defaultValue'

X10_ATTR_DISPLAY_STEREOTYPE: str = 'showStereoType'
X10_ATTR_DISPLAY_METHODS: str = 'showMethods'
X10_ATTR_DISPLAY_FIELDS: str = 'showFields'
X10_ATTR_DISPLAY_PARAMETERS: str = 'displayParameters'

X10_ATTR_CARDINALITY_SOURCE: str = 'cardSrc'
X10_ATTR_CARDINALITY_DESTINATION: str = 'cardDestination'
X10_ATTR_BIDIRECTIONAL: str = 'bidir'
X10_ATTR_SOURCE_ID: str = 'sourceId'
X10_ATTR_DESTINATION_ID: str = 'destId'
X10_ATTR_SOURCE_TIME: str = 'srcTime'
X10_ATTR_DESTINATION_TIME: str = 'dstTime'

X10_ATTR_FILENAME: str = 'filename'

X11_ELEMENT_FIELD: str = 'PyutField'
X11_ELEMENT_METHOD: str = 'PyutMethod'
X11_ELEMENT_PARAMETER: str = 'PyutParameter'

X11_ATTR_STEREOTYPE: str = 'stereotype'
X11_ATTR_DISPLAY_STEREOTYPE: str = 'displayStereotype'
X11_ATTR_DISPLAY_METHODS: str = 'displayMethods'
X11_ATTR_DISPLAY_FIELDS: str = 'displayFields'
X11_ATTR_DISPLAY_PARAMETERS: str = 'displayParameters'

X11_ATTR_ID: str = X10_ATTR_ID
X11_ATTR_NAME: str = 'name'
X11_ATTR_TYPE: str = 'type'
X11_ATTR_DEFAULT_VALUE: str = 'defaultValue'

X11_ATTR_CARDINALITY_SOURCE: str = 'cardinalitySource'
X11_ATTR_CARDINALITY_DESTINATION: str = 'cardinalityDestination'
X11_ATTR_BIDIRECTIONAL: str = 'bidirectional'
X11_ATTR_SOURCE_ID: str = 'sourceID'
X11_ATTR_DESTINATION_ID: str = 'destinationID'
X11_ATTR_SOURCE_TIME: str = 'sourceTime'
X11_ATTR_DESTINATION_TIME: str = 'destinationTime'

X11_ATTR_FILENAME: str = X10_ATTR_FILENAME
V10_ELEMENT_FIELD: str = 'Field'
V10_ELEMENT_METHOD: str = 'Method'
V10_ELEMENT_PARAMETER: str = 'Param'

V10_ATTR_ID: str = 'id'
V10_ATTR_NAME: str = 'name'
V10_ATTR_TYPE: str = 'type'
V10_ATTR_STEREOTYPE: str = 'stereotype'
V10_ATTR_DEFAULT_VALUE: str = 'defaultValue'

V10_ATTR_DISPLAY_STEREOTYPE: str = 'showStereoType'
V10_ATTR_DISPLAY_METHODS: str = 'showMethods'
V10_ATTR_DISPLAY_FIELDS: str = 'showFields'
V10_ATTR_DISPLAY_PARAMETERS: str = 'displayParameters'

V10_ATTR_CARDINALITY_SOURCE: str = 'cardSrc'
V10_ATTR_CARDINALITY_DESTINATION: str = 'cardDestination'
V10_ATTR_BIDIRECTIONAL: str = 'bidir'
V10_ATTR_SOURCE_ID: str = 'sourceId'
V10_ATTR_DESTINATION_ID: str = 'destId'
V10_ATTR_SOURCE_TIME: str = 'srcTime'
V10_ATTR_DESTINATION_TIME: str = 'dstTime'

V10_ATTR_FILENAME: str = 'filename'

V11_ELEMENT_FIELD: str = 'PyutField'
V11_ELEMENT_METHOD: str = 'PyutMethod'
V11_ELEMENT_PARAMETER: str = 'PyutParameter'

V11_ATTR_STEREOTYPE: str = 'stereotype'
V11_ATTR_DISPLAY_STEREOTYPE: str = 'displayStereotype'
V11_ATTR_DISPLAY_METHODS: str = 'displayMethods'
V11_ATTR_DISPLAY_FIELDS: str = 'displayFields'
V11_ATTR_DISPLAY_PARAMETERS: str = 'displayParameters'

V11_ATTR_ID: str = V10_ATTR_ID
V11_ATTR_NAME: str = 'name'
V11_ATTR_TYPE: str = 'type'
V11_ATTR_DEFAULT_VALUE: str = 'defaultValue'

V11_ATTR_CARDINALITY_SOURCE: str = 'cardinalitySource'
V11_ATTR_CARDINALITY_DESTINATION: str = 'cardinalityDestination'
V11_ATTR_BIDIRECTIONAL: str = 'bidirectional'
V11_ATTR_SOURCE_ID: str = 'sourceID'
V11_ATTR_DESTINATION_ID: str = 'destinationID'
V11_ATTR_SOURCE_TIME: str = 'sourceTime'
V11_ATTR_DESTINATION_TIME: str = 'destinationTime'

V11_ATTR_FILENAME: str = V10_ATTR_FILENAME
92 changes: 46 additions & 46 deletions untanglepyut/v11/UnTanglePyut.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,47 +71,47 @@ def __init__(self, xmlVersion: XmlVersion):

self._xmlVersion: XmlVersion = xmlVersion
if self._xmlVersion == XmlVersion.V10:
self._elementMethod: str = XmlConstants.X10_ELEMENT_METHOD
self._elementParameter: str = XmlConstants.X10_ELEMENT_PARAMETER
self._elementField: str = XmlConstants.X10_ELEMENT_FIELD

self._attrId: str = XmlConstants.X10_ATTR_ID
self._attrStereoType: str = XmlConstants.X10_ATTR_STEREOTYPE
self._attrDisplayMethods: str = XmlConstants.X10_ATTR_DISPLAY_METHODS
self._attrDisplayParameters: str = XmlConstants.X10_ATTR_DISPLAY_PARAMETERS
self._attrDisplayFields: str = XmlConstants.X10_ATTR_DISPLAY_FIELDS
self._attrDisplayStereoType: str = XmlConstants.X10_ATTR_DISPLAY_STEREOTYPE

self._attrCardinalitySource: str = XmlConstants.X10_ATTR_CARDINALITY_SOURCE
self._attrCardinalityDestination: str = XmlConstants.X10_ATTR_CARDINALITY_DESTINATION
self._attrBidirectional: str = XmlConstants.X10_ATTR_BIDIRECTIONAL
self._attrSourceId: str = XmlConstants.X10_ATTR_SOURCE_ID
self._attrDestinationId: str = XmlConstants.X10_ATTR_DESTINATION_ID
self._attrSourceTime: str = XmlConstants.X10_ATTR_SOURCE_TIME
self._attrDestinationTime: str = XmlConstants.X10_ATTR_DESTINATION_TIME

self._attrFileName: str = XmlConstants.X10_ATTR_FILENAME
self._elementMethod: str = XmlConstants.V10_ELEMENT_METHOD
self._elementParameter: str = XmlConstants.V10_ELEMENT_PARAMETER
self._elementField: str = XmlConstants.V10_ELEMENT_FIELD

self._attrId: str = XmlConstants.V10_ATTR_ID
self._attrStereoType: str = XmlConstants.V10_ATTR_STEREOTYPE
self._attrDisplayMethods: str = XmlConstants.V10_ATTR_DISPLAY_METHODS
self._attrDisplayParameters: str = XmlConstants.V10_ATTR_DISPLAY_PARAMETERS
self._attrDisplayFields: str = XmlConstants.V10_ATTR_DISPLAY_FIELDS
self._attrDisplayStereoType: str = XmlConstants.V10_ATTR_DISPLAY_STEREOTYPE

self._attrCardinalitySource: str = XmlConstants.V10_ATTR_CARDINALITY_SOURCE
self._attrCardinalityDestination: str = XmlConstants.V10_ATTR_CARDINALITY_DESTINATION
self._attrBidirectional: str = XmlConstants.V10_ATTR_BIDIRECTIONAL
self._attrSourceId: str = XmlConstants.V10_ATTR_SOURCE_ID
self._attrDestinationId: str = XmlConstants.V10_ATTR_DESTINATION_ID
self._attrSourceTime: str = XmlConstants.V10_ATTR_SOURCE_TIME
self._attrDestinationTime: str = XmlConstants.V10_ATTR_DESTINATION_TIME

self._attrFileName: str = XmlConstants.V10_ATTR_FILENAME
else:
self._elementParameter = XmlConstants.X11_ELEMENT_PARAMETER
self._elementMethod = XmlConstants.X11_ELEMENT_METHOD
self._elementField = XmlConstants.X11_ELEMENT_FIELD

self._attrId = XmlConstants.X11_ATTR_ID
self._attrStereoType = XmlConstants.X11_ATTR_STEREOTYPE
self._attrDisplayMethods = XmlConstants.X11_ATTR_DISPLAY_METHODS
self._attrDisplayParameters = XmlConstants.X11_ATTR_DISPLAY_PARAMETERS
self._attrDisplayFields = XmlConstants.X11_ATTR_DISPLAY_FIELDS
self._attrDisplayStereoType = XmlConstants.X11_ATTR_DISPLAY_STEREOTYPE

self._attrCardinalitySource = XmlConstants.X11_ATTR_CARDINALITY_SOURCE
self._attrCardinalityDestination = XmlConstants.X11_ATTR_CARDINALITY_DESTINATION
self._attrBidirectional = XmlConstants.X11_ATTR_BIDIRECTIONAL
self._attrSourceId = XmlConstants.X11_ATTR_SOURCE_ID
self._attrDestinationId = XmlConstants.X11_ATTR_DESTINATION_ID
self._attrSourceTime = XmlConstants.X11_ATTR_SOURCE_TIME
self._attrDestinationTime = XmlConstants.X11_ATTR_DESTINATION_TIME

self._attrFileName = XmlConstants.X10_ATTR_FILENAME
self._elementParameter = XmlConstants.V11_ELEMENT_PARAMETER
self._elementMethod = XmlConstants.V11_ELEMENT_METHOD
self._elementField = XmlConstants.V11_ELEMENT_FIELD

self._attrId = XmlConstants.V11_ATTR_ID
self._attrStereoType = XmlConstants.V11_ATTR_STEREOTYPE
self._attrDisplayMethods = XmlConstants.V11_ATTR_DISPLAY_METHODS
self._attrDisplayParameters = XmlConstants.V11_ATTR_DISPLAY_PARAMETERS
self._attrDisplayFields = XmlConstants.V11_ATTR_DISPLAY_FIELDS
self._attrDisplayStereoType = XmlConstants.V11_ATTR_DISPLAY_STEREOTYPE

self._attrCardinalitySource = XmlConstants.V11_ATTR_CARDINALITY_SOURCE
self._attrCardinalityDestination = XmlConstants.V11_ATTR_CARDINALITY_DESTINATION
self._attrBidirectional = XmlConstants.V11_ATTR_BIDIRECTIONAL
self._attrSourceId = XmlConstants.V11_ATTR_SOURCE_ID
self._attrDestinationId = XmlConstants.V11_ATTR_DESTINATION_ID
self._attrSourceTime = XmlConstants.V11_ATTR_SOURCE_TIME
self._attrDestinationTime = XmlConstants.V11_ATTR_DESTINATION_TIME

self._attrFileName = XmlConstants.V10_ATTR_FILENAME

def classToPyutClass(self, graphicClass: Element) -> PyutClass:
if self._xmlVersion == XmlVersion.V10:
Expand Down Expand Up @@ -373,15 +373,15 @@ def _fieldToPyutFields(self, classElement: Element) -> PyutFields:
assert len(paramElements) == 1, 'Curiously there should be only one'

paramElement: Element = paramElements[0]
fieldName: str = paramElement[XmlConstants.X10_ATTR_NAME]
pyutType: PyutType = PyutType(paramElement[XmlConstants.X10_ATTR_TYPE])
defaultValue: str = paramElement[XmlConstants.X10_ATTR_DEFAULT_VALUE]
fieldName: str = paramElement[XmlConstants.V10_ATTR_NAME]
pyutType: PyutType = PyutType(paramElement[XmlConstants.V10_ATTR_TYPE])
defaultValue: str = paramElement[XmlConstants.V10_ATTR_DEFAULT_VALUE]
if defaultValue is None:
defaultValue = ''
elif self._xmlVersion == XmlVersion.V11:
fieldName = fieldElement[XmlConstants.X11_ATTR_NAME]
pyutType = PyutType(fieldElement[XmlConstants.X11_ATTR_TYPE])
defaultValue = fieldElement[XmlConstants.X11_ATTR_DEFAULT_VALUE]
fieldName = fieldElement[XmlConstants.V11_ATTR_NAME]
pyutType = PyutType(fieldElement[XmlConstants.V11_ATTR_TYPE])
defaultValue = fieldElement[XmlConstants.V11_ATTR_DEFAULT_VALUE]
else:
assert False, f'Unsupported Xml Version {self._xmlVersion}'

Expand Down

0 comments on commit ee58a91

Please sign in to comment.