-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Docstring for ModelChainResult #1233
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
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.
PerArray
makes an undesirable appearance in the list of attributes (link); should we rename it to _PerArray
?
pvlib/modelchain.py
Outdated
airmass: Optional[pd.DataFrame] = field(default=None) | ||
"""Air mass in a DataFrame containing columns ``'airmass_relative'``, | ||
``'airmass_absolute'`` (unitless); see | ||
:py:meth:`~pvlib.location.get_airmass` for details.""" |
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.
:py:meth:`~pvlib.location.get_airmass` for details.""" | |
:py:meth:`~pvlib.location.Location.get_airmass` for details.""" |
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 is great!
pvlib/modelchain.py
Outdated
losses: Optional[Union[pd.Series, float]] = field(default=None) | ||
"""Series (or tuple of Series, one for each array) containing DC loss |
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.
never a tuple
pvlib/modelchain.py
Outdated
times: Optional[pd.DatetimeIndex] = None | ||
"""DatetimeIndex (or tuple of DatetimeIndex, one for each array) contains |
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.
never a tuple
type linters complain about the line |
Moving to module scope seems to solve the problem, although I did not get mypy's opinion about it. I looked around a bit for how other packages document dataclasses and came up mostly short -- this is the only example I found, which uses the standard approach of docstring sections: https://github.com/scipy/scipy/blob/701ffcc8a6f04509d115aac5e5681c538b5265a2/scipy/stats/_relative_risk.py#L21 |
I'd also like to see the type hints removed from the class signature. Nobody is going to directly instantiate this class, but all that text could be distracting/intimidating. My reading is that we just need to add |
I agree that text is distracting, but I have no idea how to suppress it either. |
@wholmgren hints to controlling a dataclass docstring here? |
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.
Let's not worry about the signature in this pr.
pvlib/modelchain.py
Outdated
_T = TypeVar('T') | ||
|
||
|
||
_PerArray = Union[_T, Tuple[_T, ...]] |
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.
No underscore on either of these. Type variables should be public so other libraries that build on pvlib can inspect them and benefit from them.
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.
merge when green.
Tests addedUpdates entries todocs/sphinx/source/api.rst
for API changes.Adds description and name entries in the appropriate "what's new" file indocs/sphinx/source/whatsnew
for all changes. Includes link to the GitHub Issue with:issue:`num`
or this Pull Request with:pull:`num`
. Includes contributor name and/or GitHub username (link with:ghuser:`user`
).