diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index df58593bc930c..54e49eaf60021 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -3838,7 +3838,7 @@ def values(self) -> np.ndarray: return self._data.view(np.ndarray) @cache_readonly - @doc(IndexOpsMixin.array) # type: ignore + @doc(IndexOpsMixin.array) def array(self) -> ExtensionArray: array = self._data if isinstance(array, np.ndarray): diff --git a/pandas/io/json/_normalize.py b/pandas/io/json/_normalize.py index 6e68c1cf5e27e..69e9b111a6c20 100644 --- a/pandas/io/json/_normalize.py +++ b/pandas/io/json/_normalize.py @@ -231,7 +231,7 @@ def _pull_field( js: Dict[str, Any], spec: Union[List, str] ) -> Union[Scalar, Iterable]: """Internal function to pull field""" - result = js # type: ignore + result = js if isinstance(spec, list): for field in spec: result = result[field] @@ -251,7 +251,7 @@ def _pull_records(js: Dict[str, Any], spec: Union[List, str]) -> Iterable: # null, otherwise return an empty list if not isinstance(result, Iterable): if pd.isnull(result): - result = [] # type: ignore + result = [] else: raise TypeError( f"{js} has non iterable value {result} for path {spec}. " diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index a22251b29da54..3dd87ae6ed758 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -1916,9 +1916,7 @@ def is_indexed(self) -> bool: if not hasattr(self.table, "cols"): # e.g. if infer hasn't been called yet, self.table will be None. return False - # GH#29692 mypy doesn't recognize self.table as having a "cols" attribute - # 'error: "None" has no attribute "cols"' - return getattr(self.table.cols, self.cname).is_indexed # type: ignore + return getattr(self.table.cols, self.cname).is_indexed def convert(self, values: np.ndarray, nan_rep, encoding: str, errors: str): """ diff --git a/pandas/io/stata.py b/pandas/io/stata.py index 8f3aa60b7a9cc..b9b43685415d1 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -356,10 +356,9 @@ def parse_dates_safe(dates, delta=False, year=False, days=False): time_delta = dates - stata_epoch d["delta"] = time_delta._values.astype(np.int64) // 1000 # microseconds if days or year: - # ignore since mypy reports that DatetimeIndex has no year/month date_index = DatetimeIndex(dates) - d["year"] = date_index.year # type: ignore - d["month"] = date_index.month # type: ignore + d["year"] = date_index.year + d["month"] = date_index.month if days: days_in_ns = dates.astype(np.int64) - to_datetime( d["year"], format="%Y" diff --git a/setup.cfg b/setup.cfg index fda4ba4065e2f..6c42b27c7b015 100644 --- a/setup.cfg +++ b/setup.cfg @@ -126,6 +126,8 @@ ignore_missing_imports=True no_implicit_optional=True check_untyped_defs=True strict_equality=True +warn_redundant_casts = True +warn_unused_ignores = True [mypy-pandas.tests.*] check_untyped_defs=False