Skip to content

Fix type annotation for pandas.core.generic.py #25909

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 9 commits into from
Apr 16, 2019
6 changes: 0 additions & 6 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ ignore_errors=True
[mypy-pandas.core.config_init]
ignore_errors=True

[mypy-pandas.core.frame]
ignore_errors=True

[mypy-pandas.core.generic]
ignore_errors=True

[mypy-pandas.core.groupby.generic]
ignore_errors=True

Expand Down
11 changes: 6 additions & 5 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import sys
import warnings
from textwrap import dedent
from typing import List, Optional, Union
from typing import FrozenSet, List, Optional, Set, Type, Union

import numpy as np
import numpy.ma as ma
Expand Down Expand Up @@ -360,10 +360,11 @@ class DataFrame(NDFrame):
def _constructor(self):
return DataFrame

_constructor_sliced = Series
_deprecations = NDFrame._deprecations | frozenset(
['get_value', 'set_value', 'from_csv', 'from_items'])
_accessors = set()
_constructor_sliced = Series # type: Type[Series]
_deprecations = NDFrame._deprecations | frozenset([
'get_value', 'set_value', 'from_csv', 'from_items'
]) # type: FrozenSet[str]
_accessors = set() # type: Set[str]

@property
def _constructor_expanddim(self):
Expand Down
14 changes: 8 additions & 6 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import operator
import pickle
from textwrap import dedent
from typing import FrozenSet, List, Set
import warnings
import weakref

Expand Down Expand Up @@ -108,12 +109,13 @@ class NDFrame(PandasObject, SelectionMixin):
_internal_names = ['_data', '_cacher', '_item_cache', '_cache', '_is_copy',
'_subtyp', '_name', '_index', '_default_kind',
'_default_fill_value', '_metadata', '__array_struct__',
'__array_interface__']
_internal_names_set = set(_internal_names)
_accessors = frozenset()
_deprecations = frozenset(['as_blocks', 'blocks',
'convert_objects', 'is_copy'])
_metadata = []
'__array_interface__'] # type: List[str]
_internal_names_set = set(_internal_names) # type: Set[str]
_accessors = set() # type: Set[str]
_deprecations = frozenset([
'as_blocks', 'blocks', 'convert_objects', 'is_copy'
]) # type: FrozenSet[str]
_metadata = [] # type: List[str]
_is_copy = None

# ----------------------------------------------------------------------
Expand Down