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

TYP: PandasObject._cache #32775

merged 1 commit into from
Mar 19, 2020

Conversation

topper-123
Copy link
Contributor

Move _cache: Dict[str, Any] fragment to PandasObject, where it belongs + related changes.

@@ -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.

@topper-123 topper-123 added the Typing type annotations, mypy/pyright type checking label Mar 17, 2020
@topper-123 topper-123 added this to the 1.1 milestone Mar 17, 2020
@WillAyd
Copy link
Member

WillAyd commented Mar 18, 2020

Just out of curiosity why do you think this is better placed in PandasObject?

@topper-123
Copy link
Contributor Author

topper-123 commented Mar 18, 2020

My motivation is to have it set on the same class as _reset_cache is set on, because those two belong logically together. This would also prevent that _cache attribute is set on a child class that is incompatible with _reset_cache.

@jreback jreback merged commit c4aa1a2 into pandas-dev:master Mar 19, 2020
@jreback
Copy link
Contributor

jreback commented Mar 19, 2020

thanks @topper-123

@topper-123 topper-123 deleted the type_cache branch March 21, 2020 11:45
SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Mar 23, 2020
jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants