mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-13 16:14:18 +00:00
Move user and local config merging to own method
This commit is contained in:
parent
53d5f0e49a
commit
d04cb245d3
1 changed files with 17 additions and 7 deletions
|
|
@ -228,6 +228,22 @@ class MergedConfigParser(object):
|
||||||
LOG.debug('Parsing CLI configuration files.')
|
LOG.debug('Parsing CLI configuration files.')
|
||||||
return self._parse_config(config)
|
return self._parse_config(config)
|
||||||
|
|
||||||
|
def merge_user_and_local_config(self):
|
||||||
|
"""Merge the parsed user and local configuration files.
|
||||||
|
|
||||||
|
:returns:
|
||||||
|
Dictionary of the parsed and merged configuration options.
|
||||||
|
:rtype:
|
||||||
|
dict
|
||||||
|
"""
|
||||||
|
user_config = self.parse_user_config()
|
||||||
|
config = self.parse_local_config()
|
||||||
|
|
||||||
|
for option, value in user_config.items():
|
||||||
|
config.setdefault(option, value)
|
||||||
|
|
||||||
|
return config
|
||||||
|
|
||||||
def parse(self, cli_config=None, isolated=False):
|
def parse(self, cli_config=None, isolated=False):
|
||||||
"""Parse and return the local and user config files.
|
"""Parse and return the local and user config files.
|
||||||
|
|
||||||
|
|
@ -257,10 +273,4 @@ class MergedConfigParser(object):
|
||||||
'--config by the user', cli_config)
|
'--config by the user', cli_config)
|
||||||
return self.parse_cli_config(cli_config)
|
return self.parse_cli_config(cli_config)
|
||||||
|
|
||||||
user_config = self.parse_user_config()
|
return self.merge_user_and_local_config()
|
||||||
config = self.parse_local_config()
|
|
||||||
|
|
||||||
for option, value in user_config.items():
|
|
||||||
config.setdefault(option, value)
|
|
||||||
|
|
||||||
return config
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue