Stash Software API  2.0.0
Classes | Public Member Functions | Static Public Attributes | List of all members
sConfig.configAbs.Config Class Reference

[ ABSTRACT CLASS ] - Abstract configuration class to operate on configuration modules. More...

Inheritance diagram for sConfig.configAbs.Config:
sSettings.settingsCon.Config

Classes

class  Set
 [ ABSTRACT ENUM CLASS ] - Configuration sets. More...
 

Public Member Functions

def __init__ (self, configPackageName=None)
 Constructor. More...
 
def listSetNames (self)
 List all sets of the configuration package. More...
 
def listConfigNames (self, setName, excludeTests=True)
 List all configuration names for the given set. More...
 
def getConfigModule (self, setName, configName=None)
 Get given configuration module by its name. More...
 
def getConfigValue (self, setName, configName=None, useDefault=False, kwargs)
 Get value for the given configuration. More...
 
def listAllConfigModules (self, setName, excludeTests=True)
 Get all configuration modules without invoking the main function in them. More...
 
def listAllConfigValues (self, setName, excludeTests=True, kwargs)
 Get all configuration values by finding/importing the configuration modules. More...
 

Static Public Attributes

string DEFAULT_CONFIG_FILE_BASE_NAME = 'default'
 [ str ] - Default Configuration file base name. More...
 

Detailed Description

[ ABSTRACT CLASS ] - Abstract configuration class to operate on configuration modules.

Constructor & Destructor Documentation

◆ __init__()

def sConfig.configAbs.Config.__init__ (   self,
  configPackageName = None 
)

Constructor.

Name of the current package will be used if configPackageName argument is not provided.

Parameters
configPackageName[ str | None | in ] - Name of the package to operate on.
Exceptions
N/A
Returns
None - None.

Member Function Documentation

◆ listSetNames()

def sConfig.configAbs.Config.listSetNames (   self)

List all sets of the configuration package.

Exceptions
ImportError- If configuration package doesn't exist.
Returns
list of str - Set names.

◆ listConfigNames()

def sConfig.configAbs.Config.listConfigNames (   self,
  setName,
  excludeTests = True 
)

List all configuration names for the given set.

Parameters
setName[ str | None | in ] - Set name from Set enum class.
excludeTests[ bool | True | in ] - Exclude test modules.
Exceptions
ImportError- If configuration module could not be imported.
Returns
list of str - Config names.

◆ getConfigModule()

def sConfig.configAbs.Config.getConfigModule (   self,
  setName,
  configName = None 
)

Get given configuration module by its name.

"default" will be used if you pass None for configName argument.

Parameters
setName[ str | None | in ] - Set name from Set enum class.
configName[ str | None | in ] - Name of the configuration, default value is "default".
Exceptions
N/A
Returns
module - Config module.

◆ getConfigValue()

def sConfig.configAbs.Config.getConfigValue (   self,
  setName,
  configName = None,
  useDefault = False,
  kwargs 
)

Get value for the given configuration.

Method also invokes main function in the configuration module to get the value.

Parameters
setName[ str | None | in ] - Set name from Set enum class.
configName[ str | None | in ] - Name of the configuration, default value is "default".
useDefault[ bool | False | in ] - Use default configuration if given configName configuration doesn't exist.
**kwargs[ dict | None | in ] - Arguments to be passed to the main function in the configuration module.
Exceptions
AttributeError- If configuration module doesn't have main function.
Returns
variant - Configuration value.

◆ listAllConfigModules()

def sConfig.configAbs.Config.listAllConfigModules (   self,
  setName,
  excludeTests = True 
)

Get all configuration modules without invoking the main function in them.

Parameters
setName[ str | None | in ] - Set name from Set enum class.
excludeTests[ bool | True | in ] - Exclude test modules.
Exceptions
N/A
Returns
list of modules - Configuration modules.

◆ listAllConfigValues()

def sConfig.configAbs.Config.listAllConfigValues (   self,
  setName,
  excludeTests = True,
  kwargs 
)

Get all configuration values by finding/importing the configuration modules.

Parameters
setName[ str | None | in ] - Set name from Set enum class.
excludeTests[ bool | True | in ] - Exclude test modules.
**kwargs[ dict | None | in ] - Arguments to be passed to the main function in the configuration module.
Exceptions
N/A
Returns
list of dict - Dict objects contain configName and value keys.
None - If configuration is found.

Member Data Documentation

◆ DEFAULT_CONFIG_FILE_BASE_NAME

string sConfig.configAbs.Config.DEFAULT_CONFIG_FILE_BASE_NAME = 'default'
static

[ str ] - Default Configuration file base name.


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