Fix pylint issues
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
diff --git a/scripts/config.py b/scripts/config.py
index 120c827..d73ce6c 100755
--- a/scripts/config.py
+++ b/scripts/config.py
@@ -32,7 +32,7 @@
present in mbedtls_config.h but commented out.
* section: the name of the section that contains this symbol.
"""
- # pylint: disable=too-few-public-methods
+ # pylint: disable=too-few-public-methods, too-many-arguments
def __init__(self, active, name, value='', section=None, configfile=None):
self.active = active
self.name = name
@@ -57,6 +57,7 @@
name to become set.
"""
+ # pylint: disable=unused-argument
def __init__(self, **kw):
self.settings = {}
@@ -399,8 +400,8 @@
filename = candidate
break
else:
- raise Exception(name + ' configuration file not found',
- default_path)
+ raise ValueError(f'{name} configuration file not found: '
+ f'{filename if filename else default_path}')
self.filename = filename
self.templates = []
@@ -565,8 +566,8 @@
super().__init__()
self.mbedtls_config = MbedtlsConfigFile(mbedtls_config)
self.settings.update({name: Setting(active, name, value, section, self.mbedtls_config)
- for (active, name, value, section)
- in self.mbedtls_config.parse_file()})
+ for (active, name, value, section)
+ in self.mbedtls_config.parse_file()})
def set(self, name, value=None):
if name not in self.settings:
@@ -594,14 +595,14 @@
super().__init__()
self.crypto_config = CryptoConfigFile(crypto_config)
self.settings.update({name: Setting(active, name, value, section, self.crypto_config)
- for (active, name, value, section)
- in self.crypto_config.parse_file()})
+ for (active, name, value, section)
+ in self.crypto_config.parse_file()})
def set(self, name, value=None):
if name in UNSUPPORTED_FEATURE:
- raise ValueError('Feature is unsupported: \'{}\''.format(name))
+ raise ValueError(f'Feature is unsupported: \'{name}\'')
if name in UNSTABLE_FEATURE:
- raise ValueError('Feature is unstable: \'{}\''.format(name))
+ raise ValueError(f'Feature is unstable: \'{name}\'')
if name not in self.settings:
self.crypto_config.templates.append((name, '', '#define ' + name + ' ' + '1'))
@@ -637,6 +638,7 @@
def set(self, name, value=None):
super(self._get_related_config(name), self).set(name, value)
+ # pylint: disable=arguments-renamed
def write(self, mbedtls_file=None, crypto_file=None):
"""Write the whole configuration to the file it was read from.
@@ -650,6 +652,7 @@
return self.settings[name].configfile
if __name__ == '__main__':
+ #pylint: disable=too-many-statements
def main():
"""Command line mbedtls_config.h manipulation tool."""
parser = argparse.ArgumentParser(description="""