Code Duplication    Length = 45-50 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 1018-1067 (lines=50) @@
1015
    __repr__ = __str__
1016
1017
1018
class RequestHeader(FrozenClass):
1019
    '''
1020
    The header passed with every server request.
1021
1022
    :ivar AuthenticationToken:
1023
    :vartype AuthenticationToken: NodeId
1024
    :ivar Timestamp:
1025
    :vartype Timestamp: DateTime
1026
    :ivar RequestHandle:
1027
    :vartype RequestHandle: UInt32
1028
    :ivar ReturnDiagnostics:
1029
    :vartype ReturnDiagnostics: UInt32
1030
    :ivar AuditEntryId:
1031
    :vartype AuditEntryId: String
1032
    :ivar TimeoutHint:
1033
    :vartype TimeoutHint: UInt32
1034
    :ivar AdditionalHeader:
1035
    :vartype AdditionalHeader: ExtensionObject
1036
    '''
1037
1038
    ua_types = [
1039
        ('AuthenticationToken', 'NodeId'),
1040
        ('Timestamp', 'DateTime'),
1041
        ('RequestHandle', 'UInt32'),
1042
        ('ReturnDiagnostics', 'UInt32'),
1043
        ('AuditEntryId', 'String'),
1044
        ('TimeoutHint', 'UInt32'),
1045
        ('AdditionalHeader', 'ExtensionObject'),
1046
               ]
1047
1048
    def __init__(self):
1049
        self.AuthenticationToken = NodeId()
1050
        self.Timestamp = datetime.utcnow()
1051
        self.RequestHandle = 0
1052
        self.ReturnDiagnostics = 0
1053
        self.AuditEntryId = None
1054
        self.TimeoutHint = 0
1055
        self.AdditionalHeader = ExtensionObject()
1056
        self._freeze = True
1057
1058
    def __str__(self):
1059
        return 'RequestHeader(' + 'AuthenticationToken:' + str(self.AuthenticationToken) + ', ' + \
1060
               'Timestamp:' + str(self.Timestamp) + ', ' + \
1061
               'RequestHandle:' + str(self.RequestHandle) + ', ' + \
1062
               'ReturnDiagnostics:' + str(self.ReturnDiagnostics) + ', ' + \
1063
               'AuditEntryId:' + str(self.AuditEntryId) + ', ' + \
1064
               'TimeoutHint:' + str(self.TimeoutHint) + ', ' + \
1065
               'AdditionalHeader:' + str(self.AdditionalHeader) + ')'
1066
1067
    __repr__ = __str__
1068
1069
1070
class ResponseHeader(FrozenClass):
@@ 1070-1114 (lines=45) @@
1067
    __repr__ = __str__
1068
1069
1070
class ResponseHeader(FrozenClass):
1071
    '''
1072
    The header passed with every server response.
1073
1074
    :ivar Timestamp:
1075
    :vartype Timestamp: DateTime
1076
    :ivar RequestHandle:
1077
    :vartype RequestHandle: UInt32
1078
    :ivar ServiceResult:
1079
    :vartype ServiceResult: StatusCode
1080
    :ivar ServiceDiagnostics:
1081
    :vartype ServiceDiagnostics: DiagnosticInfo
1082
    :ivar StringTable:
1083
    :vartype StringTable: String
1084
    :ivar AdditionalHeader:
1085
    :vartype AdditionalHeader: ExtensionObject
1086
    '''
1087
1088
    ua_types = [
1089
        ('Timestamp', 'DateTime'),
1090
        ('RequestHandle', 'UInt32'),
1091
        ('ServiceResult', 'StatusCode'),
1092
        ('ServiceDiagnostics', 'DiagnosticInfo'),
1093
        ('StringTable', 'ListOfString'),
1094
        ('AdditionalHeader', 'ExtensionObject'),
1095
               ]
1096
1097
    def __init__(self):
1098
        self.Timestamp = datetime.utcnow()
1099
        self.RequestHandle = 0
1100
        self.ServiceResult = StatusCode()
1101
        self.ServiceDiagnostics = DiagnosticInfo()
1102
        self.StringTable = []
1103
        self.AdditionalHeader = ExtensionObject()
1104
        self._freeze = True
1105
1106
    def __str__(self):
1107
        return 'ResponseHeader(' + 'Timestamp:' + str(self.Timestamp) + ', ' + \
1108
               'RequestHandle:' + str(self.RequestHandle) + ', ' + \
1109
               'ServiceResult:' + str(self.ServiceResult) + ', ' + \
1110
               'ServiceDiagnostics:' + str(self.ServiceDiagnostics) + ', ' + \
1111
               'StringTable:' + str(self.StringTable) + ', ' + \
1112
               'AdditionalHeader:' + str(self.AdditionalHeader) + ')'
1113
1114
    __repr__ = __str__
1115
1116
1117
class ServiceFault(FrozenClass):