UBUNTU: [Packaging] annotations: Fix linter errors
Fix the following flake8 errors:
- E127 continuation line over-indented for visual indent
- E722 do not use bare 'except'
- E203 whitespace before ':'
- E201 whitespace after '{'
- E202 whitespace before '}'
- E713 test for membership should be 'not in'
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
This commit is contained in:
committed by
Paolo Pisati
parent
7329f4be77
commit
0bd2d18b70
Vendored
+10
-10
@@ -53,19 +53,19 @@ def make_parser():
|
||||
|
||||
ga = parser.add_argument_group(title='Action').add_mutually_exclusive_group(required=False)
|
||||
ga.add_argument('--write', '-w', action='store',
|
||||
metavar='VALUE', dest='value',
|
||||
help='Set a specific config value in annotations (use \'null\' to remove)')
|
||||
metavar='VALUE', dest='value',
|
||||
help='Set a specific config value in annotations (use \'null\' to remove)')
|
||||
ga.add_argument('--export', '-e', action='store_true',
|
||||
help='Convert annotations to .config format')
|
||||
help='Convert annotations to .config format')
|
||||
ga.add_argument('--import', '-i', action='store',
|
||||
metavar="FILE", dest='import_file',
|
||||
help='Import a full .config for a specific arch and flavour into annotations')
|
||||
metavar="FILE", dest='import_file',
|
||||
help='Import a full .config for a specific arch and flavour into annotations')
|
||||
ga.add_argument('--update', '-u', action='store',
|
||||
metavar="FILE", dest='update_file',
|
||||
help='Import a partial .config into annotations (only resync configs specified in FILE)')
|
||||
metavar="FILE", dest='update_file',
|
||||
help='Import a partial .config into annotations (only resync configs specified in FILE)')
|
||||
ga.add_argument('--check', '-k', action='store',
|
||||
metavar="FILE", dest='check_file',
|
||||
help='Validate kernel .config with annotations')
|
||||
metavar="FILE", dest='check_file',
|
||||
help='Validate kernel .config with annotations')
|
||||
return parser
|
||||
|
||||
_ARGPARSER = make_parser()
|
||||
@@ -218,7 +218,7 @@ def autodetect_annotations(args):
|
||||
try:
|
||||
with open('debian/debian.env', 'rt') as fd:
|
||||
args.file = fd.read().rstrip().split('=')[1] + '/config/annotations'
|
||||
except:
|
||||
except Exception:
|
||||
arg_fail('error: could not determine DEBDIR, try using: --file/-f')
|
||||
|
||||
def main():
|
||||
|
||||
+6
-6
@@ -124,11 +124,11 @@ class Annotation(Config):
|
||||
# Parse body (handle includes recursively)
|
||||
self._parse_body(data)
|
||||
|
||||
def _remove_entry(self, config : str):
|
||||
def _remove_entry(self, config: str):
|
||||
if self.config[config]:
|
||||
del self.config[config]
|
||||
|
||||
def remove(self, config : str, arch: str = None, flavour: str = None):
|
||||
def remove(self, config: str, arch: str = None, flavour: str = None):
|
||||
if config not in self.config:
|
||||
return
|
||||
if arch is not None:
|
||||
@@ -142,11 +142,11 @@ class Annotation(Config):
|
||||
else:
|
||||
self._remove_entry(config)
|
||||
|
||||
def set(self, config : str, arch: str = None, flavour: str = None,
|
||||
value : str = None, note : str = None):
|
||||
def set(self, config: str, arch: str = None, flavour: str = None,
|
||||
value: str = None, note: str = None):
|
||||
if value is not None:
|
||||
if config not in self.config:
|
||||
self.config[config] = { 'policy': {} }
|
||||
self.config[config] = {'policy': {}}
|
||||
if arch is not None:
|
||||
if flavour is not None:
|
||||
flavour = f'{arch}-{flavour}'
|
||||
@@ -316,7 +316,7 @@ class Annotation(Config):
|
||||
# Get config options of a specific architecture
|
||||
ret = {}
|
||||
for c in self.config:
|
||||
if not 'policy' in self.config[c]:
|
||||
if 'policy' not in self.config[c]:
|
||||
continue
|
||||
if flavour in self.config[c]['policy']:
|
||||
ret[c] = self.config[c]['policy'][flavour]
|
||||
|
||||
Reference in New Issue
Block a user