From eb2e8f5f749c82a3360f02a34ed9ec41499c5a7f Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Wed, 12 Jan 2022 16:23:21 +0100 Subject: [PATCH] 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 Reviewed-by: Enrico Faulhaber Reviewed-by: Markus Zolliker --- doc/source/reference.rst | 8 ++++++-- secop/lib/classdoc.py | 21 ++++++++++++--------- secop/protocol/__init__.py | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/doc/source/reference.rst b/doc/source/reference.rst index a81091e..d85b838 100644 --- a/doc/source/reference.rst +++ b/doc/source/reference.rst @@ -49,11 +49,15 @@ Communication :show-inheritance: :members: communicate -.. autoclass:: secop.stringio.StringIO +.. autoclass:: secop.io.StringIO :show-inheritance: :members: communicate, multicomm -.. autoclass:: secop.stringio.HasIodev +.. autoclass:: secop.io.BytesIO + :show-inheritance: + :members: communicate, multicomm + +.. autoclass:: secop.io.HasIodev :show-inheritance: .. autoclass:: secop.iohandler.IOHandlerBase diff --git a/secop/lib/classdoc.py b/secop/lib/classdoc.py index 4cece4b..18392d7 100644 --- a/secop/lib/classdoc.py +++ b/secop/lib/classdoc.py @@ -74,29 +74,29 @@ SIMPLETYPES = { } -def short_doc(datatype): +def short_doc(datatype, internal=False): # pylint: disable=possibly-unused-variable def doc_EnumType(dt): return 'one of %s' % str(tuple(dt._enum.keys())) 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): - 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): - argument = short_doc(dt.argument) if dt.argument else '' - result = ' -> %s' % short_doc(dt.result) if dt.result else '' + argument = short_doc(dt.argument, True) if dt.argument else '' + result = ' -> %s' % short_doc(dt.result, True) if dt.result else '' return '(%s)%s' % (argument, result) # return argument list only def doc_NoneOr(dt): - other = short_doc(dt.other) + other = short_doc(dt.other, True) return '%s or None' % other if other else None 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 return None return ' or '.join(types) @@ -104,14 +104,17 @@ def short_doc(datatype): def doc_Stub(dt): 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) if result: return result fun = locals().get('doc_' + clsname) if fun: 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): diff --git a/secop/protocol/__init__.py b/secop/protocol/__init__.py index a9803ba..25e867f 100644 --- a/secop/protocol/__init__.py +++ b/secop/protocol/__init__.py @@ -19,4 +19,4 @@ # Enrico Faulhaber # # ***************************************************************************** -"""SECoP protocl specific stuff""" +"""SECoP protocol specific stuff"""