MCPcopy Index your code
hub / github.com/python/cpython / find_class

Method find_class

Lib/pickle.py:1715–1732  ·  view source on GitHub ↗
(self, module, name)

Source from the content-addressed store, hash-verified

1713 self.append(obj)
1714
1715 def find_class(self, module, name):
1716 # Subclasses may override this.
1717 sys.audit('pickle.find_class', module, name)
1718 if self.proto < 3 and self.fix_imports:
1719 if (module, name) in _compat_pickle.NAME_MAPPING:
1720 module, name = _compat_pickle.NAME_MAPPING[(module, name)]
1721 elif module in _compat_pickle.IMPORT_MAPPING:
1722 module = _compat_pickle.IMPORT_MAPPING[module]
1723 __import__(module, level=0)
1724 if self.proto >= 4 and '.' in name:
1725 dotted_path = name.split('.')
1726 try:
1727 return _getattribute(sys.modules[module], dotted_path)
1728 except AttributeError:
1729 raise AttributeError(
1730 f"Can't resolve path {name!r} on module {module!r}")
1731 else:
1732 return getattr(sys.modules[module], name)
1733
1734 def load_reduce(self):
1735 stack = self.stack

Callers 4

load_instMethod · 0.95
load_globalMethod · 0.95
load_stack_globalMethod · 0.95
get_extensionMethod · 0.95

Calls 3

__import__Function · 0.85
_getattributeFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected