(fun)
return wrapper
Decorator which translates bare OSError exceptions into
    NoSuchProcess and AccessDenied.
Decorator which translates bare OSError exceptions into
    NoSuchProcess and AccessDenied.
Decorator which translates bare OSError exceptions into NoSuchProcess and AccessDenied .
def wrap_exceptions(fun):
    """Decorator which translates bare OSError exceptions into
    NoSuchProcess and AccessDenied.
    """
    @functools.wraps(fun)
    def wrapper(self, *args, **kwargs):
        try:
            return fun(self, *args, **kwargs)
        except OSError as err:
            # support for private module import
            if (NoSuchProcess is None or AccessDenied is None or
                    ZombieProcess is None):
                raise
            if err.errno == errno.ESRCH:
                if not pid_exists(self.pid):
                    raise NoSuchProcess(self.pid, self._name)
                else:
                    raise ZombieProcess(self.pid, self._name, self._ppid)
            if err.errno in (errno.EPERM, errno.EACCES):
                raise AccessDenied(self.pid, self._name)
            raise
    return wrapper
def wrap_exceptions ( fun ) : @ functools . wraps ( fun ) def wrapper ( self , * args , * * kwargs ) : try : return fun ( self , * args , * * kwargs ) except OSError as err : # support for private module import if ( NoSuchProcess is None or AccessDenied is None or ZombieProcess is None ) : raise if err . errno == errno . ESRCH : if not pid_exists ( self . pid ) : raise NoSuchProcess ( self . pid , self . _name ) else : raise ZombieProcess ( self . pid , self . _name , self . _ppid ) if err . errno in ( errno . EPERM , errno . EACCES ) : raise AccessDenied ( self . pid , self . _name ) raise return wrapper