diff sat_frontends/jp/base.py @ 3938:6939594ba77e

cli (pubsub/get): add `--no-decrypt` flag to disable automatic decryption: rel 380
author Goffi <goffi@goffi.org>
date Sat, 15 Oct 2022 20:37:00 +0200
parents 045af0eeda3f
children 524856bd7b19
line wrap: on
line diff
--- a/sat_frontends/jp/base.py	Sat Oct 15 20:37:00 2022 +0200
+++ b/sat_frontends/jp/base.py	Sat Oct 15 20:37:00 2022 +0200
@@ -34,7 +34,7 @@
 import termios
 from pathlib import Path
 from glob import iglob
-from typing import Optional, Set
+from typing import Optional, Set, Union
 from importlib import import_module
 from sat_frontends.tools.jid import JID
 from sat.tools import config
@@ -979,26 +979,35 @@
         return full_jid.rsplit("/", 1)[0]
 
 
-class CommandBase(object):
+class CommandBase:
 
-    def __init__(self, host, name, use_profile=True, use_output=False, extra_outputs=None,
-                       need_connect=None, help=None, **kwargs):
+    def __init__(
+        self,
+        host: LiberviaCli,
+        name: str,
+        use_profile: bool = True,
+        use_output: Union[bool, str] = False,
+        extra_outputs: Optional[dict] = None,
+        need_connect: Optional[bool] = None,
+        help: Optional[str] = None,
+        **kwargs
+    ):
         """Initialise CommandBase
 
         @param host: Jp instance
-        @param name(unicode): name of the new command
-        @param use_profile(bool): if True, add profile selection/connection commands
-        @param use_output(bool, unicode): if not False, add --output option
-        @param extra_outputs(dict): list of command specific outputs:
+        @param name: name of the new command
+        @param use_profile: if True, add profile selection/connection commands
+        @param use_output: if not False, add --output option
+        @param extra_outputs: list of command specific outputs:
             key is output name ("default" to use as main output)
             value is a callable which will format the output (data will be used as only
             argument)
             if a key already exists with normal outputs, the extra one will be used
-        @param need_connect(bool, None): True if profile connection is needed
+        @param need_connect: True if profile connection is needed
             False else (profile session must still be started)
             None to set auto value (i.e. True if use_profile is set)
             Can't be set if use_profile is False
-        @param help(unicode): help message to display
+        @param help: help message to display
         @param **kwargs: args passed to ArgumentParser
             use_* are handled directly, they can be:
             - use_progress(bool): if True, add progress bar activation option