我正在尝试使用sphinx autodoc为我的python项目生成文档。我似乎无法在此代码中保留docstring:
class aps_sio():
def __init__(self, server, port, mav, is_sim=False):
########## ASYNC IO INITIALIZATION ##########
# creates a new Async Socket IO Server
#sio = socketio.AsyncServer()
self.server = server
self.port = port
self.sio = socketio.AsyncServer(async_mode='aiohttp')
self.mav = mav
# Creates a new Aiohttp Web Application
self.app = web.Application()
# Binds our Socket.IO server to our Web App
# instance
self.sio.attach(self.app)
#############################################
# Note: these decorated functions are created at initialization time, thus are indented with __init__
@self.sio.on('connect')
async def on_connect(sid, environ):
"""Event handler for an socket.io connection. Logs the connection and adds the SID to the sid_list
:param sid: The unique socket ID of the requesting connection
:type sid: string
:param environ: Enviroment object for the requesting connection
:type environ: Enviroment Object
"""
self.sid_list.append(sid)
self.logger.log_aps('%s - Socket Connected, SID: %s IP: %s' % (time.time(), sid, environ['REMOTE_ADDR']))
if __name__ == "__main__":
sio1 = aps_sio("localhost",8005, mav1)
我不知道如何使用functool.wraps
之类的东西,比如这个问题中公认的答案:
Python decorator handling docstrings
我如何保存函数docstring
谢谢
目前没有回答
相关问题 更多 >
编程相关推荐