Skip to content

Commit

Permalink
DOC: Updated docstring for set_option (pandas-dev#57235)
Browse files Browse the repository at this point in the history
* Updated docstring and exceptions raised

* updated code_checks.sh

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* testing fix for doc  build

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and pmhatre1 committed May 7, 2024
1 parent 2c4bd76 commit 995bf6a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.tseries.offsets.Milli\
pandas.tseries.offsets.Micro\
pandas.tseries.offsets.Nano\
pandas.set_option\
pandas.Timestamp.max\
pandas.Timestamp.min\
pandas.Timestamp.resolution\
Expand Down
25 changes: 16 additions & 9 deletions pandas/_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,30 +326,37 @@ def __doc__(self) -> str: # type: ignore[override]
"""

_set_option_tmpl = """
set_option(pat, value)
set_option(*args, **kwargs)
Sets the value of the specified option.
Sets the value of the specified option or options.
Available options:
{opts_list}
Parameters
----------
pat : str
Regexp which should match a single option.
Note: partial matches are supported for convenience, but unless you use the
full option name (e.g. x.y.z.option_name), your code may break in future
versions if new options with similar names are introduced.
value : object
New value of option.
*args : str | object
Arguments provided in pairs, which will be interpreted as (pattern, value)
pairs.
pattern: str
Regexp which should match a single option
value: object
New value of option
Note: partial pattern matches are supported for convenience, but unless you
use the full option name (e.g. x.y.z.option_name), your code may break in
future versions if new options with similar names are introduced.
**kwargs : str
Keyword arguments are not currently supported.
Returns
-------
None
Raises
------
ValueError if odd numbers of non-keyword arguments are provided
TypeError if keyword arguments are provided
OptionError if no such option exists
Notes
Expand Down

0 comments on commit 995bf6a

Please sign in to comment.