def wrap_exceptions(fun):
 def wrapper(self, *args, **kwargs):
  try:
   return fun(self, *args, **kwargs)
  except EnvironmentError as err:
   if (self.pid == 0):
    if (0 in pids()):
     raise AccessDenied(self.pid, self._name)
    else:
     raise
   if (err.errno in (errno.ENOENT, 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 ) : def wrapper ( self , * args , ** kwargs ) : try : return fun ( self , * args , ** kwargs ) except EnvironmentError as err : if ( self . pid == 0 ) : if ( 0 in pids ( ) ) : raise AccessDenied ( self . pid , self . _name ) else : raise if ( err . errno in ( errno . ENOENT , 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
call callable into a try/except clause and translate enoent .