(obj, attrs, wattrs = None)
return Restricted()
Returns a 'restricted' version of an object, i.e., allowing access only to a subset of its
    attributes. This is useful when returning a "broad" or "dangerous" object, where you don't 
    want the other party to have access to all of its attributes.
    
    .. versionadded:: 3.2
    
    :param obj: any object
    :param attrs: the set of attributes exposed for reading (``getattr``) or writing (``setattr``).
                  The same set will serve both for reading and writing, unless wattrs is explicitly
                  given.
    :param wattrs: the set of attributes exposed for writing (``setattr``). If ``None``, 
                   ``wattrs`` will default to ``attrs``. To disable setting attributes completely,
                   set to an empty tuple ``()``.
    :returns: a restricted view of the object
    
    Example::
    
        class MyService(rpyc.Service):
            def exposed_open(self, filename):
                f = open(filename, "r")
                return rpyc.restricted(f, {"read", "close"})   # disallow access to `seek` or `write`
Returns a 'restricted' version of an object, i.e., allowing access only to a subset of its
    attributes. This is useful when returning a "broad" or "dangerous" object, where you don't 
    want the other party to have access to all of its attributes.
    
    .. versionadded:: 3.2
    
    :param obj: any object
    :param attrs: the set of attributes exposed for reading (``getattr``) or writing (``setattr``).
                  The same set will serve both for reading and writing, unless wattrs is explicitly
                  given.
    :param wattrs: the set of attributes exposed for writing (``setattr``). If ``None``, 
                   ``wattrs`` will default to ``attrs``. To disable setting attributes completely,
                   set to an empty tuple ``()``.
    :returns: a restricted view of the object
    
    Example::
    
        class MyService(rpyc.Service):
            def exposed_open(self, filename):
                f = open(filename, "r")
                return rpyc.restricted(f, {"read", "close"})   # disallow access to `seek` or `write`
Returns a restricted version of an object i . e . allowing access only to a subset of its attributes . This is useful when returning a broad or dangerous object where you don t want the other party to have access to all of its attributes . .. versionadded :: 3 . 2 : param obj : any object : param attrs : the set of attributes exposed for reading ( getattr ) or writing ( setattr ) . The same set will serve both for reading and writing unless wattrs is explicitly given . : param wattrs : the set of attributes exposed for writing ( setattr ) . If None wattrs will default to attrs . To disable setting attributes completely set to an empty tuple () . : returns : a restricted view of the object Example :: class MyService ( rpyc . Service ) : def exposed_open ( self filename ) : f = open ( filename r ) return rpyc . restricted ( f { read close } ) # disallow access to seek or write
def restricted(obj, attrs, wattrs = None):
    """Returns a 'restricted' version of an object, i.e., allowing access only to a subset of its
    attributes. This is useful when returning a "broad" or "dangerous" object, where you don't 
    want the other party to have access to all of its attributes.
    
    .. versionadded:: 3.2
    
    :param obj: any object
    :param attrs: the set of attributes exposed for reading (``getattr``) or writing (``setattr``).
                  The same set will serve both for reading and writing, unless wattrs is explicitly
                  given.
    :param wattrs: the set of attributes exposed for writing (``setattr``). If ``None``, 
                   ``wattrs`` will default to ``attrs``. To disable setting attributes completely,
                   set to an empty tuple ``()``.
    :returns: a restricted view of the object
    
    Example::
    
        class MyService(rpyc.Service):
            def exposed_open(self, filename):
                f = open(filename, "r")
                return rpyc.restricted(f, {"read", "close"})   # disallow access to `seek` or `write`
    
    """
    if wattrs is None:
        wattrs = attrs
    class Restricted(object):
        def _rpyc_getattr(self, name):
            if name not in attrs:
                raise AttributeError(name)
            return getattr(obj, name)
        __getattr__ = _rpyc_getattr
        def _rpyc_setattr(self, name, value):
            if name not in wattrs:
                raise AttributeError(name)
            setattr(obj, name, value)
        __setattr__ = _rpyc_setattr
    return Restricted()
def restricted ( obj , attrs , wattrs = None ) : if wattrs is None : wattrs = attrs class Restricted ( object ) : def _rpyc_getattr ( self , name ) : if name not in attrs : raise AttributeError ( name ) return getattr ( obj , name ) __getattr__ = _rpyc_getattr def _rpyc_setattr ( self , name , value ) : if name not in wattrs : raise AttributeError ( name ) setattr ( obj , name , value ) __setattr__ = _rpyc_setattr return Restricted ( )