Code Duplication    Length = 40-41 lines in 2 locations

crabpy/gateway/crab.py 1 location

@@ 1541-1581 (lines=41) @@
1538
        return postadres
1539
1540
1541
class GatewayObject(object):
1542
    '''
1543
    Abstract class for objects that are able to use a
1544
    :class:`crabpy.Gateway.CrabGateway` to find further information.
1545
    '''
1546
1547
    gateway = None
1548
    '''
1549
    The :class:`crabpy.gateway.crab.CrabGateway` to use when making
1550
    further calls to the CRAB service.
1551
    '''
1552
1553
    def __init__(self, **kwargs):
1554
        if 'gateway' in kwargs:
1555
            self.set_gateway(kwargs['gateway'])
1556
1557
    def set_gateway(self, gateway):
1558
        '''
1559
        :param crabpy.gateway.crab.CrabGateway gateway: Gateway to use.
1560
        '''
1561
        self.gateway = gateway
1562
1563
    def clear_gateway(self):
1564
        '''
1565
        Clear the currently set CrabGateway.
1566
        '''
1567
        self.gateway = None
1568
1569
    def check_gateway(self):
1570
        '''
1571
        Check to see if a gateway was set on this object.
1572
        '''
1573
        if not self.gateway:
1574
            raise RuntimeError("There's no Gateway I can use")
1575
1576
    if six.PY2:
1577
        def __str__(self):
1578
            return self.__unicode__().encode('utf-8')
1579
    else:
1580
        def __str__(self):
1581
            return self.__unicode__()
1582
1583
1584
def check_lazy_load_gewest(f):

crabpy/gateway/capakey.py 1 location

@@ 908-947 (lines=40) @@
905
        )
906
907
908
class GatewayObject(object):
909
    '''
910
    Abstract class for all objects being returned from the Gateway.
911
    '''
912
913
    gateway = None
914
    '''
915
    The :class:`crabpy.gateway.capakey.CapakeyGateway` to use when making
916
    further calls to the Capakey service.
917
    '''
918
919
    def __init__(self, **kwargs):
920
        if 'gateway' in kwargs:
921
            self.set_gateway(kwargs['gateway'])
922
923
    def set_gateway(self, gateway):
924
        '''
925
        :param crabpy.gateway.capakey.CapakeyGateway gateway: Gateway to use.
926
        '''
927
        self.gateway = gateway
928
929
    def clear_gateway(self):
930
        '''
931
        Clear the currently set CapakeyGateway.
932
        '''
933
        self.gateway = None
934
935
    def check_gateway(self):
936
        '''
937
        Check to see if a gateway was set on this object.
938
        '''
939
        if not self.gateway:
940
            raise RuntimeError("There's no Gateway I can use")
941
942
    if six.PY2:
943
        def __str__(self):
944
            return self.__unicode__().encode('utf-8')
945
    else:
946
        def __str__(self):
947
            return self.__unicode__()
948
949
950
def check_lazy_load_gemeente(f):