Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def read(self, filename):
"""Reads the file specified by filename
This method will load the eapi.conf file specified by filename into
the instance object. It will also add the default connection localhost
if it was not defined in the eapi.conf file
Args:
filename (str): The full path to the file to load
"""
try:
SafeConfigParser.read(self, filename)
except SafeConfigParserError as exc:
# Ignore file and syslog a message on SafeConfigParser errors
msg = ("%s: parsing error in eapi conf file: %s" %
(type(exc).__name__, filename))
debug(msg)
self._add_default_connection()
for name in self.sections():
if name.startswith('connection:') and \
'host' not in dict(self.items(name)):
self.set(name, 'host', name.split(':')[1])
self.generate_tags()
def read(self, filenames):
fileNamesFull = []
if not isinstance(filenames, list):
filenames = [ filenames ]
for filename in filenames:
fileNamesFull += SafeConfigParserWithIncludes.getIncludes(filename)
logSys.debug("Reading files: %s" % fileNamesFull)
if sys.version_info >= (3,2): # pragma: no cover
return SafeConfigParser.read(self, fileNamesFull, encoding='utf-8')
else:
return SafeConfigParser.read(self, fileNamesFull)
def read(self, filenames, encoding=None):
"""Overridden read() method to call parse_flask_section() at the end"""
ret = configparser.ConfigParser.read(self, filenames, encoding)
self.parse_flask_section()
return ret
def read(self, filenames):
"""Read the list of config files."""
# print("[DEBUG] filenames: ", filenames)
ConfigParser.read(self, filenames)
def read(self, filename):
if isinstance(filename, (list, tuple)):
self.filename = filename[0]
else:
self.filename = filename
ConfigParser.read(self, filename)
def read(self):
return ConfigParser.read(self, self.filename)