Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
filepaths.append(filepath)
if filepaths:
global files_loaded
files_loaded = filepaths
# Python 3 has parser.read_file(iterator) while Python2 has
# parser.readfp(obj_with_readline)
read_func = getattr(parser, 'read_file', getattr(parser, 'readfp'))
for filepath in filepaths:
# Users are expected to put a [green] section
# only if they use setup.cfg
if filepath.endswith('setup.cfg'):
with open(filepath) as f:
read_func(f)
else:
read_func(ConfigFile(filepath))
return parser