Code Duplication    Length = 45-50 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

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