/usr/share/pyshared/bjsonrpc/proxies.py is in python-bjsonrpc 0.2.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | """
bjson/proxies.py
Copyright (c) 2010 David Martinez Marti
All rights reserved.
Licensed under 3-clause BSD License.
See LICENSE.txt for the full license text.
"""
# import weakref
class Proxy(object):
"""
Object that forwards calls to the remote.
Parameters:
**conn**
Connection object to forward calls.
**sync_type**
synchronization type. 0-synchronous. 1-asynchronous. 2-notification.
**obj** = None
optional. Object name to call their functions, (used to proxy functions of *RemoteObject*
"""
def __init__(self, conn, sync_type, obj = None):
self._conn = conn
self._obj = obj
self.sync_type = sync_type
def __getattr__(self, name):
if self._obj:
name = "%s.%s" % (self._obj, name)
def function(*args, **kwargs):
"""
Decorator-like function that forwards all calls to proxy
method of connection.
"""
return self._conn.proxy(self.sync_type, name, args, kwargs)
#print name
function.__name__ = str(name)
function._conn = self._conn
# function.sync_type = self.sync_type
return function
|