Skip to content

CLN find stacklevel inside deprecate_nonkeyword_arguments #46687

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 Apr 7, 2022 · 6 comments · Fixed by #47035
Closed

CLN find stacklevel inside deprecate_nonkeyword_arguments #46687

MarcoGorelli opened this issue Apr 7, 2022 · 6 comments · Fixed by #47035
Labels
Clean Warnings Warnings that appear or should be added to pandas
Milestone

Comments

@MarcoGorelli
Copy link
Member

xref https://github.com/pandas-dev/pandas/pull/44896/files#r845356050

Rather than passing stacklevel to the decorator, e.g.

@deprecate_nonkeyword_arguments(
version=None, allowed_args=["filepath_or_buffer"], stacklevel=3
)

find_stacklevel should probably be called within deprecate_nonkeyword_arguments

@rhshadrach rhshadrach added the Warnings Warnings that appear or should be added to pandas label Apr 8, 2022
@Anupam-USP
Copy link
Contributor

Is this issue still open?

@MarcoGorelli
Copy link
Member Author

Yup!

@Anupam-USP
Copy link
Contributor

Anupam-USP commented May 15, 2022

In short, rather than explicitly specifying stacklevel I have to use find_stack_level()?

@MarcoGorelli
Copy link
Member Author

yeah exactly, but it should be used within the definition of deprecate_nonkeyword_arguments itself, rather than having to pass it when it's used

@Anupam-USP
Copy link
Contributor

There are many definitions for this in the codebase, do I have to change all of them or only in the above-mentioned readers.py?

@MarcoGorelli
Copy link
Member Author

MarcoGorelli commented May 16, 2022

search for def deprecate_nonkeyword_arguments, that's the one you'll want to change to use find_stacklevel()

then, in all the places where it's used (e.g. in the above-mentioned readers.py) you should be able to remove stacklevel=

Anupam-USP added a commit to Anupam-USP/pandas that referenced this issue May 16, 2022
mroeschke pushed a commit that referenced this issue Jun 30, 2022
* Stacklevel argument updated #46687

* argument removed

* param added

* fixup

* remove stackevel from read_sas decorator

* add read_table_check_warnings and use it in read_table posargs deprecation test

Co-authored-by: Jeff Reback <[email protected]>
Co-authored-by: Marco Gorelli <[email protected]>
@simonjayhawkins simonjayhawkins added this to the 1.5 milestone Jul 2, 2022
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this issue Jul 13, 2022
* Stacklevel argument updated pandas-dev#46687

* argument removed

* param added

* fixup

* remove stackevel from read_sas decorator

* add read_table_check_warnings and use it in read_table posargs deprecation test

Co-authored-by: Jeff Reback <[email protected]>
Co-authored-by: Marco Gorelli <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Warnings Warnings that appear or should be added to pandas
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants