-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return help text #913
Return help text #913
Conversation
Correct intentation
4054f6e
to
f475b98
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks generally fine, just two small comments in the code.
pynest/nest/lib/hl_api_info.py
Outdated
""" | ||
hlpobj = obj | ||
if hlpobj is not None: | ||
show_help_with_pager(hlpobj, pager) | ||
if isinstance(return_text, str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@babsey Why would you allow return_text
to be anything else than True
or False
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your question has a good point. Returning help text was my intention for accessing to nest via web protocol. Here, it requests nest.help with return_text='true' and the type of return_text is string. Thus, it should be changed to boolean type.
By the way, an example for the usage of nest.help via web request can be found here:
http://192.52.2.171/ (this link is temporally available)
This page calls several nest methods e.g. nest.Models, nest.help and nest.GetDefaults and renders to webpage dynamically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice! I don't know how you web app precisely interfaces with NEST, but I suppose it calls nest.help()
from Python, and the web app will always call it with return_value==True
. Why can't you then place the Python constant True
in the call? I am a bit afraid that details of an external app get too deeply into NEST's code. �@jougs @apeyser Any comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the lines for converting return_text to boolean. Even it works even when return_text contains any non-empty string. So, converting is unnecessary. I do not want to change default output of help function. It should remain opening a pager.
pynest/nest/lib/hl_api_helper.py
Outdated
Parameters | ||
---------- | ||
hlpobj : object | ||
Object to display |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Object to display help for"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and merging. Many thanks for the contribution.
Thanks for approving. However, few days ago I realized that the function In case that the file not found, the function doesnt return any variable. It might call an error, when for this output would split but it is not iterable ( I have already fixed that problem, but I will write solution codes in a new branch and pull the request to merge. |
The purpose of the PR is that the function 'help' is able to return text about an object instead of opening in a pager.
Example:
txt = nest.help('iaf_psc_alpha', return_text=True)
print txt