diff sat_frontends/jp/arg_tools.py @ 2624:56f94936df1e

code style reformatting using black
author Goffi <goffi@goffi.org>
date Wed, 27 Jun 2018 20:14:46 +0200
parents 26edcf3a30eb
children 003b8b4b56a7
line wrap: on
line diff
--- a/sat_frontends/jp/arg_tools.py	Wed Jun 27 07:51:29 2018 +0200
+++ b/sat_frontends/jp/arg_tools.py	Wed Jun 27 20:14:46 2018 +0200
@@ -26,9 +26,9 @@
 
     @param smart(bool): if True, only escape if needed
     """
-    if smart and not ' ' in arg and not '"' in arg:
+    if smart and not " " in arg and not '"' in arg:
         return arg
-    return u'"' + arg.replace(u'"',u'\\"') + u'"'
+    return u'"' + arg.replace(u'"', u'\\"') + u'"'
 
 
 def get_cmd_choices(cmd=None, parser=None):
@@ -61,7 +61,7 @@
     # else USE args would not work correctly (only for current parser)
     parser_args = []
     for arg in args:
-        if arg.startswith('-'):
+        if arg.startswith("-"):
             break
         try:
             parser = get_cmd_choices(arg, parser)
@@ -71,25 +71,31 @@
 
     # post_args are remaning given args,
     # without the ones corresponding to parsers
-    post_args = args[len(parser_args):]
+    post_args = args[len(parser_args) :]
 
     opt_args = []
     pos_args = []
     actions = {a.dest: a for a in parser._actions}
     for arg, value in use.iteritems():
         try:
-            if arg == u'item' and not u'item' in actions:
+            if arg == u"item" and not u"item" in actions:
                 # small hack when --item is appended to a --items list
-                arg = u'items'
+                arg = u"items"
             action = actions[arg]
         except KeyError:
             if verbose:
-                host.disp(_(u'ignoring {name}={value}, not corresponding to any argument (in USE)').format(
-                    name=arg,
-                    value=escape(value)))
+                host.disp(
+                    _(
+                        u"ignoring {name}={value}, not corresponding to any argument (in USE)"
+                    ).format(name=arg, value=escape(value))
+                )
         else:
             if verbose:
-                host.disp(_(u'arg {name}={value} (in USE)').format(name=arg, value=escape(value)))
+                host.disp(
+                    _(u"arg {name}={value} (in USE)").format(
+                        name=arg, value=escape(value)
+                    )
+                )
             if not action.option_strings:
                 pos_args.append(value)
             else: