| 548 | |
| 549 | |
| 550 | class RPCProxy: |
| 551 | |
| 552 | __methods = None |
| 553 | __attributes = None |
| 554 | |
| 555 | def __init__(self, sockio, oid): |
| 556 | self.sockio = sockio |
| 557 | self.oid = oid |
| 558 | |
| 559 | def __getattr__(self, name): |
| 560 | if self.__methods is None: |
| 561 | self.__getmethods() |
| 562 | if self.__methods.get(name): |
| 563 | return MethodProxy(self.sockio, self.oid, name) |
| 564 | if self.__attributes is None: |
| 565 | self.__getattributes() |
| 566 | if name in self.__attributes: |
| 567 | value = self.sockio.remotecall(self.oid, '__getattribute__', |
| 568 | (name,), {}) |
| 569 | return value |
| 570 | else: |
| 571 | raise AttributeError(name) |
| 572 | |
| 573 | def __getattributes(self): |
| 574 | self.__attributes = self.sockio.remotecall(self.oid, |
| 575 | "__attributes__", (), {}) |
| 576 | |
| 577 | def __getmethods(self): |
| 578 | self.__methods = self.sockio.remotecall(self.oid, |
| 579 | "__methods__", (), {}) |
| 580 | |
| 581 | def _getmethods(obj, methods): |
| 582 | # Helper to get a list of methods from an object |
no outgoing calls
no test coverage detected
searching dependent graphs…