<s> """<STR_LIT>""" <EOL> from rpyc . lib . compat import execute , is_py3k <EOL> class Service ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" ] <EOL> ALIASES = ( ) <EOL> def __init__ ( self , conn ) : <EOL> self . _conn = conn <EOL> def on_connect ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def on_disconnect ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def _rpyc_getattr ( self , name ) : <EOL> if name . startswith ( "<STR_LIT>" ) : <EOL> name = name <EOL> else : <EOL> name = "<STR_LIT>" + name <EOL> return getattr ( self , name ) <EOL> def _rpyc_delattr ( self , name ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> def _rpyc_setattr ( self , name , value ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> @ classmethod <EOL> def get_service_aliases ( cls ) : <EOL> """<STR_LIT>""" <EOL> if cls . ALIASES : <EOL> return tuple ( str ( n ) . upper ( ) for n in cls . ALIASES ) <EOL> name = cls . __name__ . upper ( ) <EOL> if name . endswith ( "<STR_LIT>" ) : <EOL> name = name [ : - <NUM_LIT:7> ] <EOL> return ( name , ) <EOL> @ classmethod <EOL> def get_service_name ( cls ) : <EOL> """<STR_LIT>""" <EOL> return cls . get_service_aliases ( ) [ <NUM_LIT:0> ] <EOL> exposed_get_service_aliases = get_service_aliases <EOL> exposed_get_service_name = get_service_name <EOL> class VoidService ( Service ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = ( ) <EOL> class ModuleNamespace ( object ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> def __init__ ( self , getmodule ) : <EOL> self . __getmodule = getmodule <EOL> self . __cache = { } <EOL> def __getitem__ ( self , name ) : <EOL> if type ( name ) is tuple : <EOL> name = "<STR_LIT:.>" . join ( name ) <EOL> if name not in self . __cache : <EOL> self . __cache [ name ] = self . __getmodule ( name ) <EOL> return self . __cache [ name ] <EOL> def __getattr__ ( self , name ) : <EOL> return self [ name ] <EOL> class SlaveService ( Service ) : <EOL> """<STR_LIT>""" <EOL> __slots__ = [ "<STR_LIT>" ] <EOL> def on_connect ( self ) : <EOL> self . exposed_namespace = { } <EOL> self . _conn . _config . update ( dict ( <EOL> allow_all_attrs = True , <EOL> allow_pickle = True , <EOL> allow_getattr = True , <EOL> allow_setattr = True , <EOL> allow_delattr = True , <EOL> import_custom_exceptions = True , <EOL> instantiate_custom_exceptions = True , <EOL> instantiate_oldstyle_exceptions = True , <EOL> ) ) <EOL> self . _conn . modules = ModuleNamespace ( self . _conn . root . getmodule ) <EOL> self . _conn . eval = self . _conn . root . eval <EOL> self . _conn . execute = self . _conn . root . execute <EOL> self . _conn . namespace = self . _conn . root . namespace <EOL> if is_py3k : <EOL> self . _conn . builtin = self . _conn . modules . builtins <EOL> else : <EOL> self . _conn . builtin = self . _conn . modules . __builtin__ <EOL> self . _conn . builtins = self . _conn . builtin <EOL> def exposed_execute ( self , text ) : <EOL> """<STR_LIT>""" <EOL> execute ( text , self . exposed_namespace ) <EOL> def exposed_eval ( self , text ) : <EOL> """<STR_LIT>""" <EOL> return eval ( text , self . exposed_namespace ) <EOL> def exposed_getmodule ( self , name ) : <EOL> """<STR_LIT>""" <EOL> return __import__ ( name , None , None , "<STR_LIT:*>" ) <EOL> def exposed_getconn ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _conn </s>
