Skip to content

DEPR: rename startingMonth to starting_month (argument in BQuarterBegin) #58110

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
wants to merge 15 commits into from

Conversation

gboeker
Copy link
Contributor

@gboeker gboeker commented Apr 1, 2024

@Aloqeely
Copy link
Member

Aloqeely commented Apr 7, 2024

You need to deprecate startingMonth first

@gboeker
Copy link
Contributor Author

gboeker commented Apr 9, 2024

Thanks @Aloqeely ! Could you explain to me how I can deprecate startingMonth?

@Aloqeely
Copy link
Member

Aloqeely commented Apr 9, 2024

Basically you should still allow startingMonth, but if it is used you should warn the user that it will be removed soon
I think a check in __init__ will do the job but I'm not sure, cc @jbrockmendel


def __init__(self, n=1, normalize=False, startingMonth=None):
def __init__(self, n=1, normalize=False, starting_month=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah, as @Aloqeely said, you'll want to do something like

def __init__(self, ..., startingMonth=no_default, *, starting_month=no_default):
   if startingMonth is not no_default:
      warnings.warn(...)  # <- tell them to use starting_month instead
      starting_month = startingMonth

Copy link
Contributor Author

@gboeker gboeker May 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Brock, I changed it to the following:

    def __init__(self, n=1, normalize=False, startingMonth=None,
                 *, starting_month=None):
        if startingMonth is not None:
            warnings.warn(
                "`startingMonth` is deprecated and will be removed in a future "
                "version. Use `starting_month` instead",
                DeprecationWarning
            )
            starting_month = startingMonth

        BaseOffset.__init__(self, n, normalize)

        if starting_month is None:
            starting_month = self._default_starting_month
        self.starting_month = starting_month

Does this look right?

@mroeschke
Copy link
Member

Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.

@mroeschke mroeschke closed this May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DEPR: rename startingMonth to starting_month (argument in BQuarterBegin)
4 participants