aboutsummaryrefslogtreecommitdiffstats
path: root/warmachine/config.py
blob: 6be84e3a165690f53587bc621dece58e3117d6bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import configparser


class Config(configparser.ConfigParser):
    def __init__(self, config_path=None):
        super().__init__()

        self.config_path = config_path

        if self.config_path:
            self.read(self.config_path)

    def options_as_dict(self, section):
        """
        Returns:
           dict: Dictionary of the options defined in this config
        """
        d = dict(self.items(section))
        d['section_name'] = section
        return d