-
-
Notifications
You must be signed in to change notification settings - Fork 585
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
Add parameter doc to sunpy/sun/sun.py #2369
Conversation
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.
In pandas I've seen they use a dictionary with docstrings that they append to the functions that need it. Check this https://github.com/pandas-dev/pandas/blob/master/pandas/core/generic.py#L477 Maybe something could be done in here in a similar fashion, but I think that requires some extra thinking.
I haven't tested it but I think this would work: PARAMETER_DOCS = """
Parameters
---------------
...
""""
def add_parameter_docs(f):
f.__doc__+= PARAMETER_DOCS
return f
@add_parameter_docs
def sun_location(t='now'):
"""
This does a thing.
""" |
sunpy/sun/sun.py
Outdated
def add_parameter_docs(f): | ||
f.__doc__ += PARAMETER_DOCS | ||
if isinstance(f.__doc__, 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.
this should be six.string_types
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.
OH YEAH IN THIS CRAZY WORLD
We should move the decorator somewhere else just incase we need it for the future. |
Yeah, we should refactor it into utils and let it take arguments. Maybe a prepend and append argument to the decorator? We should merge this then open a separate issue for it. |
We could also make it do a .format on the docstring if a dictionary is provided as an argument to the decorator. |
Looks like I messed up.
I will fix these soon(TM) |
585dca1
to
a24d4c2
Compare
Doc builds without problems now. |
There is a lot of repetition here because all the methods take the same argument - I wasn't sure how to avoid just copy and pasting the same bit of text, so that's what I've done. If anyone else knows a better way to do this please let me know!