Python pickle._loads() Examples
The following are 5 code examples for showing how to use pickle._loads(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
You may check out the related API usage on the sidebar.
You may also want to check out all available functions/classes of the module
pickle
, or try the search function
.
Example 1
Project: android_universal Author: bkerler File: test_descr.py License: MIT License | 7 votes |
def _generate_pickle_copiers(): """Utility method to generate the many possible pickle configurations. """ class PickleCopier: "This class copies object using pickle." def __init__(self, proto, dumps, loads): self.proto = proto self.dumps = dumps self.loads = loads def copy(self, obj): return self.loads(self.dumps(obj, self.proto)) def __repr__(self): # We try to be as descriptive as possible here since this is # the string which we will allow us to tell the pickle # configuration we are using during debugging. return ("PickleCopier(proto={}, dumps={}.{}, loads={}.{})" .format(self.proto, self.dumps.__module__, self.dumps.__qualname__, self.loads.__module__, self.loads.__qualname__)) return (PickleCopier(*args) for args in itertools.product(range(pickle.HIGHEST_PROTOCOL + 1), {pickle.dumps, pickle._dumps}, {pickle.loads, pickle._loads}))
Example 2
Project: Fluid-Designer Author: Microvellum File: test_descr.py License: GNU General Public License v3.0 | 6 votes |
def _generate_pickle_copiers(): """Utility method to generate the many possible pickle configurations. """ class PickleCopier: "This class copies object using pickle." def __init__(self, proto, dumps, loads): self.proto = proto self.dumps = dumps self.loads = loads def copy(self, obj): return self.loads(self.dumps(obj, self.proto)) def __repr__(self): # We try to be as descriptive as possible here since this is # the string which we will allow us to tell the pickle # configuration we are using during debugging. return ("PickleCopier(proto={}, dumps={}.{}, loads={}.{})" .format(self.proto, self.dumps.__module__, self.dumps.__qualname__, self.loads.__module__, self.loads.__qualname__)) return (PickleCopier(*args) for args in itertools.product(range(pickle.HIGHEST_PROTOCOL + 1), {pickle.dumps, pickle._dumps}, {pickle.loads, pickle._loads}))
Example 3
Project: ironpython3 Author: IronLanguages File: test_descr.py License: Apache License 2.0 | 6 votes |
def _generate_pickle_copiers(): """Utility method to generate the many possible pickle configurations. """ class PickleCopier: "This class copies object using pickle." def __init__(self, proto, dumps, loads): self.proto = proto self.dumps = dumps self.loads = loads def copy(self, obj): return self.loads(self.dumps(obj, self.proto)) def __repr__(self): # We try to be as descriptive as possible here since this is # the string which we will allow us to tell the pickle # configuration we are using during debugging. return ("PickleCopier(proto={}, dumps={}.{}, loads={}.{})" .format(self.proto, self.dumps.__module__, self.dumps.__qualname__, self.loads.__module__, self.loads.__qualname__)) return (PickleCopier(*args) for args in itertools.product(range(pickle.HIGHEST_PROTOCOL + 1), {pickle.dumps, pickle._dumps}, {pickle.loads, pickle._loads}))
Example 4
Project: Project-New-Reign---Nemesis-Main Author: ShikyoKira File: test_descr.py License: GNU General Public License v3.0 | 6 votes |
def _generate_pickle_copiers(): """Utility method to generate the many possible pickle configurations. """ class PickleCopier: "This class copies object using pickle." def __init__(self, proto, dumps, loads): self.proto = proto self.dumps = dumps self.loads = loads def copy(self, obj): return self.loads(self.dumps(obj, self.proto)) def __repr__(self): # We try to be as descriptive as possible here since this is # the string which we will allow us to tell the pickle # configuration we are using during debugging. return ("PickleCopier(proto={}, dumps={}.{}, loads={}.{})" .format(self.proto, self.dumps.__module__, self.dumps.__qualname__, self.loads.__module__, self.loads.__qualname__)) return (PickleCopier(*args) for args in itertools.product(range(pickle.HIGHEST_PROTOCOL + 1), {pickle.dumps, pickle._dumps}, {pickle.loads, pickle._loads}))
Example 5
Project: PySyncObj Author: bakwc File: pickle.py License: MIT License | 5 votes |
def loads(data): data = to_bytes(data) try: return pickle.loads(data) except: if is_py3: return pickle._loads(data) raise