Code Duplication    Length = 10-12 lines in 2 locations

opcua/ua/uatypes.py 1 location

@@ 575-586 (lines=12) @@
572
    :ivar Body:
573
    :vartype Body: bytes
574
    """
575
576
    ua_types = {
577
        "TypeId": "NodeId",
578
        "Encoding": "Byte",
579
        "Body": "ByteString"
580
    }
581
582
    def __init__(self):
583
        self.TypeId = NodeId()
584
        self.Encoding = 0
585
        self.Body = b''
586
        self._freeze = True
587
588
    def to_binary(self):
589
        packet = []

opcua/ua/uaprotocol_auto.py 1 location

@@ 929-938 (lines=10) @@
926
    @staticmethod
927
    def from_binary(data):
928
        obj = LocalizedText()
929
        self.Encoding = uabin.Primitives.UInt8.unpack(data)
930
        if obj.Encoding & (1 << 0):
931
            self.Locale = uabin.Primitives.CharArray.unpack(data)
932
        else:
933
            obj.Locale = None
934
        if obj.Encoding & (1 << 1):
935
            self.Text = uabin.Primitives.CharArray.unpack(data)
936
        else:
937
            obj.Text = None
938
            return obj
939
940
    def __str__(self):
941
        return 'LocalizedText(' + 'Encoding:' + str(self.Encoding) + ', ' + \