Docstring for ModelChainResult - #1233
Conversation
kandersolar
left a comment
There was a problem hiding this comment.
PerArray makes an undesirable appearance in the list of attributes (link); should we rename it to _PerArray?
| 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.
| :py:meth:`~pvlib.location.get_airmass` for details.""" | |
| :py:meth:`~pvlib.location.Location.get_airmass` for details.""" |
| """ | ||
|
|
||
| losses: Optional[Union[pd.Series, float]] = field(default=None) | ||
| """Series (or tuple of Series, one for each array) containing DC loss |
| """ | ||
|
|
||
| times: Optional[pd.DatetimeIndex] = None | ||
| """DatetimeIndex (or tuple of DatetimeIndex, one for each array) contains |
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? |
wholmgren
left a comment
There was a problem hiding this comment.
Let's not worry about the signature in this pr.
| _T = TypeVar('T') | ||
|
|
||
|
|
||
| _PerArray = Union[_T, Tuple[_T, ...]] |
There was a problem hiding this comment.
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.
Tests addedUpdates entries todocs/sphinx/source/api.rstfor API changes.Adds description and name entries in the appropriate "what's new" file indocs/sphinx/source/whatsnewfor 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`).