-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
REF: Remove dynamic docstrings from option methods #57710
Conversation
with warnings.catch_warnings(): | ||
warnings.simplefilter("ignore", FutureWarning) | ||
warnings.simplefilter("ignore", DeprecationWarning) | ||
s += f"\n [default: {o.defval}] [currently: {get_option(k)}]" |
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.
One thing to be aware of is the impact of python/cpython#73858. Once this block is entered, the cache of previously seen warnings is cleared so that users will see any already encountered warning again. If encountered in a for loop this can cause a warning to get printed thousands of times e.g. #57054.
I believe this will only be run on import, so I think this is likely to have almost no impact - in the odd case you import pandas in e.g. a for loop the warning would be seen at most twice because of import caching.
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.
lgtm, just the docstring validation failing.
/preview |
Website preview of this PR available at: https://pandas.pydata.org/preview/pandas-dev/pandas/57710/ |
* REF: Remove dynamic docstrings from option methods * Fix arguments * Reuse * Fix drop duplicate section, numpydoc valudation * Fix formatting
xref #57578 (comment)
These methods have complex docstrings in an attempt to display all option within the docstring. This makes these docstrings hard to automatically validate and renders the internal implementation in Sphinx. I think it's reasonable to link to the docs where all the options are listed instead.
Additionally did some cleanups removing
silent
from some of these methods by instead catching warnings where needed