Skip to content

Commit 817db37

Browse files
author
Codemation
committed
Added docstrings from origin functions to proxy side functions
1 parent 1c0d6f8 commit 817db37

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

easyrpc/proxy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def create(cls,
155155

156156
def run_cron(self, action, interval):
157157
async def cron():
158-
self.log.warning(f"creating cron or {action.__name__} - interval {interval}")
158+
self.log.debug(f"creating cron or {action.__name__} - interval {interval}")
159159
tasks = []
160160
while True:
161161
try:
@@ -466,7 +466,7 @@ async def ws_client():
466466
ws_sender = self.get_ws_sender(ws)
467467
ws_receiver = self.get_ws_receiver(ws)
468468

469-
self.log.warning(
469+
self.log.debug(
470470
f"started connection to server {self.origin_host}:{self.origin_port}"
471471
)
472472
async def keep_alive():

easyrpc/register.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ async def __proxy__(*args, **kwargs):
4646
return await result
4747
return result
4848

49-
#__proxy__.__name__ = f"{config['name']}_proxy"
5049
__proxy__.__name__ = f"{config['name']}"
50+
__proxy__.__doc__ = config.get('doc', '')
5151
nf = create_function(
5252
create_signature_from_dict(
5353
config['sig']
@@ -126,6 +126,7 @@ def register(f, namespace):
126126
obj.namespaces[namespace][f.__name__]['config'] = {
127127
'sig': get_signature_as_dict(f),
128128
'name': f.__name__,
129+
'doc': f.__doc__,
129130
'is_async': iscoroutinefunction(f)
130131
}
131132
obj.namespaces[namespace][f.__name__]['method'] = f

easyrpc/server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ async def connect(self, websocket: WebSocket):
2323
return await websocket.accept()
2424

2525
def store_connect(self, endpoint_id, websocket: WebSocket):
26-
self.log.warning(f"created websocket connection with endpoint {endpoint_id}")
26+
self.log.debug(f"created websocket connection with endpoint {endpoint_id}")
2727
self.active_connections[endpoint_id] = websocket
2828

2929
def disconnect(self, endpoint_id: str):
30-
self.log.warning(f"deleted websocket connection with endpoint {endpoint_id}")
30+
self.log.debug(f"deleted websocket connection with endpoint {endpoint_id}")
3131
del self.active_connections[endpoint_id]
3232
async def broadcast(self, message: str):
3333
for connection in self.active_connections:
@@ -422,7 +422,7 @@ async def ws_receiver():
422422
await finished.get()
423423

424424
# child connection closed
425-
self.log.warning(f"client websocket connection with id {decoded_id} finished")
425+
self.log.debug(f"client websocket connection with id {decoded_id} finished")
426426

427427
# check if child is server or proxy
428428
if setup['type'] == 'SERVER':

0 commit comments

Comments
 (0)