Code Duplication    Length = 47-49 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 3101-3149 (lines=49) @@
3098
    __repr__ = __str__
3099
3100
3101
class UserNameIdentityToken(FrozenClass):
3102
    '''
3103
    A token representing a user identified by a user name and password.
3104
3105
    :ivar PolicyId:
3106
    :vartype PolicyId: String
3107
    :ivar UserName:
3108
    :vartype UserName: String
3109
    :ivar Password:
3110
    :vartype Password: ByteString
3111
    :ivar EncryptionAlgorithm:
3112
    :vartype EncryptionAlgorithm: String
3113
    '''
3114
    def __init__(self, binary=None):
3115
        if binary is not None:
3116
            self._binary_init(binary)
3117
            self._freeze = True
3118
            return
3119
        self.PolicyId = ''
3120
        self.UserName = ''
3121
        self.Password = b''
3122
        self.EncryptionAlgorithm = ''
3123
        self._freeze = True
3124
3125
    def to_binary(self):
3126
        packet = []
3127
        packet.append(pack_string(self.PolicyId))
3128
        packet.append(pack_string(self.UserName))
3129
        packet.append(pack_bytes(self.Password))
3130
        packet.append(pack_string(self.EncryptionAlgorithm))
3131
        return b''.join(packet)
3132
3133
    @staticmethod
3134
    def from_binary(data):
3135
        return UserNameIdentityToken(data)
3136
3137
    def _binary_init(self, data):
3138
        self.PolicyId = unpack_string(data)
3139
        self.UserName = unpack_string(data)
3140
        self.Password = unpack_bytes(data)
3141
        self.EncryptionAlgorithm = unpack_string(data)
3142
3143
    def __str__(self):
3144
        return 'UserNameIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
3145
               'UserName:' + str(self.UserName) + ', ' + \
3146
               'Password:' + str(self.Password) + ', ' + \
3147
               'EncryptionAlgorithm:' + str(self.EncryptionAlgorithm) + ')'
3148
3149
    __repr__ = __str__
3150
3151
3152
class X509IdentityToken(FrozenClass):
@@ 7903-7949 (lines=47) @@
7900
    __repr__ = __str__
7901
7902
7903
class HistoryReadValueId(FrozenClass):
7904
    '''
7905
    :ivar NodeId:
7906
    :vartype NodeId: NodeId
7907
    :ivar IndexRange:
7908
    :vartype IndexRange: String
7909
    :ivar DataEncoding:
7910
    :vartype DataEncoding: QualifiedName
7911
    :ivar ContinuationPoint:
7912
    :vartype ContinuationPoint: ByteString
7913
    '''
7914
    def __init__(self, binary=None):
7915
        if binary is not None:
7916
            self._binary_init(binary)
7917
            self._freeze = True
7918
            return
7919
        self.NodeId = NodeId()
7920
        self.IndexRange = ''
7921
        self.DataEncoding = QualifiedName()
7922
        self.ContinuationPoint = b''
7923
        self._freeze = True
7924
7925
    def to_binary(self):
7926
        packet = []
7927
        packet.append(self.NodeId.to_binary())
7928
        packet.append(pack_string(self.IndexRange))
7929
        packet.append(self.DataEncoding.to_binary())
7930
        packet.append(pack_bytes(self.ContinuationPoint))
7931
        return b''.join(packet)
7932
7933
    @staticmethod
7934
    def from_binary(data):
7935
        return HistoryReadValueId(data)
7936
7937
    def _binary_init(self, data):
7938
        self.NodeId = NodeId.from_binary(data)
7939
        self.IndexRange = unpack_string(data)
7940
        self.DataEncoding = QualifiedName.from_binary(data)
7941
        self.ContinuationPoint = unpack_bytes(data)
7942
7943
    def __str__(self):
7944
        return 'HistoryReadValueId(' + 'NodeId:' + str(self.NodeId) + ', ' + \
7945
               'IndexRange:' + str(self.IndexRange) + ', ' + \
7946
               'DataEncoding:' + str(self.DataEncoding) + ', ' + \
7947
               'ContinuationPoint:' + str(self.ContinuationPoint) + ')'
7948
7949
    __repr__ = __str__
7950
7951
7952
class HistoryReadResult(FrozenClass):