Skip to content

TYP, CLN annotate some variables, remove some possibly unused ones #39466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pandas/_config/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

import locale
import sys
from typing import Optional

from pandas._config import config as cf

# -----------------------------------------------------------------------------
# Global formatting options
_initial_defencoding = None
_initial_defencoding: Optional[str] = None


def detect_console_encoding() -> str:
Expand Down
10 changes: 6 additions & 4 deletions pandas/core/computation/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

"""
import operator
from typing import List, Set
from typing import List, Optional, Set
import warnings

import numpy as np

from pandas._config import get_option

from pandas._typing import FuncType

from pandas.core.dtypes.generic import ABCDataFrame

from pandas.core.computation.check import NUMEXPR_INSTALLED
Expand All @@ -21,11 +23,11 @@
if NUMEXPR_INSTALLED:
import numexpr as ne

_TEST_MODE = None
_TEST_MODE: Optional[bool] = None
_TEST_RESULT: List[bool] = []
USE_NUMEXPR = NUMEXPR_INSTALLED
_evaluate = None
_where = None
_evaluate: Optional[FuncType] = None
_where: Optional[FuncType] = None

# the set of dtypes that we will allow pass to numexpr
_ALLOWED_DTYPES = {
Expand Down
5 changes: 2 additions & 3 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class NDFrame(PandasObject, SelectionMixin, indexing.IndexingMixin):
["_AXIS_NAMES", "_AXIS_NUMBERS", "get_values", "tshift"]
)
_metadata: List[str] = []
_is_copy = None
_is_copy: Optional[weakref.ReferenceType[NDFrame]] = None
_mgr: Manager
_attrs: Dict[Optional[Hashable], Any]
_typ: str
Expand Down Expand Up @@ -389,7 +389,6 @@ def _data(self):
# Axis
_stat_axis_number = 0
_stat_axis_name = "index"
_ix = None
_AXIS_ORDERS: List[str]
_AXIS_TO_AXIS_NUMBER: Dict[Axis, int] = {0: 0, "index": 0, "rows": 0}
_AXIS_REVERSED: bool
Expand Down Expand Up @@ -3815,7 +3814,7 @@ def _slice(self: FrameOrSeries, slobj: slice, axis=0) -> FrameOrSeries:
return result

@final
def _set_is_copy(self, ref, copy: bool_t = True) -> None:
def _set_is_copy(self, ref: FrameOrSeries, copy: bool_t = True) -> None:
if not copy:
self._is_copy = None
else:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def _constructor_expanddim(self) -> Type[DataFrame]:
def _can_hold_na(self) -> bool:
return self._mgr._can_hold_na

_index = None
_index: Optional[Index] = None

def _set_axis(self, axis: int, labels, fastpath: bool = False) -> None:
"""
Expand Down
1 change: 0 additions & 1 deletion pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,6 @@ def __new__(cls, path, engine=None, **kwargs):
return object.__new__(cls)

# declare external properties you can count on
curr_sheet = None
path = None

@property
Expand Down
4 changes: 2 additions & 2 deletions pandas/io/excel/_util.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import List
from typing import List, MutableMapping

from pandas.compat._optional import import_optional_dependency

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

_writers = {}
_writers: MutableMapping[str, str] = {}


def register_writer(klass):
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DatabaseError(IOError):
# -----------------------------------------------------------------------------
# -- Helper functions

_SQLALCHEMY_INSTALLED = None
_SQLALCHEMY_INSTALLED: Optional[bool] = None


def _is_sqlalchemy_connectable(con):
Expand Down