Skip to content

TYP: PandasObject._cache #32775

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 1 commit into from
Mar 19, 2020
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
6 changes: 4 additions & 2 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import builtins
import textwrap
from typing import Dict, FrozenSet, List, Optional, Union
from typing import Any, Dict, FrozenSet, List, Optional, Union

import numpy as np

Expand Down Expand Up @@ -49,6 +49,8 @@ class PandasObject(DirNamesMixin):
Baseclass for various pandas objects.
"""

_cache: Dict[str, Any]

@property
def _constructor(self):
"""
Expand All @@ -63,7 +65,7 @@ def __repr__(self) -> str:
# Should be overwritten by base classes
return object.__repr__(self)

def _reset_cache(self, key=None):
def _reset_cache(self, key: Optional[str] = None) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we ever actually pass a key?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Twice, both times in groupby/groupby.py.

"""
Reset cached properties. If ``key`` is passed, only clears that key.
"""
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
import operator
from textwrap import dedent
from typing import TYPE_CHECKING, Any, Dict, FrozenSet, Hashable, Union
from typing import TYPE_CHECKING, Any, FrozenSet, Hashable, Union
import warnings

import numpy as np
Expand Down Expand Up @@ -250,7 +250,6 @@ def _outer_indexer(self, left, right):

_typ = "index"
_data: Union[ExtensionArray, np.ndarray]
_cache: Dict[str, Any]
_id = None
_name: Label = None
# MultiIndex.levels previously allowed setting the index name. We
Expand Down