diff mbox series

[Unstable/Lunar,1/5] UBUNTU: [Packaging] annotations: Fix linter errors

Message ID 20230207073607.913994-2-juerg.haefliger@canonical.com
State New
Headers show
Series annotations: Cleanups and splitting | expand

Commit Message

Juerg Haefliger Feb. 7, 2023, 7:36 a.m. UTC
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>
---
 debian/scripts/misc/annotations            | 20 ++++++++++----------
 debian/scripts/misc/kconfig/annotations.py | 12 ++++++------
 2 files changed, 16 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/debian/scripts/misc/annotations b/debian/scripts/misc/annotations
index 45548fc59dce..5caa3b2aa70f 100755
--- a/debian/scripts/misc/annotations
+++ b/debian/scripts/misc/annotations
@@ -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():
diff --git a/debian/scripts/misc/kconfig/annotations.py b/debian/scripts/misc/kconfig/annotations.py
index dd9c05fbb8e4..2af5f7c5b17b 100644
--- a/debian/scripts/misc/kconfig/annotations.py
+++ b/debian/scripts/misc/kconfig/annotations.py
@@ -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]