Python pickle._loads() Examples
The following are 5
code examples of pickle._loads().
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 also want to check out all available functions/classes of the module
pickle
, or try the search function
.
Example #1
Source File: test_descr.py From android_universal with 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
Source File: test_descr.py From Fluid-Designer with 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
Source File: test_descr.py From ironpython3 with 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
Source File: test_descr.py From Project-New-Reign---Nemesis-Main with 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
Source File: pickle.py From PySyncObj with 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