Belle II Software  release-05-02-19
information.py
1 import os
2 import re
3 
5 from hep_ipython_tools.information import EnvironmentInformation
6 
7 
9 
10  """
11  Helper class for accessing the information about ipython_handler_basf2
12  from the environment variables.
13  """
14 
15  def __init__(self):
16  """
17  Get the variables from the environment variables.
18  """
19  super().__init__()
20 
21 
22  self.externals_version = os.environ.get("BELLE2_EXTERNALS_VERSION")
23 
24  self.externals_option = os.environ.get("BELLE2_EXTERNALS_OPTION")
25 
26  self.option = os.environ.get("BELLE2_OPTION")
27 
28  self.architecture = os.environ.get("BELLE2_ARCH")
29 
30  self.release = os.environ.get("BELLE2_RELEASE")
31 
32  self.release_folder = os.environ.get("BELLE2_LOCAL_DIR")
33 
34 
36  """
37  A helper class to perform module lookup.
38  """
39 
40  def __init__(self):
41  """
42  Initialize with the module list from the framework.
43  """
44  from basf2 import list_available_modules
45 
46  self.module_list = list_available_modules()
47 
48  def search(self, regex_string):
49  """
50  Search for a given module. You can give ane regular expression you like.
51  The results will be printed as a nice tabbed view with the modules and their parameters
52  and descriptions.
53  """
54  def filter_modules():
55  for module_name in self.module_list:
56  if re.search(regex_string, module_name):
57  yield module_name
58 
59  v = hep_ipython_tools.ipython_handler_basf2.viewer.PathViewer(filter_modules(), standalone=True)
60  v.show()
hep_ipython_tools.information.EnvironmentInformation.release
release
Release version.
Definition: information.py:25
hep_ipython_tools.information.EnvironmentInformation
Definition: information.py:6
hep_ipython_tools.information.EnvironmentInformation.externals_version
externals_version
Externals version.
Definition: information.py:17
hep_ipython_tools.information.EnvironmentInformation.architecture
architecture
OS.
Definition: information.py:23
hep_ipython_tools.ipython_handler_basf2.information.Basf2ModulesInformation.module_list
module_list
A cached module list for faster lookup.
Definition: information.py:46
hep_ipython_tools.ipython_handler_basf2.viewer
Definition: viewer.py:1
hep_ipython_tools.information.EnvironmentInformation.externals_option
externals_option
Compile options of externals.
Definition: information.py:19
hep_ipython_tools.ipython_handler_basf2.information.Basf2ModulesInformation
Definition: information.py:35
hep_ipython_tools.information.EnvironmentInformation.release_folder
release_folder
Release folder.
Definition: information.py:27
hep_ipython_tools.ipython_handler_basf2.information.Basf2EnvironmentInformation.__init__
def __init__(self)
Definition: information.py:15
hep_ipython_tools.ipython_handler_basf2.information.Basf2ModulesInformation.search
def search(self, regex_string)
Definition: information.py:48
hep_ipython_tools.ipython_handler_basf2.information.Basf2EnvironmentInformation
Definition: information.py:8
hep_ipython_tools.ipython_handler_basf2.information.Basf2ModulesInformation.__init__
def __init__(self)
Definition: information.py:40
hep_ipython_tools.information
Definition: information.py:1
hep_ipython_tools.ipython_handler_basf2.viewer.PathViewer
Definition: viewer.py:32
hep_ipython_tools.information.EnvironmentInformation.option
option
Compile options.
Definition: information.py:21