-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
artiq_rpctool: list-methods also prints class docstring
Showing
2 changed files
with
11 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -442,15 +442,18 @@ def _handle_connection_cr(self, reader, writer): | |
try: | ||
if obj["action"] == "get_rpc_method_list": | ||
members = inspect.getmembers(target, inspect.ismethod) | ||
methods = {} | ||
doc = { | ||
"docstring": target.__doc__, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sbourdeauducq
Member
|
||
"methods": {} | ||
} | ||
for name, method in members: | ||
if name.startswith("_"): | ||
continue | ||
method = getattr(target, name) | ||
argspec = inspect.getfullargspec(method) | ||
methods[name] = (dict(argspec.__dict__), | ||
inspect.getdoc(method)) | ||
obj = {"status": "ok", "ret": methods} | ||
doc["methods"][name] = (dict(argspec.__dict__), | ||
inspect.getdoc(method)) | ||
obj = {"status": "ok", "ret": doc} | ||
elif obj["action"] == "call": | ||
logger.debug("calling %s", _PrettyPrintCall(obj)) | ||
method = getattr(target, obj["name"]) | ||
|
There are indentation problems, e.g. try it with the novatech controller.