Read a pickled object representation from the open file. Return the reconstituted object hierarchy specified in the file.
(self)
| 1324 | self.fix_imports = fix_imports |
| 1325 | |
| 1326 | def load(self): |
| 1327 | """Read a pickled object representation from the open file. |
| 1328 | |
| 1329 | Return the reconstituted object hierarchy specified in the file. |
| 1330 | """ |
| 1331 | # Check whether Unpickler was initialized correctly. This is |
| 1332 | # only needed to mimic the behavior of _pickle.Unpickler.dump(). |
| 1333 | if not hasattr(self, "_file_read"): |
| 1334 | raise UnpicklingError("Unpickler.__init__() was not called by " |
| 1335 | "%s.__init__()" % (self.__class__.__name__,)) |
| 1336 | self._unframer = _Unframer(self._file_read, self._file_readline) |
| 1337 | self.read = self._unframer.read |
| 1338 | self.readinto = self._unframer.readinto |
| 1339 | self.readline = self._unframer.readline |
| 1340 | self.metastack = [] |
| 1341 | self.stack = [] |
| 1342 | self.append = self.stack.append |
| 1343 | self.proto = 0 |
| 1344 | read = self.read |
| 1345 | dispatch = self.dispatch |
| 1346 | try: |
| 1347 | while True: |
| 1348 | key = read(1) |
| 1349 | if not key: |
| 1350 | raise EOFError |
| 1351 | assert isinstance(key, bytes_types) |
| 1352 | dispatch[key[0]](self) |
| 1353 | except _Stop as stopinst: |
| 1354 | return stopinst.value |
| 1355 | |
| 1356 | # Return a list of items pushed in the stack after last MARK instruction. |
| 1357 | def pop_mark(self): |
no test coverage detected