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

Replace use of sweet_pickle in naming, and delete sweet_pickle subpackage #199

Merged
merged 18 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 0 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ that is commonly needed by many applications
listener of selected items in an application.
- **apptools.scripting**: A framework for automatic recording of Python
scripts.
- **apptools.sweet_pickle**: Handles class-level versioning, to support
loading of saved data that exist over several generations of internal class
structures.
- **apptools.type_manager**: Manages type extensions, including factories
to generate adapters, and hooks for methods and functions.
- **apptools.undo**: Supports undoing and scripting application commands.
Expand Down
13 changes: 4 additions & 9 deletions apptools/naming/object_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
import logging
from traceback import print_exc
from os.path import splitext
#import cPickle
#import pickle
import pickle

# Enthought library imports.
import apptools.sweet_pickle as sweet_pickle
from apptools.persistence.versioned_unpickler import VersionedUnpickler
from traits.api import HasTraits, Str


Expand Down Expand Up @@ -56,9 +55,7 @@ def load(self, path):
f = open(path, 'rb')
try:
try:
obj = sweet_pickle.load(f)
# obj = cPickle.load(f)
# obj = pickle.load(f)
obj = VersionedUnpickler(f).load()
except Exception as ex:
print_exc()
logger.exception( "Failed to load pickle file: %s, %s" % (path, ex))
Expand Down Expand Up @@ -86,9 +83,7 @@ def save(self, path, obj):
# Pickle the object.
f = open(actual_path, 'wb')
try:
sweet_pickle.dump(obj, f, 1)
# cPickle.dump(obj, f, 1)
# pickle.dump(obj, f, 1)
pickle.dump(obj, f, 1)
kitchoi marked this conversation as resolved.
Show resolved Hide resolved
except Exception as ex:
logger.exception( "Failed to pickle into file: %s, %s, object:%s"
% (path, ex, obj))
Expand Down
4 changes: 3 additions & 1 deletion apptools/persistence/versioned_unpickler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Standard library imports
from pickle import *
from pickle import _Unpickler as Unpickler
kitchoi marked this conversation as resolved.
Show resolved Hide resolved
from pickle import UnpicklingError, BUILD
import logging
from types import GeneratorType, MethodType

Expand Down Expand Up @@ -82,6 +83,7 @@ def initialize(self, max_pass):
# point, we would have the dispatch still pointing to
# NewPickler.load_build whereas the object being passed in will be an
# Unpickler instance, causing a TypeError.
@classmethod
def load_build(cls, obj):
# Just save the instance in the list of objects.
if isinstance(obj, NewUnpickler):
Expand Down
8 changes: 0 additions & 8 deletions apptools/sweet_pickle/README.txt

This file was deleted.

168 changes: 0 additions & 168 deletions apptools/sweet_pickle/__init__.py

This file was deleted.

99 changes: 0 additions & 99 deletions apptools/sweet_pickle/global_registry.py

This file was deleted.

25 changes: 0 additions & 25 deletions apptools/sweet_pickle/placeholder.py

This file was deleted.

1 change: 0 additions & 1 deletion apptools/sweet_pickle/tests/__init__.py

This file was deleted.

21 changes: 0 additions & 21 deletions apptools/sweet_pickle/tests/class_mapping_classes.py

This file was deleted.

Loading