From 1a89a9d47d0dec5a7cd1197fb3aebf1248d1b5c8 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Tue, 16 Sep 2025 14:15:03 +0100 Subject: [PATCH] initial commit --- pandas/core/arrays/timedeltas.py | 2 +- pandas/core/dtypes/common.py | 2 +- pandas/core/indexes/base.py | 7 +++++-- pandas/io/excel/_base.py | 3 --- pandas/io/pytables.py | 7 +++++-- pandas/plotting/_matplotlib/converter.py | 4 ++-- pyproject.toml | 2 +- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/pandas/core/arrays/timedeltas.py b/pandas/core/arrays/timedeltas.py index 251d035749dea..64c2e1779aba7 100644 --- a/pandas/core/arrays/timedeltas.py +++ b/pandas/core/arrays/timedeltas.py @@ -202,7 +202,7 @@ def dtype(self) -> np.dtype[np.timedelta64]: # type: ignore[override] # ---------------------------------------------------------------- # Constructors - _freq = None + _freq: Tick | Day | None = None @classmethod def _validate_dtype(cls, values, dtype): diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index 03a29a7199e6b..447b7f90f2314 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -69,7 +69,7 @@ INT64_DTYPE = np.dtype(np.int64) # oh the troubles to reduce import time -_is_scipy_sparse = None +_is_scipy_sparse: Callable[[ArrayLike], bool] | None = None ensure_float64 = algos.ensure_float64 ensure_int64 = algos.ensure_int64 diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index bcf647acb98b1..d75479da70d11 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -470,7 +470,7 @@ def _engine_type( str = Accessor("str", StringMethods) - _references = None + _references: BlockValuesRefs | None = None # -------------------------------------------------------------------- # Constructors @@ -640,7 +640,10 @@ def _dtype_to_subclass(cls, dtype: DtypeObj): @classmethod def _simple_new( - cls, values: ArrayLike, name: Hashable | None = None, refs=None + cls, + values: ArrayLike, + name: Hashable | None = None, + refs: BlockValuesRefs | None = None, ) -> Self: """ We require that we have a dtype compat for the values. If we are passed diff --git a/pandas/io/excel/_base.py b/pandas/io/excel/_base.py index 137ce208c5da1..84f5cc447513c 100644 --- a/pandas/io/excel/_base.py +++ b/pandas/io/excel/_base.py @@ -1181,9 +1181,6 @@ def __new__( return object.__new__(cls) - # declare external properties you can count on - _path = None - @property def supported_extensions(self) -> tuple[str, ...]: """Extensions that writer engine supports.""" diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index b04f8e4137357..088cae8e20524 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -114,7 +114,10 @@ Iterator, Sequence, ) - from types import TracebackType + from types import ( + ModuleType, + TracebackType, + ) from tables import ( Col, @@ -227,7 +230,7 @@ def _ensure_term(where, scope_level: int): ) # oh the troubles to reduce import time -_table_mod = None +_table_mod: ModuleType | None = None _table_file_open_policy_is_strict = False diff --git a/pandas/plotting/_matplotlib/converter.py b/pandas/plotting/_matplotlib/converter.py index 774062e0f0412..914f6343d6345 100644 --- a/pandas/plotting/_matplotlib/converter.py +++ b/pandas/plotting/_matplotlib/converter.py @@ -63,10 +63,10 @@ from pandas._libs.tslibs.offsets import BaseOffset -_mpl_units = {} # Cache for units overwritten by us +_mpl_units: dict = {} # Cache for units overwritten by us -def get_pairs(): +def get_pairs() -> list[tuple[type, type[mdates.DateConverter]]]: pairs = [ (Timestamp, DatetimeConverter), (Period, PeriodConverter), diff --git a/pyproject.toml b/pyproject.toml index 60a13d073f289..a00d6e71b14e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -534,7 +534,7 @@ enable_error_code = "ignore-without-code" # Miscellaneous strictness flags allow_untyped_globals = false allow_redefinition = false -local_partial_types = false +local_partial_types = true implicit_reexport = true strict_equality = true # Configuring error messages