From 389d0ec4a08e253b0c06d8d39fd7d0f2ab68586b Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Mon, 9 Dec 2019 21:23:05 +0200 Subject: [PATCH 1/3] DOC: Cleaned doctrings --- pandas/compat/pickle_compat.py | 5 ++-- pandas/conftest.py | 49 +++++++++++++++------------------- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/pandas/compat/pickle_compat.py b/pandas/compat/pickle_compat.py index 7dfed94482a05..c83267e8810a1 100644 --- a/pandas/compat/pickle_compat.py +++ b/pandas/compat/pickle_compat.py @@ -219,8 +219,9 @@ def load_newobj_ex(self): pass -def load(fh, encoding=None, is_verbose=False): - """load a pickle, with a provided encoding +def load(fh, encoding=None, is_verbose: bool = False): + """ + Load a pickle, with a provided encoding, Parameters ---------- diff --git a/pandas/conftest.py b/pandas/conftest.py index 3553a411a27f8..2a4bc6d52cbac 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -163,7 +163,7 @@ def ordered_fixture(request): @pytest.fixture(params=_all_arithmetic_operators) def all_arithmetic_operators(request): """ - Fixture for dunder names for common arithmetic operations + Fixture for dunder names for common arithmetic operations. """ return request.param @@ -190,7 +190,9 @@ def all_arithmetic_functions(request): """ Fixture for operator and roperator arithmetic functions. - Note: This includes divmod and rdivmod, whereas all_arithmetic_operators + Notes + ----- + This includes divmod and rdivmod, whereas all_arithmetic_operators does not. """ return request.param @@ -213,7 +215,7 @@ def all_arithmetic_functions(request): @pytest.fixture(params=_all_numeric_reductions) def all_numeric_reductions(request): """ - Fixture for numeric reduction names + Fixture for numeric reduction names. """ return request.param @@ -224,7 +226,7 @@ def all_numeric_reductions(request): @pytest.fixture(params=_all_boolean_reductions) def all_boolean_reductions(request): """ - Fixture for boolean reduction names + Fixture for boolean reduction names. """ return request.param @@ -251,7 +253,7 @@ def _get_cython_table_params(ndframe, func_names_and_expected): Returns ------- - results : list + list List of three items (DataFrame, function, expected result) """ results = [] @@ -310,7 +312,7 @@ def all_logical_operators(request): @pytest.fixture(params=[None, "gzip", "bz2", "zip", "xz"]) def compression(request): """ - Fixture for trying common compression types in compression tests + Fixture for trying common compression types in compression tests. """ return request.param @@ -319,7 +321,7 @@ def compression(request): def compression_only(request): """ Fixture for trying common compression types in compression tests excluding - uncompressed case + uncompressed case. """ return request.param @@ -327,7 +329,7 @@ def compression_only(request): @pytest.fixture(params=[True, False]) def writable(request): """ - Fixture that an array is writable + Fixture that an array is writable. """ return request.param @@ -340,7 +342,7 @@ def datetime_tz_utc(): @pytest.fixture(params=["utc", "dateutil/UTC", utc, tzutc(), timezone.utc]) def utc_fixture(request): """ - Fixture to provide variants of UTC timezone strings and tzinfo objects + Fixture to provide variants of UTC timezone strings and tzinfo objects. """ return request.param @@ -348,7 +350,7 @@ def utc_fixture(request): @pytest.fixture(params=["inner", "outer", "left", "right"]) def join_type(request): """ - Fixture for trying all types of join operations + Fixture for trying all types of join operations. """ return request.param @@ -370,7 +372,7 @@ def datapath(strict_data_files): Returns ------- - path : path including ``pandas/tests``. + path including ``pandas/tests``. Raises ------ @@ -383,11 +385,11 @@ def deco(*args): path = os.path.join(BASE_PATH, *args) if not os.path.exists(path): if strict_data_files: - msg = "Could not find file {} and --strict-data-files is set." - raise ValueError(msg.format(path)) + raise ValueError( + f"Could not find file {path} and --strict-data-files is set." + ) else: - msg = "Could not find {}." - pytest.skip(msg.format(path)) + pytest.skip(f"Could not find {path}.") return path return deco @@ -404,7 +406,7 @@ def iris(datapath): @pytest.fixture(params=["nlargest", "nsmallest"]) def nselect_method(request): """ - Fixture for trying all nselect methods + Fixture for trying all nselect methods. """ return request.param @@ -412,7 +414,7 @@ def nselect_method(request): @pytest.fixture(params=["left", "right", "both", "neither"]) def closed(request): """ - Fixture for trying all interval closed parameters + Fixture for trying all interval closed parameters. """ return request.param @@ -420,7 +422,7 @@ def closed(request): @pytest.fixture(params=["left", "right", "both", "neither"]) def other_closed(request): """ - Secondary closed fixture to allow parametrizing over all pairs of closed + Secondary closed fixture to allow parametrizing over all pairs of closed. """ return request.param @@ -428,7 +430,7 @@ def other_closed(request): @pytest.fixture(params=[None, np.nan, pd.NaT, float("nan"), np.float("NaN")]) def nulls_fixture(request): """ - Fixture for each null type in pandas + Fixture for each null type in pandas. """ return request.param @@ -439,7 +441,7 @@ def nulls_fixture(request): @pytest.fixture(params=[None, np.nan, pd.NaT]) def unique_nulls_fixture(request): """ - Fixture for each null type in pandas, each null type exactly once + Fixture for each null type in pandas, each null type exactly once. """ return request.param @@ -589,7 +591,6 @@ def float_dtype(request): * 'float32' * 'float64' """ - return request.param @@ -602,7 +603,6 @@ def complex_dtype(request): * 'complex64' * 'complex128' """ - return request.param @@ -617,7 +617,6 @@ def sint_dtype(request): * 'int32' * 'int64' """ - return request.param @@ -631,7 +630,6 @@ def uint_dtype(request): * 'uint32' * 'uint64' """ - return request.param @@ -650,7 +648,6 @@ def any_int_dtype(request): * 'int64' * 'uint64' """ - return request.param @@ -672,7 +669,6 @@ def any_real_dtype(request): * 'float32' * 'float64' """ - return request.param @@ -710,7 +706,6 @@ def any_numpy_dtype(request): * object * 'object' """ - return request.param From 48599f6ea87b684a0a9222b8d2396da73f6c4794 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <50263213+MomIsBestFriend@users.noreply.github.com> Date: Mon, 9 Dec 2019 23:10:52 +0200 Subject: [PATCH 2/3] Update pickle_compat.py @WillAyd suggestion --- pandas/compat/pickle_compat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/compat/pickle_compat.py b/pandas/compat/pickle_compat.py index c83267e8810a1..6ea415a3d621f 100644 --- a/pandas/compat/pickle_compat.py +++ b/pandas/compat/pickle_compat.py @@ -4,7 +4,7 @@ import copy import pickle as pkl -from typing import TYPE_CHECKING +from typing import Optional, TYPE_CHECKING import warnings from pandas import Index @@ -219,7 +219,7 @@ def load_newobj_ex(self): pass -def load(fh, encoding=None, is_verbose: bool = False): +def load(fh, encoding: Optional[str] = None, is_verbose: bool = False): """ Load a pickle, with a provided encoding, From afdfe51b8c0dfe16eb46731367152098f7ed7293 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Mon, 9 Dec 2019 23:40:29 +0200 Subject: [PATCH 3/3] isort --- pandas/compat/pickle_compat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/compat/pickle_compat.py b/pandas/compat/pickle_compat.py index 6ea415a3d621f..e8fd390456f82 100644 --- a/pandas/compat/pickle_compat.py +++ b/pandas/compat/pickle_compat.py @@ -4,7 +4,7 @@ import copy import pickle as pkl -from typing import Optional, TYPE_CHECKING +from typing import TYPE_CHECKING, Optional import warnings from pandas import Index