Belle II Software  release-08-01-10
information.py
1 
8 
9 import os
10 import re
11 
13 from hep_ipython_tools.information import EnvironmentInformation
14 
15 
17 
18  """
19  Helper class for accessing the information about ipython_handler_basf2
20  from the environment variables.
21  """
22 
23  def __init__(self):
24  """
25  Get the variables from the environment variables.
26  """
27  super().__init__()
28 
29 
30  self.externals_versionexternals_versionexternals_version = os.environ.get("BELLE2_EXTERNALS_VERSION")
31 
32  self.externals_optionexternals_optionexternals_option = os.environ.get("BELLE2_EXTERNALS_OPTION")
33 
34  self.optionoptionoption = os.environ.get("BELLE2_OPTION")
35 
36  self.architecturearchitecturearchitecture = os.environ.get("BELLE2_ARCH")
37 
38  self.releasereleaserelease = os.environ.get("BELLE2_RELEASE")
39 
40  self.release_folderrelease_folderrelease_folder = os.environ.get("BELLE2_LOCAL_DIR")
41 
42 
44  """
45  A helper class to perform module lookup.
46  """
47 
48  def __init__(self):
49  """
50  Initialize with the module list from the framework.
51  """
52  from basf2 import list_available_modules
53 
54  self.module_listmodule_list = list_available_modules()
55 
56  def search(self, regex_string):
57  """
58  Search for a given module. You can give ane regular expression you like.
59  The results will be printed as a nice tabbed view with the modules and their parameters
60  and descriptions.
61  """
62  def filter_modules():
63  for module_name in self.module_listmodule_list:
64  if re.search(regex_string, module_name):
65  yield module_name
66 
67  v = hep_ipython_tools.ipython_handler_basf2.viewer.PathViewer(filter_modules(), standalone=True)
68  v.show()