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

Refresh layout pickles #472

Merged
merged 3 commits into from
Jun 7, 2022
Merged

Refresh layout pickles #472

merged 3 commits into from
Jun 7, 2022

Conversation

mdickinson
Copy link
Member

This PR refreshes the two layout pickle files, by simply reading and then writing them again with Traits 6.3.2. This has the effect of changing the module used for importing TraitListObject from traits.trait_handlers to traits.trait_list_object.

Should fix #471.

For the record, here's the transcript of the session used to re-create the pickles:

Pickle re-recreation
mdickinson@mirzakhani data % python
Enthought Deployment Manager -- https://www.enthought.com
Python 3.6.13 |Enthought, Inc. (x86_64)| (default, Apr 13 2021, 19:22:11) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import traits
>>> traits.__version__
'6.3.2'
>>> import os
>>> os.listdir(".")
['application_memento_v3.pkl', 'application_memento_v2.pkl']
>>> pkls = os.listdir(".")
>>> import pathlib, pickle
>>> p = pathlib.Path(pkls[0])
>>> p.read_bytes()
b'\x80\x03cenvisage.ui.tasks.tasks_application\nTasksApplicationState\nq\x00)\x81q\x01}q\x02(X\x17\x00\x00\x00previous_window_layoutsq\x03ctraits.trait_handlers\nTraitListObject\nq\x04)\x81q\x05cpyface.tasks.task_window_layout\nTaskWindowLayout\nq\x06)\x81q\x07}q\x08(X\x0b\x00\x00\x00active_taskq\tX\x00\x00\x00\x00q\nX\x05\x00\x00\x00itemsq\x0bh\x04)\x81q\x0c}q\r(X\x04\x00\x00\x00nameq\x0eh\x0bX\n\x00\x00\x00name_itemsq\x0fX\x0b\x00\x00\x00items_itemsq\x10ubX\x08\x00\x00\x00positionq\x11J\xff\xff\xff\xffJ\xff\xff\xff\xff\x86q\x12X\x04\x00\x00\x00sizeq\x13M\xec\x01M\xe7\x02\x86q\x14X\n\x00\x00\x00size_stateq\x15X\x06\x00\x00\x00normalq\x16X\x12\x00\x00\x00__traits_version__q\x17X\x05\x00\x00\x005.1.2q\x18uba}q\x19(h\x0eh\x03h\x0fX\x1d\x00\x00\x00previous_window_layouts_itemsq\x1aubX\x0e\x00\x00\x00window_layoutsq\x1bh\x04)\x81q\x1c}q\x1d(h\x0eh\x1bh\x0fX\x14\x00\x00\x00window_layouts_itemsq\x1eubX\x07\x00\x00\x00versionq\x1fK\x01h\x17h\x18ub.'
>>> pickle.loads(p.read_bytes())
<envisage.ui.tasks.tasks_application.TasksApplicationState object at 0x7fcc1042e678>
>>> pickle.dumps(pickle.loads(p.read_bytes()))
b'\x80\x03cenvisage.ui.tasks.tasks_application\nTasksApplicationState\nq\x00)\x81q\x01}q\x02(X\x17\x00\x00\x00previous_window_layoutsq\x03ctraits.trait_list_object\nTraitListObject\nq\x04)\x81q\x05cpyface.tasks.task_window_layout\nTaskWindowLayout\nq\x06)\x81q\x07}q\x08(X\x0b\x00\x00\x00active_taskq\tX\x00\x00\x00\x00q\nX\x05\x00\x00\x00itemsq\x0bh\x04)\x81q\x0c}q\r(X\x0e\x00\x00\x00item_validatorq\x0ecbuiltins\ngetattr\nq\x0fh\x0cX\x0f\x00\x00\x00_item_validatorq\x10\x86q\x11Rq\x12X\x04\x00\x00\x00nameq\x13h\x0bX\n\x00\x00\x00name_itemsq\x14X\x0b\x00\x00\x00items_itemsq\x15ubX\x08\x00\x00\x00positionq\x16J\xff\xff\xff\xffJ\xff\xff\xff\xff\x86q\x17X\x04\x00\x00\x00sizeq\x18M\xec\x01M\xe7\x02\x86q\x19X\n\x00\x00\x00size_stateq\x1aX\x06\x00\x00\x00normalq\x1bX\x12\x00\x00\x00__traits_version__q\x1cX\x05\x00\x00\x006.3.2q\x1duba}q\x1e(h\x0eh\x0fh\x05h\x10\x86q\x1fRq h\x13h\x03h\x14X\x1d\x00\x00\x00previous_window_layouts_itemsq!ubX\x0e\x00\x00\x00window_layoutsq"h\x04)\x81q#}q$(h\x0eh\x0fh#h\x10\x86q%Rq&h\x13h"h\x14X\x14\x00\x00\x00window_layouts_itemsq\'ubX\x07\x00\x00\x00versionq(K\x01h\x1ch\x1dub.'
>>> p.write_bytes(pickle.dumps(pickle.loads(p.read_bytes())))
660
>>> p = pathlib.Path(pkls[1])
>>> p.read_bytes()
b'\x80\x02cenvisage.ui.tasks.tasks_application\nTasksApplicationState\nq\x00)\x81q\x01}q\x02(X\x17\x00\x00\x00previous_window_layoutsq\x03ctraits.trait_handlers\nTraitListObject\nq\x04)\x81q\x05cpyface.tasks.task_window_layout\nTaskWindowLayout\nq\x06)\x81q\x07}q\x08(X\x0b\x00\x00\x00active_taskq\tX\x00\x00\x00\x00q\nX\x05\x00\x00\x00itemsq\x0bh\x04)\x81q\x0c}q\r(X\x04\x00\x00\x00nameq\x0eh\x0bX\n\x00\x00\x00name_itemsq\x0fX\x0b\x00\x00\x00items_itemsq\x10ubX\x08\x00\x00\x00positionq\x11J\xff\xff\xff\xffJ\xff\xff\xff\xff\x86q\x12X\x04\x00\x00\x00sizeq\x13M\xec\x01M\xe7\x02\x86q\x14X\n\x00\x00\x00size_stateq\x15X\x06\x00\x00\x00normalq\x16X\x12\x00\x00\x00__traits_version__q\x17X\x05\x00\x00\x005.1.2q\x18uba}q\x19(h\x0eh\x03h\x0fX\x1d\x00\x00\x00previous_window_layouts_itemsq\x1aubX\x0e\x00\x00\x00window_layoutsq\x1bh\x04)\x81q\x1c}q\x1d(h\x0eh\x1bh\x0fX\x14\x00\x00\x00window_layouts_itemsq\x1eubX\x07\x00\x00\x00versionq\x1fK\x01h\x17h\x18ub.'
>>> p.write_bytes(pickle.dumps(pickle.loads(p.read_bytes()), protocol=2))
663
>>> p.read_bytes()
b'\x80\x02cenvisage.ui.tasks.tasks_application\nTasksApplicationState\nq\x00)\x81q\x01}q\x02(X\x17\x00\x00\x00previous_window_layoutsq\x03ctraits.trait_list_object\nTraitListObject\nq\x04)\x81q\x05cpyface.tasks.task_window_layout\nTaskWindowLayout\nq\x06)\x81q\x07}q\x08(X\x0b\x00\x00\x00active_taskq\tX\x00\x00\x00\x00q\nX\x05\x00\x00\x00itemsq\x0bh\x04)\x81q\x0c}q\r(X\x0e\x00\x00\x00item_validatorq\x0ec__builtin__\ngetattr\nq\x0fh\x0cX\x0f\x00\x00\x00_item_validatorq\x10\x86q\x11Rq\x12X\x04\x00\x00\x00nameq\x13h\x0bX\n\x00\x00\x00name_itemsq\x14X\x0b\x00\x00\x00items_itemsq\x15ubX\x08\x00\x00\x00positionq\x16J\xff\xff\xff\xffJ\xff\xff\xff\xff\x86q\x17X\x04\x00\x00\x00sizeq\x18M\xec\x01M\xe7\x02\x86q\x19X\n\x00\x00\x00size_stateq\x1aX\x06\x00\x00\x00normalq\x1bX\x12\x00\x00\x00__traits_version__q\x1cX\x05\x00\x00\x006.3.2q\x1duba}q\x1e(h\x0eh\x0fh\x05h\x10\x86q\x1fRq h\x13h\x03h\x14X\x1d\x00\x00\x00previous_window_layouts_itemsq!ubX\x0e\x00\x00\x00window_layoutsq"h\x04)\x81q#}q$(h\x0eh\x0fh#h\x10\x86q%Rq&h\x13h"h\x14X\x14\x00\x00\x00window_layouts_itemsq\'ubX\x07\x00\x00\x00versionq(K\x01h\x1ch\x1dub.'

@mdickinson mdickinson requested a review from rahulporuri June 7, 2022 09:35
Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@mdickinson
Copy link
Member Author

Thanks, @rahulporuri. I've sneakily added to this PR after you approved it, adding (a) a script that regenerates the pickles (on my machine, the generated pickled are byte-for-byte identical with the existing .pkl files), and (b) a README.md for this directory.

Will merge when CI approves, and then retry the cron job.

@mdickinson mdickinson merged commit dc65180 into main Jun 7, 2022
@mdickinson mdickinson deleted the fix/refresh-layout-pickles branch June 7, 2022 10:10
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.

test_layout_load fails with ETS master
2 participants