From a2ce2dfb8ff089c52d79949437faa879c066ff3f Mon Sep 17 00:00:00 2001 From: jrmylow Date: Sun, 4 Feb 2024 07:38:37 +0800 Subject: [PATCH 1/4] Updated docstring and exceptions raised --- pandas/_config/config.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/pandas/_config/config.py b/pandas/_config/config.py index bc9d289ddbaed..a7af4454c99b2 100644 --- a/pandas/_config/config.py +++ b/pandas/_config/config.py @@ -326,9 +326,9 @@ 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: @@ -336,13 +336,18 @@ def __doc__(self) -> str: # type: ignore[override] 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 ------- @@ -350,6 +355,8 @@ def __doc__(self) -> str: # type: ignore[override] Raises ------ +ValueError if odd numbers of non-keyword arguments are provided +TypeError if keyword arguments are provided OptionError if no such option exists Notes From 7a3e9a51c55408242efdaf08d6bb8fcedf210762 Mon Sep 17 00:00:00 2001 From: jrmylow Date: Sun, 4 Feb 2024 07:43:53 +0800 Subject: [PATCH 2/4] updated code_checks.sh --- ci/code_checks.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index a09c4662a1fd9..a91f8a881f3ba 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -159,7 +159,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\ From d2dee52e31bb068ff9fef7d1f57f95fbd1be53e9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 3 Feb 2024 23:49:06 +0000 Subject: [PATCH 3/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pandas/_config/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_config/config.py b/pandas/_config/config.py index a7af4454c99b2..f0b27ffbe9465 100644 --- a/pandas/_config/config.py +++ b/pandas/_config/config.py @@ -337,7 +337,7 @@ def __doc__(self) -> str: # type: ignore[override] Parameters ---------- *args : str | object - Arguments provided in pairs, which will be interpreted as (pattern, value) + Arguments provided in pairs, which will be interpreted as (pattern, value) pairs. pattern: str Regexp which should match a single option From 01155e813c38e4ca86a9404c5fc0f0541d088567 Mon Sep 17 00:00:00 2001 From: jrmylow Date: Sun, 4 Feb 2024 23:36:04 +0800 Subject: [PATCH 4/4] testing fix for doc build --- pandas/_config/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_config/config.py b/pandas/_config/config.py index a7af4454c99b2..43627eef2b465 100644 --- a/pandas/_config/config.py +++ b/pandas/_config/config.py @@ -340,9 +340,9 @@ def __doc__(self) -> str: # type: ignore[override] Arguments provided in pairs, which will be interpreted as (pattern, value) pairs. pattern: str - Regexp which should match a single option + Regexp which should match a single option value: object - New value of option + 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.