Skip to content

CLEAN dubious docstring #50344

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

Closed
MarcoGorelli opened this issue Dec 19, 2022 · 5 comments · Fixed by #50484
Closed

CLEAN dubious docstring #50344

MarcoGorelli opened this issue Dec 19, 2022 · 5 comments · Fixed by #50484

Comments

@MarcoGorelli
Copy link
Member

MarcoGorelli commented Dec 19, 2022

This looks odd - the docstring is broken in two, and there's an assignment in the middle?

def __init__(self, n=1, normalize=False):
n = self._validate_n(n)
self.n = n
"""
Number of multiples of the frequency.
Examples
--------
>>> pd.offsets.Hour(5).n
5
"""
self.normalize = normalize
"""
Return boolean whether the frequency can align with midnight.
Examples
--------
>>> pd.offsets.Hour(5).normalize
False
"""
self._cache = {}

It looks like something might not have gone quite right during a merge conflict, and was kept in?

If anyone felt like having a look at git blame / git log to figure this out, that'd be helpful

No need to comment "can I work on this?" - if you know your way around git and figure this out, then go ahead and work on it - thanks 🙏

@asishm
Copy link
Contributor

asishm commented Dec 19, 2022

Added in #48011

@MarcoGorelli
Copy link
Member Author

thanks @asishm

self.normalize = normalize should've come after the docstring, and that Return boolean whether the frequency can align with midnight. should've gone inside the Parameters section of the docstring

Do you want to submit a PR to fix it up?

@asishm
Copy link
Contributor

asishm commented Dec 19, 2022

The initial docstring also won't show up - it's already present after a code-block

def __init__(self, n=1, normalize=False):
n = self._validate_n(n)
self.n = n
"""
Number of multiples of the frequency.
Examples

n, normalize are not properties (so there can't be any docstrings) - they're plain attributes (unless i'm reading it wrong).

They are also documented here -

class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta):
which shows up at https://pandas.pydata.org/docs/reference/api/pandas.tseries.offsets.DateOffset.html#pandas.tseries.offsets.DateOffset

@MarcoGorelli
Copy link
Member Author

The initial docstring also won't show up - it's already present after a code-block

yeah what I mean is to move the docstring to be directly under __init__

@luke396
Copy link
Contributor

luke396 commented Dec 29, 2022

take

luke396 pushed a commit to luke396/pandas that referenced this issue Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants