I'm trying to use sphinx autodoc to generate documentation for my python project. I can't seem to be able to preserve the docstring in this code:
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)
I'm at a loss on how to use something like functool.wraps
like the accepted answer in this question:
Python decorator handling docstrings
How would I go about preserving the function docstring?
Thanks