From 2eaa76d8459a7b78146929cfa842f521bb341248 Mon Sep 17 00:00:00 2001 From: Philip Date: Wed, 1 Mar 2023 16:46:10 -0500 Subject: [PATCH 1/2] updated docstrings for EX02 validation --- ci/code_checks.sh | 14 ++------------ doc/source/whatsnew/v2.0.0.rst | 1 + pandas/core/dtypes/common.py | 6 ++++++ pandas/plotting/_core.py | 3 +-- pandas/plotting/_misc.py | 3 +-- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 865f6d46cfee0..9bf106e1cc065 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -79,8 +79,8 @@ fi ### DOCSTRINGS ### if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then - MSG='Validate docstrings (EX04, GL01, GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, PR03, PR04, PR05, PR06, PR08, PR09, PR10, RT01, RT02, RT04, RT05, SA02, SA03, SA04, SS01, SS02, SS03, SS04, SS05, SS06)' ; echo $MSG - $BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX04,GL01,GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,PR03,PR04,PR05,PR06,PR08,PR09,PR10,RT01,RT02,RT04,RT05,SA02,SA03,SA04,SS01,SS02,SS03,SS04,SS05,SS06 + MSG='Validate docstrings (EX02, EX04, GL01, GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, PR03, PR04, PR05, PR06, PR08, PR09, PR10, RT01, RT02, RT04, RT05, SA02, SA03, SA04, SS01, SS02, SS03, SS04, SS05, SS06)' ; echo $MSG + $BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX02,EX04,GL01,GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,PR03,PR04,PR05,PR06,PR08,PR09,PR10,RT01,RT02,RT04,RT05,SA02,SA03,SA04,SS01,SS02,SS03,SS04,SS05,SS06 RET=$(($RET + $?)) ; echo $MSG "DONE" MSG='Partially validate docstrings (EX01)' ; echo $MSG @@ -557,16 +557,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.DataFrame.__dataframe__ RET=$(($RET + $?)) ; echo $MSG "DONE" - MSG='Partially validate docstrings (EX02)' ; echo $MSG - $BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX02 --ignore_functions \ - pandas.DataFrame.plot.line \ - pandas.Series.plot.line \ - pandas.api.types.is_datetime64_any_dtype \ - pandas.api.types.is_datetime64_ns_dtype \ - pandas.api.types.is_datetime64tz_dtype \ - pandas.plotting.parallel_coordinates - RET=$(($RET + $?)) ; echo $MSG "DONE" - fi ### DOCUMENTATION NOTEBOOKS ### diff --git a/doc/source/whatsnew/v2.0.0.rst b/doc/source/whatsnew/v2.0.0.rst index 47b2ab6a5efdf..84596f0999bd1 100644 --- a/doc/source/whatsnew/v2.0.0.rst +++ b/doc/source/whatsnew/v2.0.0.rst @@ -330,6 +330,7 @@ Other enhancements - Added new argument ``engine`` to :func:`read_json` to support parsing JSON with pyarrow by specifying ``engine="pyarrow"`` (:issue:`48893`) - Added support for SQLAlchemy 2.0 (:issue:`40686`) - :class:`Index` set operations :meth:`Index.union`, :meth:`Index.intersection`, :meth:`Index.difference`, and :meth:`Index.symmetric_difference` now support ``sort=True``, which will always return a sorted result, unlike the default ``sort=None`` which does not sort in some cases (:issue:`25151`) +- Updated docstrings to make all ``EX02`` tests pass ``validate_docstrings`` (:issue:`51236`) .. --------------------------------------------------------------------------- .. _whatsnew_200.notable_bug_fixes: diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index 874b567f65937..678b3d6752f02 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -322,6 +322,7 @@ def is_datetime64tz_dtype(arr_or_dtype) -> bool: Examples -------- + >>> from pandas.api.types import is_datetime64tz_dtype >>> is_datetime64tz_dtype(object) False >>> is_datetime64tz_dtype([1, 2, 3]) @@ -331,6 +332,7 @@ def is_datetime64tz_dtype(arr_or_dtype) -> bool: >>> is_datetime64tz_dtype(pd.DatetimeIndex([1, 2, 3], tz="US/Eastern")) True + >>> from pandas.core.dtypes.dtypes import DatetimeTZDtype >>> dtype = DatetimeTZDtype("ns", tz="US/Eastern") >>> s = pd.Series([], dtype=dtype) >>> is_datetime64tz_dtype(dtype) @@ -886,6 +888,8 @@ def is_datetime64_any_dtype(arr_or_dtype) -> bool: Examples -------- + >>> from pandas.api.types import is_datetime64_any_dtype + >>> from pandas.core.dtypes.dtypes import DatetimeTZDtype >>> is_datetime64_any_dtype(str) False >>> is_datetime64_any_dtype(int) @@ -928,6 +932,8 @@ def is_datetime64_ns_dtype(arr_or_dtype) -> bool: Examples -------- + >>> from pandas.api.types import is_datetime64_ns_dtype + >>> from pandas.core.dtypes.dtypes import DatetimeTZDtype >>> is_datetime64_ns_dtype(str) False >>> is_datetime64_ns_dtype(int) diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 51c95808506a8..3d763ebb7a11f 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -989,8 +989,7 @@ def __call__(self, *args, **kwargs): :context: close-figs >>> s = pd.Series([1, 3, 2]) - >>> s.plot.line() - + >>> s.plot.line() # doctest: +SKIP .. plot:: :context: close-figs diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index 791e7c0214b58..903dce9f040c3 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -447,8 +447,7 @@ def parallel_coordinates( ... ) >>> pd.plotting.parallel_coordinates( ... df, 'Name', color=('#556270', '#4ECDC4', '#C7F464') - ... ) - + ... ) # doctest: +SKIP """ plot_backend = _get_plot_backend("matplotlib") return plot_backend.parallel_coordinates( From 80b363ee7f6fb99b05106540eb15d44e009c6990 Mon Sep 17 00:00:00 2001 From: Marco Edward Gorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Thu, 2 Mar 2023 07:32:32 +0000 Subject: [PATCH 2/2] remove whatsnew entry --- doc/source/whatsnew/v2.0.0.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/source/whatsnew/v2.0.0.rst b/doc/source/whatsnew/v2.0.0.rst index 84596f0999bd1..47b2ab6a5efdf 100644 --- a/doc/source/whatsnew/v2.0.0.rst +++ b/doc/source/whatsnew/v2.0.0.rst @@ -330,7 +330,6 @@ Other enhancements - Added new argument ``engine`` to :func:`read_json` to support parsing JSON with pyarrow by specifying ``engine="pyarrow"`` (:issue:`48893`) - Added support for SQLAlchemy 2.0 (:issue:`40686`) - :class:`Index` set operations :meth:`Index.union`, :meth:`Index.intersection`, :meth:`Index.difference`, and :meth:`Index.symmetric_difference` now support ``sort=True``, which will always return a sorted result, unlike the default ``sort=None`` which does not sort in some cases (:issue:`25151`) -- Updated docstrings to make all ``EX02`` tests pass ``validate_docstrings`` (:issue:`51236`) .. --------------------------------------------------------------------------- .. _whatsnew_200.notable_bug_fixes: