From e20617e2aa8452ff28176951808c0302b0644f91 Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch Date: Sun, 5 Mar 2023 14:52:25 +0000 Subject: [PATCH 1/5] Enable ruff TCH for pandas/core/common.py --- pandas/core/common.py | 14 +++++++------- pyproject.toml | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pandas/core/common.py b/pandas/core/common.py index 073af11b719cc..9561b6f0fddd9 100644 --- a/pandas/core/common.py +++ b/pandas/core/common.py @@ -30,13 +30,6 @@ import numpy as np from pandas._libs import lib -from pandas._typing import ( - AnyArrayLike, - ArrayLike, - NpDtype, - RandomState, - T, -) from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike from pandas.core.dtypes.common import ( @@ -55,6 +48,13 @@ if TYPE_CHECKING: from pandas import Index + from pandas._typing import ( + AnyArrayLike, + ArrayLike, + NpDtype, + RandomState, + T, + ) def flatten(line): diff --git a/pyproject.toml b/pyproject.toml index edcf6384c432b..168effada2e1f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -306,7 +306,6 @@ exclude = [ "pandas/core/ops/*" = ["TCH"] "pandas/core/sorting.py" = ["TCH"] "pandas/core/construction.py" = ["TCH"] -"pandas/core/common.py" = ["TCH"] "pandas/core/missing.py" = ["TCH"] "pandas/core/util/*" = ["TCH"] "pandas/core/reshape/*" = ["TCH"] From 67ae4fa96f9f26b1a29490a3ad511b9deb353709 Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch Date: Sun, 5 Mar 2023 15:47:45 +0000 Subject: [PATCH 2/5] move one import --- pandas/core/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/common.py b/pandas/core/common.py index 9561b6f0fddd9..8a5d0d4fe7d0e 100644 --- a/pandas/core/common.py +++ b/pandas/core/common.py @@ -47,7 +47,6 @@ from pandas.core.dtypes.missing import isna if TYPE_CHECKING: - from pandas import Index from pandas._typing import ( AnyArrayLike, ArrayLike, @@ -55,6 +54,7 @@ RandomState, T, ) + from pandas import Index def flatten(line): From 0a1f6a55f9a29f0e2b5472976929a73a6237eeee Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch Date: Sun, 5 Mar 2023 18:09:42 +0100 Subject: [PATCH 3/5] Add blank line after import --- pandas/core/common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/core/common.py b/pandas/core/common.py index 8a5d0d4fe7d0e..8f3b3bff5641a 100644 --- a/pandas/core/common.py +++ b/pandas/core/common.py @@ -54,6 +54,7 @@ RandomState, T, ) + from pandas import Index From 7962874ed0f73fedeab1f9d959fceb728629c5f2 Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch Date: Mon, 6 Mar 2023 07:57:31 +0100 Subject: [PATCH 4/5] Enable ruff TCH on pandas/core/util --- pandas/core/util/hashing.py | 9 +++++---- pyproject.toml | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/core/util/hashing.py b/pandas/core/util/hashing.py index 280e9068b9f44..e6b7bb5ab1d71 100644 --- a/pandas/core/util/hashing.py +++ b/pandas/core/util/hashing.py @@ -14,10 +14,6 @@ import numpy as np from pandas._libs.hashing import hash_object_array -from pandas._typing import ( - ArrayLike, - npt, -) from pandas.core.dtypes.common import is_list_like from pandas.core.dtypes.generic import ( @@ -36,6 +32,11 @@ Series, ) + from pandas._typing import ( + ArrayLike, + npt, + ) + # 16 byte long hashing key _default_hash_key = "0123456789123456" diff --git a/pyproject.toml b/pyproject.toml index 168effada2e1f..9016627441484 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -307,7 +307,6 @@ exclude = [ "pandas/core/sorting.py" = ["TCH"] "pandas/core/construction.py" = ["TCH"] "pandas/core/missing.py" = ["TCH"] -"pandas/core/util/*" = ["TCH"] "pandas/core/reshape/*" = ["TCH"] "pandas/core/strings/*" = ["TCH"] "pandas/core/tools/*" = ["TCH"] From eeea25f25969552573fc72b2d4dd9c15344bbe01 Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch Date: Mon, 6 Mar 2023 08:15:23 +0000 Subject: [PATCH 5/5] move import --- pandas/core/util/hashing.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/core/util/hashing.py b/pandas/core/util/hashing.py index e6b7bb5ab1d71..15490ad853d84 100644 --- a/pandas/core/util/hashing.py +++ b/pandas/core/util/hashing.py @@ -25,6 +25,11 @@ ) if TYPE_CHECKING: + from pandas._typing import ( + ArrayLike, + npt, + ) + from pandas import ( DataFrame, Index, @@ -32,11 +37,6 @@ Series, ) - from pandas._typing import ( - ArrayLike, - npt, - ) - # 16 byte long hashing key _default_hash_key = "0123456789123456"