r"""Hook that is called internally by the `pickle` module to unpickle a persistent object.
(meta)
| 177 | #---------------------------------------------------------------------------- |
| 178 | |
| 179 | def _reconstruct_persistent_obj(meta): |
| 180 | r"""Hook that is called internally by the `pickle` module to unpickle |
| 181 | a persistent object. |
| 182 | """ |
| 183 | meta = dnnlib.EasyDict(meta) |
| 184 | meta.state = dnnlib.EasyDict(meta.state) |
| 185 | for hook in _import_hooks: |
| 186 | meta = hook(meta) |
| 187 | assert meta is not None |
| 188 | |
| 189 | assert meta.version == _version |
| 190 | module = _src_to_module(meta.module_src) |
| 191 | |
| 192 | assert meta.type == 'class' |
| 193 | orig_class = module.__dict__[meta.class_name] |
| 194 | decorator_class = persistent_class(orig_class) |
| 195 | obj = decorator_class.__new__(decorator_class) |
| 196 | |
| 197 | setstate = getattr(obj, '__setstate__', None) |
| 198 | if callable(setstate): |
| 199 | setstate(meta.state) # pylint: disable=not-callable |
| 200 | else: |
| 201 | obj.__dict__.update(meta.state) |
| 202 | return obj |
| 203 | |
| 204 | #---------------------------------------------------------------------------- |
| 205 |
nothing calls this directly
no test coverage detected