StrokeSegLab
Loading...
Searching...
No Matches
config_manager.Config Class Reference
Inheritance diagram for config_manager.Config:

Public Member Functions

None __init__ (self)
 
str get (self, str section, str key)
 
None set (self, str section, str key, str value)
 
None save (self)
 
None clear (self, str section)
 

Public Attributes

 config = configparser.ConfigParser()
 

Detailed Description

Singleton class to manage application configuration with an INI files
The config stores default parameters that are shared across runs and depend on the machine setup (viewer path, model names, output suffix, ...)

Args:
    metaclass (_type_, optional): The metaclass controls the creation of the class itself. Defaults to SingletonMeta, which makes sure only one object of the class is ever created (singleton pattern)

Constructor & Destructor Documentation

◆ __init__()

None config_manager.Config.__init__ ( self)
Initialize the Config singleton by reading the config file
Raises a FileNotFoundError if the config file does not exist or cannot be read

Member Function Documentation

◆ clear()

None config_manager.Config.clear ( self,
str section )
Remove all keys from a section by removing and re-adding the section

Args:
    section (str): Section name in the config file

◆ get()

str config_manager.Config.get ( self,
str section,
str key )
Get the value for a key in a section

Args:
    section (str): Section name in the config file
    key (str): Key name in the config file

Returns:
    str: Value corresponding to the key in the section

◆ save()

None config_manager.Config.save ( self)
Save the current configuration back to the config file

◆ set()

None config_manager.Config.set ( self,
str section,
str key,
str value )
Set or add a value for a key in a given section
If the section does not exist, it will be created

Args:
    section (str): Section name in the config file
    key (str): Key name in the config file
    value (str): Value to assign

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