(fun)
return wrapper
Decorator which translates bare OSError and WindowsError
    exceptions into NoSuchProcess and AccessDenied.
Decorator which translates bare OSError and WindowsError
    exceptions into NoSuchProcess and AccessDenied.
Decorator which translates bare OSError and WindowsError exceptions into NoSuchProcess and AccessDenied .
def wrap_exceptions(fun):
    """Decorator which translates bare OSError and WindowsError
    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:
                raise
            if err.errno in ACCESS_DENIED_SET:
                raise AccessDenied(self.pid, self._name)
            if err.errno == errno.ESRCH:
                raise NoSuchProcess(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 : raise if err . errno in ACCESS_DENIED_SET : raise AccessDenied ( self . pid , self . _name ) if err . errno == errno . ESRCH : raise NoSuchProcess ( self . pid , self . _name ) raise return wrapper