Code Duplication    Length = 45-50 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 1054-1103 (lines=50) @@
1051
    __repr__ = __str__
1052
1053
1054
class RequestHeader(FrozenClass):
1055
    '''
1056
    The header passed with every server request.
1057
1058
    :ivar AuthenticationToken:
1059
    :vartype AuthenticationToken: NodeId
1060
    :ivar Timestamp:
1061
    :vartype Timestamp: DateTime
1062
    :ivar RequestHandle:
1063
    :vartype RequestHandle: UInt32
1064
    :ivar ReturnDiagnostics:
1065
    :vartype ReturnDiagnostics: UInt32
1066
    :ivar AuditEntryId:
1067
    :vartype AuditEntryId: String
1068
    :ivar TimeoutHint:
1069
    :vartype TimeoutHint: UInt32
1070
    :ivar AdditionalHeader:
1071
    :vartype AdditionalHeader: ExtensionObject
1072
    '''
1073
1074
    ua_types = [
1075
        ('AuthenticationToken', 'NodeId'),
1076
        ('Timestamp', 'DateTime'),
1077
        ('RequestHandle', 'UInt32'),
1078
        ('ReturnDiagnostics', 'UInt32'),
1079
        ('AuditEntryId', 'String'),
1080
        ('TimeoutHint', 'UInt32'),
1081
        ('AdditionalHeader', 'ExtensionObject'),
1082
               ]
1083
1084
    def __init__(self):
1085
        self.AuthenticationToken = NodeId()
1086
        self.Timestamp = datetime.utcnow()
1087
        self.RequestHandle = 0
1088
        self.ReturnDiagnostics = 0
1089
        self.AuditEntryId = None
1090
        self.TimeoutHint = 0
1091
        self.AdditionalHeader = ExtensionObject()
1092
        self._freeze = True
1093
1094
    def __str__(self):
1095
        return 'RequestHeader(' + 'AuthenticationToken:' + str(self.AuthenticationToken) + ', ' + \
1096
               'Timestamp:' + str(self.Timestamp) + ', ' + \
1097
               'RequestHandle:' + str(self.RequestHandle) + ', ' + \
1098
               'ReturnDiagnostics:' + str(self.ReturnDiagnostics) + ', ' + \
1099
               'AuditEntryId:' + str(self.AuditEntryId) + ', ' + \
1100
               'TimeoutHint:' + str(self.TimeoutHint) + ', ' + \
1101
               'AdditionalHeader:' + str(self.AdditionalHeader) + ')'
1102
1103
    __repr__ = __str__
1104
1105
1106
class ResponseHeader(FrozenClass):
@@ 1106-1150 (lines=45) @@
1103
    __repr__ = __str__
1104
1105
1106
class ResponseHeader(FrozenClass):
1107
    '''
1108
    The header passed with every server response.
1109
1110
    :ivar Timestamp:
1111
    :vartype Timestamp: DateTime
1112
    :ivar RequestHandle:
1113
    :vartype RequestHandle: UInt32
1114
    :ivar ServiceResult:
1115
    :vartype ServiceResult: StatusCode
1116
    :ivar ServiceDiagnostics:
1117
    :vartype ServiceDiagnostics: DiagnosticInfo
1118
    :ivar StringTable:
1119
    :vartype StringTable: String
1120
    :ivar AdditionalHeader:
1121
    :vartype AdditionalHeader: ExtensionObject
1122
    '''
1123
1124
    ua_types = [
1125
        ('Timestamp', 'DateTime'),
1126
        ('RequestHandle', 'UInt32'),
1127
        ('ServiceResult', 'StatusCode'),
1128
        ('ServiceDiagnostics', 'DiagnosticInfo'),
1129
        ('StringTable', 'ListOfString'),
1130
        ('AdditionalHeader', 'ExtensionObject'),
1131
               ]
1132
1133
    def __init__(self):
1134
        self.Timestamp = datetime.utcnow()
1135
        self.RequestHandle = 0
1136
        self.ServiceResult = StatusCode()
1137
        self.ServiceDiagnostics = DiagnosticInfo()
1138
        self.StringTable = []
1139
        self.AdditionalHeader = ExtensionObject()
1140
        self._freeze = True
1141
1142
    def __str__(self):
1143
        return 'ResponseHeader(' + 'Timestamp:' + str(self.Timestamp) + ', ' + \
1144
               'RequestHandle:' + str(self.RequestHandle) + ', ' + \
1145
               'ServiceResult:' + str(self.ServiceResult) + ', ' + \
1146
               'ServiceDiagnostics:' + str(self.ServiceDiagnostics) + ', ' + \
1147
               'StringTable:' + str(self.StringTable) + ', ' + \
1148
               'AdditionalHeader:' + str(self.AdditionalHeader) + ')'
1149
1150
    __repr__ = __str__
1151
1152
1153
class ServiceFault(FrozenClass):