nmci modules: fix `help()` not working
>>> import nmci
>>> help(nmci.cleanup.cleanup_add)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.9/_sitebuiltins.py", line 103, in __call__
return pydoc.help(*args, **kwds)
File "/usr/lib64/python3.9/pydoc.py", line 2006, in __call__
self.help(request)
File "/usr/lib64/python3.9/pydoc.py", line 2065, in help
else: doc(request, 'Help on %s:', output=self._output)
File "/usr/lib64/python3.9/pydoc.py", line 1784, in doc
pager(render_doc(thing, title, forceload))
File "/usr/lib64/python3.9/pydoc.py", line 1763, in render_doc
desc += ' in module ' + module.__name__
AttributeError: '_Cleanup' object has no attribute '__name__'
>>>
Best fix would be converting single-instance module objects to classes - methods would be decorated @classmethod
(even if used before @property
works fine, else it returns <property>
object). Other hotfix is set __name__
of object when created (now in init.py, after !1312 (merged) in _module =
lines), but that is not nice (easy to forget to add with new module).
Edited by Filip Pokryvka