Code Duplication    Length = 44-46 lines in 6 locations

opcua/ua/uaprotocol_auto.py 6 locations

@@ 6605-6650 (lines=46) @@
6602
    __repr__ = __str__
6603
6604
6605
class BrowsePathResult(FrozenClass):
6606
    '''
6607
    The result of a translate opearation.
6608
6609
    :ivar StatusCode:
6610
    :vartype StatusCode: StatusCode
6611
    :ivar Targets:
6612
    :vartype Targets: BrowsePathTarget
6613
    '''
6614
6615
    ua_types = [
6616
6617
        ('StatusCode', 'StatusCode'),
6618
        ('Targets', 'ListOfBrowsePathTarget'),
6619
               ]
6620
6621
    def __init__(self):
6622
        self.StatusCode = StatusCode()
6623
        self.Targets = []
6624
        self._freeze = True
6625
6626
    def to_binary(self):
6627
        packet = []
6628
        packet.append(self.StatusCode.to_binary())
6629
        packet.append(uabin.Primitives.Int32.pack(len(self.Targets)))
6630
        for fieldname in self.Targets:
6631
            packet.append(fieldname.to_binary())
6632
        return b''.join(packet)
6633
6634
    @staticmethod
6635
    def from_binary(data):
6636
        obj = BrowsePathResult()
6637
        obj.StatusCode = StatusCode.from_binary(data)
6638
        length = uabin.Primitives.Int32.unpack(data)
6639
        array = []
6640
        if length != -1:
6641
            for _ in range(0, length):
6642
                array.append(BrowsePathTarget.from_binary(data))
6643
        obj.Targets = array
6644
        return obj
6645
6646
    def __str__(self):
6647
        return 'BrowsePathResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
6648
               'Targets:' + str(self.Targets) + ')'
6649
6650
    __repr__ = __str__
6651
6652
6653
class TranslateBrowsePathsToNodeIdsParameters(FrozenClass):
@@ 13757-13800 (lines=44) @@
13754
    __repr__ = __str__
13755
13756
13757
class NetworkGroupDataType(FrozenClass):
13758
    '''
13759
    :ivar ServerUri:
13760
    :vartype ServerUri: String
13761
    :ivar NetworkPaths:
13762
    :vartype NetworkPaths: EndpointUrlListDataType
13763
    '''
13764
13765
    ua_types = [
13766
13767
        ('ServerUri', 'String'),
13768
        ('NetworkPaths', 'ListOfEndpointUrlListDataType'),
13769
               ]
13770
13771
    def __init__(self):
13772
        self.ServerUri = None
13773
        self.NetworkPaths = []
13774
        self._freeze = True
13775
13776
    def to_binary(self):
13777
        packet = []
13778
        packet.append(uabin.Primitives.String.pack(self.ServerUri))
13779
        packet.append(uabin.Primitives.Int32.pack(len(self.NetworkPaths)))
13780
        for fieldname in self.NetworkPaths:
13781
            packet.append(fieldname.to_binary())
13782
        return b''.join(packet)
13783
13784
    @staticmethod
13785
    def from_binary(data):
13786
        obj = NetworkGroupDataType()
13787
        self.ServerUri = uabin.Primitives.String.unpack(data)
13788
        length = uabin.Primitives.Int32.unpack(data)
13789
        array = []
13790
        if length != -1:
13791
            for _ in range(0, length):
13792
                array.append(EndpointUrlListDataType.from_binary(data))
13793
        obj.NetworkPaths = array
13794
        return obj
13795
13796
    def __str__(self):
13797
        return 'NetworkGroupDataType(' + 'ServerUri:' + str(self.ServerUri) + ', ' + \
13798
               'NetworkPaths:' + str(self.NetworkPaths) + ')'
13799
13800
    __repr__ = __str__
13801
13802
13803
class SamplingIntervalDiagnosticsDataType(FrozenClass):
@@ 12728-12771 (lines=44) @@
12725
    __repr__ = __str__
12726
12727
12728
class EventFieldList(FrozenClass):
12729
    '''
12730
    :ivar ClientHandle:
12731
    :vartype ClientHandle: UInt32
12732
    :ivar EventFields:
12733
    :vartype EventFields: Variant
12734
    '''
12735
12736
    ua_types = [
12737
12738
        ('ClientHandle', 'UInt32'),
12739
        ('EventFields', 'ListOfVariant'),
12740
               ]
12741
12742
    def __init__(self):
12743
        self.ClientHandle = 0
12744
        self.EventFields = []
12745
        self._freeze = True
12746
12747
    def to_binary(self):
12748
        packet = []
12749
        packet.append(uabin.Primitives.UInt32.pack(self.ClientHandle))
12750
        packet.append(uabin.Primitives.Int32.pack(len(self.EventFields)))
12751
        for fieldname in self.EventFields:
12752
            packet.append(fieldname.to_binary())
12753
        return b''.join(packet)
12754
12755
    @staticmethod
12756
    def from_binary(data):
12757
        obj = EventFieldList()
12758
        self.ClientHandle = uabin.Primitives.UInt32.unpack(data)
12759
        length = uabin.Primitives.Int32.unpack(data)
12760
        array = []
12761
        if length != -1:
12762
            for _ in range(0, length):
12763
                array.append(Variant.from_binary(data))
12764
        obj.EventFields = array
12765
        return obj
12766
12767
    def __str__(self):
12768
        return 'EventFieldList(' + 'ClientHandle:' + str(self.ClientHandle) + ', ' + \
12769
               'EventFields:' + str(self.EventFields) + ')'
12770
12771
    __repr__ = __str__
12772
12773
12774
class HistoryEventFieldList(FrozenClass):
@@ 10457-10500 (lines=44) @@
10454
    __repr__ = __str__
10455
10456
10457
class EventFilter(FrozenClass):
10458
    '''
10459
    :ivar SelectClauses:
10460
    :vartype SelectClauses: SimpleAttributeOperand
10461
    :ivar WhereClause:
10462
    :vartype WhereClause: ContentFilter
10463
    '''
10464
10465
    ua_types = [
10466
10467
        ('SelectClauses', 'ListOfSimpleAttributeOperand'),
10468
        ('WhereClause', 'ContentFilter'),
10469
               ]
10470
10471
    def __init__(self):
10472
        self.SelectClauses = []
10473
        self.WhereClause = ContentFilter()
10474
        self._freeze = True
10475
10476
    def to_binary(self):
10477
        packet = []
10478
        packet.append(uabin.Primitives.Int32.pack(len(self.SelectClauses)))
10479
        for fieldname in self.SelectClauses:
10480
            packet.append(fieldname.to_binary())
10481
        packet.append(self.WhereClause.to_binary())
10482
        return b''.join(packet)
10483
10484
    @staticmethod
10485
    def from_binary(data):
10486
        obj = EventFilter()
10487
        length = uabin.Primitives.Int32.unpack(data)
10488
        array = []
10489
        if length != -1:
10490
            for _ in range(0, length):
10491
                array.append(SimpleAttributeOperand.from_binary(data))
10492
        obj.SelectClauses = array
10493
        obj.WhereClause = ContentFilter.from_binary(data)
10494
        return obj
10495
10496
    def __str__(self):
10497
        return 'EventFilter(' + 'SelectClauses:' + str(self.SelectClauses) + ', ' + \
10498
               'WhereClause:' + str(self.WhereClause) + ')'
10499
10500
    __repr__ = __str__
10501
10502
10503
class AggregateConfiguration(FrozenClass):
@@ 8349-8392 (lines=44) @@
8346
    __repr__ = __str__
8347
8348
8349
class QueryNextResult(FrozenClass):
8350
    '''
8351
    :ivar QueryDataSets:
8352
    :vartype QueryDataSets: QueryDataSet
8353
    :ivar RevisedContinuationPoint:
8354
    :vartype RevisedContinuationPoint: ByteString
8355
    '''
8356
8357
    ua_types = [
8358
8359
        ('QueryDataSets', 'ListOfQueryDataSet'),
8360
        ('RevisedContinuationPoint', 'ByteString'),
8361
               ]
8362
8363
    def __init__(self):
8364
        self.QueryDataSets = []
8365
        self.RevisedContinuationPoint = None
8366
        self._freeze = True
8367
8368
    def to_binary(self):
8369
        packet = []
8370
        packet.append(uabin.Primitives.Int32.pack(len(self.QueryDataSets)))
8371
        for fieldname in self.QueryDataSets:
8372
            packet.append(fieldname.to_binary())
8373
        packet.append(uabin.Primitives.ByteString.pack(self.RevisedContinuationPoint))
8374
        return b''.join(packet)
8375
8376
    @staticmethod
8377
    def from_binary(data):
8378
        obj = QueryNextResult()
8379
        length = uabin.Primitives.Int32.unpack(data)
8380
        array = []
8381
        if length != -1:
8382
            for _ in range(0, length):
8383
                array.append(QueryDataSet.from_binary(data))
8384
        obj.QueryDataSets = array
8385
        self.RevisedContinuationPoint = uabin.Primitives.ByteString.unpack(data)
8386
        return obj
8387
8388
    def __str__(self):
8389
        return 'QueryNextResult(' + 'QueryDataSets:' + str(self.QueryDataSets) + ', ' + \
8390
               'RevisedContinuationPoint:' + str(self.RevisedContinuationPoint) + ')'
8391
8392
    __repr__ = __str__
8393
8394
8395
class QueryNextResponse(FrozenClass):
@@ 1918-1961 (lines=44) @@
1915
    __repr__ = __str__
1916
1917
1918
class FindServersOnNetworkResult(FrozenClass):
1919
    '''
1920
    :ivar LastCounterResetTime:
1921
    :vartype LastCounterResetTime: DateTime
1922
    :ivar Servers:
1923
    :vartype Servers: ServerOnNetwork
1924
    '''
1925
1926
    ua_types = [
1927
1928
        ('LastCounterResetTime', 'DateTime'),
1929
        ('Servers', 'ListOfServerOnNetwork'),
1930
               ]
1931
1932
    def __init__(self):
1933
        self.LastCounterResetTime = datetime.utcnow()
1934
        self.Servers = []
1935
        self._freeze = True
1936
1937
    def to_binary(self):
1938
        packet = []
1939
        packet.append(uabin.Primitives.DateTime.pack(self.LastCounterResetTime))
1940
        packet.append(uabin.Primitives.Int32.pack(len(self.Servers)))
1941
        for fieldname in self.Servers:
1942
            packet.append(fieldname.to_binary())
1943
        return b''.join(packet)
1944
1945
    @staticmethod
1946
    def from_binary(data):
1947
        obj = FindServersOnNetworkResult()
1948
        self.LastCounterResetTime = uabin.Primitives.DateTime.unpack(data)
1949
        length = uabin.Primitives.Int32.unpack(data)
1950
        array = []
1951
        if length != -1:
1952
            for _ in range(0, length):
1953
                array.append(ServerOnNetwork.from_binary(data))
1954
        obj.Servers = array
1955
        return obj
1956
1957
    def __str__(self):
1958
        return 'FindServersOnNetworkResult(' + 'LastCounterResetTime:' + str(self.LastCounterResetTime) + ', ' + \
1959
               'Servers:' + str(self.Servers) + ')'
1960
1961
    __repr__ = __str__
1962
1963
1964
class FindServersOnNetworkResponse(FrozenClass):