fix doc (stringio - > io)

+ bug in secop.lib.classdoc

Change-Id: Ic1f6f2896466ce53dd176a338088b7ee6b8047af
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/27428
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
zolliker 2022-01-12 16:23:21 +01:00
parent 2ef0da68e8
commit eb2e8f5f74
3 changed files with 19 additions and 12 deletions

View File

@ -49,11 +49,15 @@ Communication
:show-inheritance: :show-inheritance:
:members: communicate :members: communicate
.. autoclass:: secop.stringio.StringIO .. autoclass:: secop.io.StringIO
:show-inheritance: :show-inheritance:
:members: communicate, multicomm :members: communicate, multicomm
.. autoclass:: secop.stringio.HasIodev .. autoclass:: secop.io.BytesIO
:show-inheritance:
:members: communicate, multicomm
.. autoclass:: secop.io.HasIodev
:show-inheritance: :show-inheritance:
.. autoclass:: secop.iohandler.IOHandlerBase .. autoclass:: secop.iohandler.IOHandlerBase

View File

@ -74,29 +74,29 @@ SIMPLETYPES = {
} }
def short_doc(datatype): def short_doc(datatype, internal=False):
# pylint: disable=possibly-unused-variable # pylint: disable=possibly-unused-variable
def doc_EnumType(dt): def doc_EnumType(dt):
return 'one of %s' % str(tuple(dt._enum.keys())) return 'one of %s' % str(tuple(dt._enum.keys()))
def doc_ArrayOf(dt): def doc_ArrayOf(dt):
return 'array of %s' % short_doc(dt.members) return 'array of %s' % short_doc(dt.members, True)
def doc_TupleOf(dt): def doc_TupleOf(dt):
return 'tuple of (%s)' % ', '.join(short_doc(m) for m in dt.members) return 'tuple of (%s)' % ', '.join(short_doc(m, True) for m in dt.members)
def doc_CommandType(dt): def doc_CommandType(dt):
argument = short_doc(dt.argument) if dt.argument else '' argument = short_doc(dt.argument, True) if dt.argument else ''
result = ' -> %s' % short_doc(dt.result) if dt.result else '' result = ' -> %s' % short_doc(dt.result, True) if dt.result else ''
return '(%s)%s' % (argument, result) # return argument list only return '(%s)%s' % (argument, result) # return argument list only
def doc_NoneOr(dt): def doc_NoneOr(dt):
other = short_doc(dt.other) other = short_doc(dt.other, True)
return '%s or None' % other if other else None return '%s or None' % other if other else None
def doc_OrType(dt): def doc_OrType(dt):
types = [short_doc(t) for t in dt.types] types = [short_doc(t, True) for t in dt.types]
if None in types: # type is anyway broad: no doc if None in types: # type is anyway broad: no doc
return None return None
return ' or '.join(types) return ' or '.join(types)
@ -104,14 +104,17 @@ def short_doc(datatype):
def doc_Stub(dt): def doc_Stub(dt):
return dt.name.replace('Type', '').replace('Range', '').lower() return dt.name.replace('Type', '').replace('Range', '').lower()
clsname = datatype.__class__.__name__ def doc_BLOBType(dt):
return 'byte array'
clsname = type(datatype).__name__
result = SIMPLETYPES.get(clsname) result = SIMPLETYPES.get(clsname)
if result: if result:
return result return result
fun = locals().get('doc_' + clsname) fun = locals().get('doc_' + clsname)
if fun: if fun:
return fun(datatype) return fun(datatype)
return None # broad type like ValueType: no doc return clsname if internal else None # broad types like ValueType: no doc
def append_to_doc(cls, lines, itemcls, name, attrname, fmtfunc): def append_to_doc(cls, lines, itemcls, name, attrname, fmtfunc):

View File

@ -19,4 +19,4 @@
# Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> # Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
# #
# ***************************************************************************** # *****************************************************************************
"""SECoP protocl specific stuff""" """SECoP protocol specific stuff"""