def __call__(self, filename):
if not filename and not self._opts.default_config:
return None
assert(issubclass(self._opts.ConfigClass, Config))
if filename:
filename = os.path.expanduser(os.path.expandvars(filename))
config = self._opts.ConfigClass(filename,
**self._opts.configClassOpts(),
**self._opts.configparser_opts)
# Default config? Start with that...
if self._opts.default_config:
config.read_string(self._opts.default_config, source="<default>")
# User file.
if filename:
config.read()
if self._opts.init_logging_fileConfig:
logging.config.fileConfig(config)
return config
评论列表
文章目录