Read a pickled object representation from the open file. Return the reconstituted object hierarchy specified in the file.
(self)
| 1185 | self.fix_imports = fix_imports |
| 1186 | |
| 1187 | def load(self): |
| 1188 | """Read a pickled object representation from the open file. |
| 1189 | |
| 1190 | Return the reconstituted object hierarchy specified in the file. |
| 1191 | """ |
| 1192 | # Check whether Unpickler was initialized correctly. This is |
| 1193 | # only needed to mimic the behavior of _pickle.Unpickler.dump(). |
| 1194 | if not hasattr(self, "_file_read"): |
| 1195 | raise UnpicklingError("Unpickler.__init__() was not called by " |
| 1196 | "%s.__init__()" % (self.__class__.__name__,)) |
| 1197 | self._unframer = _Unframer(self._file_read, self._file_readline) |
| 1198 | self.read = self._unframer.read |
| 1199 | self.readinto = self._unframer.readinto |
| 1200 | self.readline = self._unframer.readline |
| 1201 | self.metastack = [] |
| 1202 | self.stack = [] |
| 1203 | self.append = self.stack.append |
| 1204 | self.proto = 0 |
| 1205 | read = self.read |
| 1206 | dispatch = self.dispatch |
| 1207 | try: |
| 1208 | while True: |
| 1209 | key = read(1) |
| 1210 | if not key: |
| 1211 | raise EOFError |
| 1212 | assert isinstance(key, bytes_types) |
| 1213 | dispatch[key[0]](self) |
| 1214 | except _Stop as stopinst: |
| 1215 | return stopinst.value |
| 1216 | |
| 1217 | # Return a list of items pushed in the stack after last MARK instruction. |
| 1218 | def pop_mark(self): |
no test coverage detected