Skip to content

Commit ff51bc7

Browse files
vaibhavhrtyhaque1213
authored andcommitted
Fix type annotation for pandas.core.generic.py (pandas-dev#25909)
1 parent f8bc4c5 commit ff51bc7

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

mypy.ini

-6
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ ignore_errors=True
5959
[mypy-pandas.core.config_init]
6060
ignore_errors=True
6161

62-
[mypy-pandas.core.frame]
63-
ignore_errors=True
64-
65-
[mypy-pandas.core.generic]
66-
ignore_errors=True
67-
6862
[mypy-pandas.core.groupby.generic]
6963
ignore_errors=True
7064

pandas/core/frame.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import sys
1717
import warnings
1818
from textwrap import dedent
19-
from typing import List, Optional, Union
19+
from typing import FrozenSet, List, Optional, Set, Type, Union
2020

2121
import numpy as np
2222
import numpy.ma as ma
@@ -360,10 +360,11 @@ class DataFrame(NDFrame):
360360
def _constructor(self):
361361
return DataFrame
362362

363-
_constructor_sliced = Series
364-
_deprecations = NDFrame._deprecations | frozenset(
365-
['get_value', 'set_value', 'from_csv', 'from_items'])
366-
_accessors = set()
363+
_constructor_sliced = Series # type: Type[Series]
364+
_deprecations = NDFrame._deprecations | frozenset([
365+
'get_value', 'set_value', 'from_csv', 'from_items'
366+
]) # type: FrozenSet[str]
367+
_accessors = set() # type: Set[str]
367368

368369
@property
369370
def _constructor_expanddim(self):

pandas/core/generic.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import operator
77
import pickle
88
from textwrap import dedent
9+
from typing import FrozenSet, List, Set
910
import warnings
1011
import weakref
1112

@@ -108,12 +109,13 @@ class NDFrame(PandasObject, SelectionMixin):
108109
_internal_names = ['_data', '_cacher', '_item_cache', '_cache', '_is_copy',
109110
'_subtyp', '_name', '_index', '_default_kind',
110111
'_default_fill_value', '_metadata', '__array_struct__',
111-
'__array_interface__']
112-
_internal_names_set = set(_internal_names)
113-
_accessors = frozenset()
114-
_deprecations = frozenset(['as_blocks', 'blocks',
115-
'convert_objects', 'is_copy'])
116-
_metadata = []
112+
'__array_interface__'] # type: List[str]
113+
_internal_names_set = set(_internal_names) # type: Set[str]
114+
_accessors = set() # type: Set[str]
115+
_deprecations = frozenset([
116+
'as_blocks', 'blocks', 'convert_objects', 'is_copy'
117+
]) # type: FrozenSet[str]
118+
_metadata = [] # type: List[str]
117119
_is_copy = None
118120

119121
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)