Belle II Software  release-08-01-10
calculation.py
1 
8 from hep_ipython_tools.calculation import Calculation
9 
10 from hep_ipython_tools.ipython_handler_basf2.calculation_process import Basf2CalculationProcess
12 
13 
15  """
16  Overloaded class with more functionality which is ipython_handler_basf2 specific:
17  * Access the path and the module
18  * Create basf2 calculations
19  * Use the basf2 widgets
20  """
21 
22  def __init__(self):
23  """Create a new basf2 calculation mostly overloading the standard calculation."""
24  super().__init__()
25 
26 
27  self._calculation_process_type_calculation_process_type_calculation_process_type = Basf2CalculationProcess
28 
29  def show_path(self, index=None):
30  """
31  Show the underlaying ipython_handler_basf2 path in an interactive way
32  """
33  def f(process):
34  if process.path is not None:
35  return viewer.PathViewer(process.path)
36  else:
37  return None
38 
39  self.create_widgets_for_all_processescreate_widgets_for_all_processes(f, index)
40 
41  def get_modules(self, index=None):
42  """
43  Return the modules in the given path.
44  """
45  return self.map_on_processesmap_on_processes(lambda process: process.path.modules() if process.path is not None else None, index)
46 
47  def show_dependencies(self, index=None):
48  """
49  Show the dependencies among the data store entries.
50  """
51  def f(process):
52  dependency_JSON = process.get("ipython.dependencies")
53  if dependency_JSON:
54  return viewer.DependencyViewer(dependency_JSON)
55  else:
56  return None
57 
58  self.create_widgets_for_all_processescreate_widgets_for_all_processes(f, index)
_calculation_process_type
The calculation process type to use.
Definition: calculation.py:36
def map_on_processes(self, map_function, index)
Definition: calculation.py:207
def create_widgets_for_all_processes(self, widget_function, index=None)
Definition: calculation.py:298
_calculation_process_type
Override the calculation process type with the basf2 one.
Definition: calculation.py:27