Belle II Software development
PickleModule.Unpickler Class Reference
Inheritance diagram for PickleModule.Unpickler:

Public Member Functions

 find_class (self, module, name)
 

Detailed Description

Custom Unpickler that tries to find missing classes in the current global namespace.

This is needed since the move to per-python-mva-method module instances in which the classes live now.

Definition at line 45 of file torch.py.

Member Function Documentation

◆ find_class()

find_class ( self,
module,
name )
If class can't be retrieved the regular way,
try to take from global namespace

Definition at line 51 of file torch.py.

51 def find_class(self, module, name):
52 """
53 If class can't be retrieved the regular way,
54 try to take from global namespace
55 """
56 try:
57 return super().find_class(module, name)
58 except (ModuleNotFoundError, AttributeError):
59 B2INFO(f"Missing class: {module}.{name}")
60 if name in globals():
61 B2INFO(f"Using `{name}` from global namespace")
62 return globals()[name]
63 else:
64 raise
65
66

The documentation for this class was generated from the following file: