Skip to content
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

Pickling tsgroup #315

Merged
merged 2 commits into from
Jul 15, 2024
Merged

Pickling tsgroup #315

merged 2 commits into from
Jul 15, 2024

Conversation

BalzaniEdoardo
Copy link
Collaborator

Description

This PR solves the issue of infinite recursion for the pickling of "TsGroup".

Raises an error if __getattr__ is called by the __reduce__ and __reduce_ex__ methods.

These are attributes of the pandas.Index, which are the column names of the metadata, that would be called by captured by the __getattr__ implementation otherwise, generating an infinite recursion.

New Capability

This two line now do not generate an infinite recursion.

import pickle
#...assume tsgroup is a TsGroup
pickled_tsgroup = pickle.dumps(tsgroup)
unpickled_tsgroup = pickle.loads(pickled_tsgroup)

@BalzaniEdoardo BalzaniEdoardo requested a review from gviejo as a code owner July 15, 2024 18:39
@BalzaniEdoardo BalzaniEdoardo changed the base branch from main to dev July 15, 2024 18:39
Copy link

codecov bot commented Jul 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
pynapple/core/ts_group.py 92.05% <100.00%> (+0.03%) ⬆️

@gviejo
Copy link
Contributor

gviejo commented Jul 15, 2024

Favoloso!

@gviejo gviejo merged commit e66c428 into dev Jul 15, 2024
12 checks passed
@gviejo gviejo deleted the pickling_tsgroup branch July 15, 2024 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants