pycomm3/clx.py
def with_forward_open(func):
    """Decorator to ensure a forward open request has been completed with the plc"""

    @wraps(func)
    def wrapped(self, *args, **kwargs):
        opened = False
        if not self._forward_open():
            if self.attribs['extended forward open']:
                logger = logging.getLogger('pycomm3.clx.LogixDriver')
                logger.info('Extended Forward Open failed, attempting standard Forward Open.')
                self.attribs['extended forward open'] = False
                if self._forward_open():
                    opened = True
        else:
            opened = True

        if not opened:
            msg = f'Target did not connected. {func.__name__} will not be executed.'
            raise DataError(msg)
        return func(self, *args, **kwargs)

    return wrapped
Decorator to ensure a forward open request has been completed with the plc
Decorator to ensure a forward open request has been completed with the plc
Decorator to ensure a forward open request has been completed with the plc
def with_forward_open(func):
    @wraps(func)
    def wrapped(self, *args, **kwargs):
        opened = False
        if not self._forward_open():
            if self.attribs['extended forward open']:
                logger = logging.getLogger('pycomm3.clx.LogixDriver')
                logger.info('Extended Forward Open failed, attempting standard Forward Open.')
                self.attribs['extended forward open'] = False
                if self._forward_open():
                    opened = True
        else:
            opened = True
        if not opened:
            msg = f'Target did not connected. {func.__name__} will not be executed.'
            raise DataError(msg)
        return func(self, *args, **kwargs)
    return wrapped
def with_forward_open ( func ) : @ wraps ( func ) def wrapped ( self , * args , ** kwargs ) : opened = False if not self . _forward_open ( ) : if self . attribs [ 'extended forward open' ] : logger = logging . getLogger ( 'pycomm3.clx.LogixDriver' ) logger . info ( 'Extended Forward Open failed, attempting standard Forward Open.' ) self . attribs [ 'extended forward open' ] = False if self . _forward_open ( ) : opened = True else : opened = True if not opened : msg = f'Target did not connected. {func.__name__} will not be executed.' raise DataError ( msg ) return func ( self , * args , ** kwargs ) return wrapped
Decorator to ensure a forward open request has been completed with the plc
Decorator to ensure a forward open request has been completed with the plc
"""Decorator to ensure a forward open request has been completed with the plc"""
func