Skip to content

Commit 552715a

Browse files
committed
annotate some variables, remove some unused
1 parent 7b795b2 commit 552715a

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed

pandas/_config/display.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
import locale
66
import sys
7+
from typing import Optional
78

89
from pandas._config import config as cf
910

1011
# -----------------------------------------------------------------------------
1112
# Global formatting options
12-
_initial_defencoding = None
13+
_initial_defencoding: Optional[str] = None
1314

1415

1516
def detect_console_encoding() -> str:

pandas/core/computation/expressions.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
77
"""
88
import operator
9-
from typing import List, Set
9+
from typing import List, Optional, Set
1010
import warnings
1111

1212
import numpy as np
1313

1414
from pandas._config import get_option
1515

16+
from pandas._typing import FuncType
17+
1618
from pandas.core.dtypes.generic import ABCDataFrame
1719

1820
from pandas.core.computation.check import NUMEXPR_INSTALLED
@@ -21,11 +23,11 @@
2123
if NUMEXPR_INSTALLED:
2224
import numexpr as ne
2325

24-
_TEST_MODE = None
26+
_TEST_MODE: Optional[bool] = None
2527
_TEST_RESULT: List[bool] = []
2628
USE_NUMEXPR = NUMEXPR_INSTALLED
27-
_evaluate = None
28-
_where = None
29+
_evaluate: Optional[FuncType] = None
30+
_where: Optional[FuncType] = None
2931

3032
# the set of dtypes that we will allow pass to numexpr
3133
_ALLOWED_DTYPES = {

pandas/core/generic.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class NDFrame(PandasObject, SelectionMixin, indexing.IndexingMixin):
180180
["_AXIS_NAMES", "_AXIS_NUMBERS", "get_values", "tshift"]
181181
)
182182
_metadata: List[str] = []
183-
_is_copy = None
183+
_is_copy: Optional[weakref.ReferenceType[NDFrame]] = None
184184
_mgr: Manager
185185
_attrs: Dict[Optional[Hashable], Any]
186186
_typ: str
@@ -405,7 +405,6 @@ def _data(self):
405405
# Axis
406406
_stat_axis_number = 0
407407
_stat_axis_name = "index"
408-
_ix = None
409408
_AXIS_ORDERS: List[str]
410409
_AXIS_TO_AXIS_NUMBER: Dict[Axis, int] = {0: 0, "index": 0, "rows": 0}
411410
_AXIS_REVERSED: bool
@@ -3831,7 +3830,7 @@ def _slice(self: FrameOrSeries, slobj: slice, axis=0) -> FrameOrSeries:
38313830
return result
38323831

38333832
@final
3834-
def _set_is_copy(self, ref, copy: bool_t = True) -> None:
3833+
def _set_is_copy(self, ref: FrameOrSeries, copy: bool_t = True) -> None:
38353834
if not copy:
38363835
self._is_copy = None
38373836
else:

pandas/core/series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ def _constructor_expanddim(self) -> Type[DataFrame]:
412412
def _can_hold_na(self) -> bool:
413413
return self._mgr._can_hold_na
414414

415-
_index = None
415+
_index: Optional[Index] = None
416416

417417
def _set_axis(self, axis: int, labels, fastpath: bool = False) -> None:
418418
"""

pandas/io/excel/_base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,6 @@ def __new__(cls, path, engine=None, **kwargs):
747747
return object.__new__(cls)
748748

749749
# declare external properties you can count on
750-
curr_sheet = None
751750
path = None
752751

753752
@property

pandas/io/excel/_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from typing import List
1+
from typing import List, MutableMapping
22

33
from pandas.compat._optional import import_optional_dependency
44

55
from pandas.core.dtypes.common import is_integer, is_list_like
66

7-
_writers = {}
7+
_writers: MutableMapping[str, str] = {}
88

99

1010
def register_writer(klass):

pandas/io/sql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DatabaseError(IOError):
3535
# -----------------------------------------------------------------------------
3636
# -- Helper functions
3737

38-
_SQLALCHEMY_INSTALLED = None
38+
_SQLALCHEMY_INSTALLED: Optional[bool] = None
3939

4040

4141
def _is_sqlalchemy_connectable(con):

0 commit comments

Comments
 (0)