SND@LHC Software
Loading...
Searching...
No Matches
ShipGeoConfig.ConfigRegistry Class Reference
Inheritance diagram for ShipGeoConfig.ConfigRegistry:
Collaboration diagram for ShipGeoConfig.ConfigRegistry:

Public Member Functions

 __init__ (self)
 
- Public Member Functions inherited from ShipGeoConfig._SingletonDict
 __call__ (cls, *args, **kwargs)
 
 __getitem__ (cls, key)
 
 delitem (cls, key)
 

Static Public Member Functions

 loadpy (filename, **kwargs)
 
 loadpys (config_string, **kwargs)
 
 get_latest_config ()
 
 register_config (name=None, base=None)
 
 keys ()
 
 get (name)
 
 clean ()
 

Static Public Attributes

 recent_config_name = None
 

Private Attributes

 __dict__
 

Additional Inherited Members

- Static Protected Attributes inherited from ShipGeoConfig._SingletonDict
dict _instances = {}
 

Detailed Description

Singleton registry of all Configurations

Definition at line 41 of file ShipGeoConfig.py.

Constructor & Destructor Documentation

◆ __init__()

ShipGeoConfig.ConfigRegistry.__init__ (   self)

Definition at line 62 of file ShipGeoConfig.py.

62 def __init__(self):
63 self.__dict__ = self
64

Member Function Documentation

◆ clean()

ShipGeoConfig.ConfigRegistry.clean ( )
static

Definition at line 89 of file ShipGeoConfig.py.

89 def clean():
90 for k in ConfigRegistry.keys():
91 ConfigRegistry.delitem(k)
92
93

◆ get()

ShipGeoConfig.ConfigRegistry.get (   name)
static

Definition at line 85 of file ShipGeoConfig.py.

85 def get(name):
86 return ConfigRegistry[name]
87

◆ get_latest_config()

ShipGeoConfig.ConfigRegistry.get_latest_config ( )
static

Definition at line 59 of file ShipGeoConfig.py.

59 def get_latest_config():
60 return ConfigRegistry[ConfigRegistry.recent_config_name]
61

◆ keys()

ShipGeoConfig.ConfigRegistry.keys ( )
static

Definition at line 80 of file ShipGeoConfig.py.

80 def keys():
81 registry = ConfigRegistry()
82 return [k for k, v in registry.items()]
83

◆ loadpy()

ShipGeoConfig.ConfigRegistry.loadpy (   filename,
**  kwargs 
)
static

Definition at line 48 of file ShipGeoConfig.py.

48 def loadpy(filename, **kwargs):
49 with open(expand_env(filename)) as fh:
50 return ConfigRegistry.loadpys(fh.read(), **kwargs)
51

◆ loadpys()

ShipGeoConfig.ConfigRegistry.loadpys (   config_string,
**  kwargs 
)
static

Definition at line 53 of file ShipGeoConfig.py.

53 def loadpys(config_string, **kwargs):
54 string_unixlf = config_string.replace('\r', '')
55 exec(string_unixlf, kwargs)
56 return ConfigRegistry.get_latest_config()
57

◆ register_config()

ShipGeoConfig.ConfigRegistry.register_config (   name = None,
  base = None 
)
static

Definition at line 67 of file ShipGeoConfig.py.

67 def register_config(name=None, base=None):
68 registry = ConfigRegistry()
69 if base is not None:
70 assert base in registry, "no base configuration (%s) found in the registry" % base
71 config = registry[base].clone()
72 else:
73 config = Config()
74 yield config
75 if name is not None:
76 registry[name] = config
77 ConfigRegistry.recent_config_name = name
78

Member Data Documentation

◆ __dict__

ShipGeoConfig.ConfigRegistry.__dict__
private

Definition at line 63 of file ShipGeoConfig.py.

◆ recent_config_name

ShipGeoConfig.ConfigRegistry.recent_config_name = None
static

Definition at line 45 of file ShipGeoConfig.py.


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