Code Duplication    Length = 45-45 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 1852-1896 (lines=45) @@
1849
1850
    __repr__ = __str__
1851
1852
1853
class GetEndpointsParameters(FrozenClass):
1854
    '''
1855
    :ivar EndpointUrl:
1856
    :vartype EndpointUrl: String
1857
    :ivar LocaleIds:
1858
    :vartype LocaleIds: String
1859
    :ivar ProfileUris:
1860
    :vartype ProfileUris: String
1861
    '''
1862
    def __init__(self, binary=None):
1863
        if binary is not None:
1864
            self._binary_init(binary)
1865
            self._freeze = True
1866
            return
1867
        self.EndpointUrl = None
1868
        self.LocaleIds = []
1869
        self.ProfileUris = []
1870
        self._freeze = True
1871
1872
    def to_binary(self):
1873
        packet = []
1874
        packet.append(pack_string(self.EndpointUrl))
1875
        packet.append(uatype_Int32.pack(len(self.LocaleIds)))
1876
        for fieldname in self.LocaleIds:
1877
            packet.append(pack_string(fieldname))
1878
        packet.append(uatype_Int32.pack(len(self.ProfileUris)))
1879
        for fieldname in self.ProfileUris:
1880
            packet.append(pack_string(fieldname))
1881
        return b''.join(packet)
1882
1883
    @staticmethod
1884
    def from_binary(data):
1885
        return GetEndpointsParameters(data)
1886
1887
    def _binary_init(self, data):
1888
        self.EndpointUrl = unpack_string(data)
1889
        self.LocaleIds = unpack_uatype_array('String', data)
1890
        self.ProfileUris = unpack_uatype_array('String', data)
1891
1892
    def __str__(self):
1893
        return 'GetEndpointsParameters(' + 'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
1894
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
1895
               'ProfileUris:' + str(self.ProfileUris) + ')'
1896
1897
    __repr__ = __str__
1898
1899
@@ 1343-1387 (lines=45) @@
1340
1341
    __repr__ = __str__
1342
1343
1344
class FindServersParameters(FrozenClass):
1345
    '''
1346
    :ivar EndpointUrl:
1347
    :vartype EndpointUrl: String
1348
    :ivar LocaleIds:
1349
    :vartype LocaleIds: String
1350
    :ivar ServerUris:
1351
    :vartype ServerUris: String
1352
    '''
1353
    def __init__(self, binary=None):
1354
        if binary is not None:
1355
            self._binary_init(binary)
1356
            self._freeze = True
1357
            return
1358
        self.EndpointUrl = None
1359
        self.LocaleIds = []
1360
        self.ServerUris = []
1361
        self._freeze = True
1362
1363
    def to_binary(self):
1364
        packet = []
1365
        packet.append(pack_string(self.EndpointUrl))
1366
        packet.append(uatype_Int32.pack(len(self.LocaleIds)))
1367
        for fieldname in self.LocaleIds:
1368
            packet.append(pack_string(fieldname))
1369
        packet.append(uatype_Int32.pack(len(self.ServerUris)))
1370
        for fieldname in self.ServerUris:
1371
            packet.append(pack_string(fieldname))
1372
        return b''.join(packet)
1373
1374
    @staticmethod
1375
    def from_binary(data):
1376
        return FindServersParameters(data)
1377
1378
    def _binary_init(self, data):
1379
        self.EndpointUrl = unpack_string(data)
1380
        self.LocaleIds = unpack_uatype_array('String', data)
1381
        self.ServerUris = unpack_uatype_array('String', data)
1382
1383
    def __str__(self):
1384
        return 'FindServersParameters(' + 'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
1385
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
1386
               'ServerUris:' + str(self.ServerUris) + ')'
1387
1388
    __repr__ = __str__
1389
1390