Code Duplication    Length = 10-12 lines in 2 locations

opcua/ua/uatypes.py 1 location

@@ 575-586 (lines=12) @@
572
    Any UA object packed as an ExtensionObject
573
574
    :ivar TypeId:
575
    :vartype TypeId: NodeId
576
    :ivar Body:
577
    :vartype Body: bytes
578
    """
579
    ua_switches = {
580
        'Body': ('Encoding', 0),
581
            }
582
583
    ua_types = (
584
        ("TypeId", "NodeId"),
585
        ("Encoding", "Byte"),
586
        ("Body", "ByteString"),
587
    )
588
589
    def __init__(self):

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) + ', ' + \