Пример #1
0
    def _load_defaults(self):
        ''' Load the Brain config yaml file '''

        config = yaml.load(open(os.path.join(os.path.dirname(__file__), 'data/brain.yml')))
        user_config_path = os.path.expanduser('~/.brain/brain.yml')
        if os.path.exists(user_config_path):
            config = merge(yaml.load(open(user_config_path)), config)

        # update any matching Config values
        for key, value in config.items():
            if hasattr(self, key):
                self.__setattr__(key, value)

        self._custom_config = config
Пример #2
0
    def _load_defaults(self):
        ''' Loads marvin configuration parameters

        Loads Marvin config parameters from the default marvin.yml file
        located in /data and merges with the user config parameters in
        ~/.marvin/marvin.yml

        '''
        with open(os.path.join(os.path.dirname(__file__), 'data/marvin.yml'), 'r') as f:
            config = yaml.load(f, Loader=get_yaml_loader())
        user_config_path = os.path.expanduser('~/.marvin/marvin.yml')
        if os.path.exists(user_config_path):
            with open(user_config_path, 'r') as f:
                config = merge(yaml.load(f, Loader=get_yaml_loader()), config)

        # update any matching Config values
        for key, value in config.items():
            if hasattr(self, key):
                self.__setattr__(key, value)

        self._custom_config = config