Code Duplication    Length = 27-35 lines in 2 locations

opcua/ua/uaprotocol_auto.py 1 location

@@ 11854-11888 (lines=35) @@
11851
    __repr__ = __str__
11852
11853
11854
class SubscriptionAcknowledgement(FrozenClass):
11855
    '''
11856
    :ivar SubscriptionId:
11857
    :vartype SubscriptionId: UInt32
11858
    :ivar SequenceNumber:
11859
    :vartype SequenceNumber: UInt32
11860
    '''
11861
    def __init__(self, binary=None):
11862
        if binary is not None:
11863
            self._binary_init(binary)
11864
            self._freeze = True
11865
            return
11866
        self.SubscriptionId = 0
11867
        self.SequenceNumber = 0
11868
        self._freeze = True
11869
11870
    def to_binary(self):
11871
        packet = []
11872
        packet.append(uatype_UInt32.pack(self.SubscriptionId))
11873
        packet.append(uatype_UInt32.pack(self.SequenceNumber))
11874
        return b''.join(packet)
11875
11876
    @staticmethod
11877
    def from_binary(data):
11878
        return SubscriptionAcknowledgement(data)
11879
11880
    def _binary_init(self, data):
11881
        self.SubscriptionId = uatype_UInt32.unpack(data.read(4))[0]
11882
        self.SequenceNumber = uatype_UInt32.unpack(data.read(4))[0]
11883
11884
    def __str__(self):
11885
        return 'SubscriptionAcknowledgement(' + 'SubscriptionId:' + str(self.SubscriptionId) + ', ' + \
11886
               'SequenceNumber:' + str(self.SequenceNumber) + ')'
11887
11888
    __repr__ = __str__
11889
11890
11891
class PublishParameters(FrozenClass):

opcua/ua/uaprotocol_hand.py 1 location

@@ 214-240 (lines=27) @@
211
    __repr__ = __str__
212
213
214
class SequenceHeader(uatypes.FrozenClass):
215
216
    def __init__(self):
217
        self.SequenceNumber = None
218
        self.RequestId = None
219
        self._freeze = True
220
221
    @staticmethod
222
    def from_binary(data):
223
        obj = SequenceHeader()
224
        obj.SequenceNumber = uatype_UInt32.unpack(data.read(4))[0]
225
        obj.RequestId = uatype_UInt32.unpack(data.read(4))[0]
226
        return obj
227
228
    def to_binary(self):
229
        b = []
230
        b.append(uatype_UInt32.pack(self.SequenceNumber))
231
        b.append(uatype_UInt32.pack(self.RequestId))
232
        return b"".join(b)
233
234
    @staticmethod
235
    def max_size():
236
        return struct.calcsize("<II")
237
238
    def __str__(self):
239
        return "{}(SequenceNumber:{}, RequestId:{} )".format(self.__class__.__name__, self.SequenceNumber, self.RequestId)
240
    __repr__ = __str__
241
242
243
class CryptographyNone: