diff sat_frontends/jp/cmd_avatar.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/cmd_avatar.py	Wed Jun 27 07:51:29 2018 +0200
+++ b/sat_frontends/jp/cmd_avatar.py	Wed Jun 27 20:14:46 2018 +0200
@@ -28,16 +28,20 @@
 
 
 __commands__ = ["Avatar"]
-DISPLAY_CMD = ['xv', 'display', 'gwenview', 'showtell']
+DISPLAY_CMD = ["xv", "display", "gwenview", "showtell"]
 
 
 class Set(base.CommandBase):
     def __init__(self, host):
-        super(Set, self).__init__(host, 'set', use_verbose=True, help=_('set avatar of the profile'))
-        self.need_loop=True
+        super(Set, self).__init__(
+            host, "set", use_verbose=True, help=_("set avatar of the profile")
+        )
+        self.need_loop = True
 
     def add_parser_options(self):
-        self.parser.add_argument("image_path", type=str, help=_("path to the image to upload"))
+        self.parser.add_argument(
+            "image_path", type=str, help=_("path to the image to upload")
+        )
 
     def start(self):
         """Send files to jabber contact"""
@@ -46,30 +50,37 @@
             self.disp(_(u"file [{}] doesn't exist !").format(path), error=True)
             self.host.quit(1)
         path = os.path.abspath(path)
-        self.host.bridge.avatarSet(path, self.profile, callback=self._avatarCb, errback=self._avatarEb)
+        self.host.bridge.avatarSet(
+            path, self.profile, callback=self._avatarCb, errback=self._avatarEb
+        )
 
     def _avatarCb(self):
         self.disp(_("avatar has been set"), 1)
         self.host.quit()
 
     def _avatarEb(self, failure_):
-        self.disp(_("error while uploading avatar: {msg}").format(msg=failure_), error=True)
+        self.disp(
+            _("error while uploading avatar: {msg}").format(msg=failure_), error=True
+        )
         self.host.quit(C.EXIT_ERROR)
 
 
 class Get(base.CommandBase):
-
     def __init__(self, host):
-        super(Get, self).__init__(host, 'get', use_verbose=True, help=_('retrieve avatar of an entity'))
-        self.need_loop=True
+        super(Get, self).__init__(
+            host, "get", use_verbose=True, help=_("retrieve avatar of an entity")
+        )
+        self.need_loop = True
 
     def add_parser_options(self):
         self.parser.add_argument("jid", type=base.unicode_decoder, help=_("entity"))
-        self.parser.add_argument("-s", "--show", action="store_true", help=_(u"show avatar"))
+        self.parser.add_argument(
+            "-s", "--show", action="store_true", help=_(u"show avatar")
+        )
 
     def showImage(self, path):
         sat_conf = config.parseMainConf()
-        cmd = config.getConfig(sat_conf, 'jp', 'image_cmd')
+        cmd = config.getConfig(sat_conf, "jp", "image_cmd")
         cmds = [cmd] + DISPLAY_CMD if cmd else DISPLAY_CMD
         for cmd in cmds:
             try:
@@ -83,6 +94,7 @@
             # didn't worked with commands, we try our luck with webbrowser
             # in some cases, webbrowser can actually open the associated display program
             import webbrowser
+
             webbrowser.open(path)
 
     def _avatarGetCb(self, avatar_path):
@@ -101,11 +113,20 @@
         self.host.quit(C.EXIT_ERROR)
 
     def start(self):
-        self.host.bridge.avatarGet(self.args.jid, False, False, self.profile, callback=self._avatarGetCb, errback=self._avatarGetEb)
+        self.host.bridge.avatarGet(
+            self.args.jid,
+            False,
+            False,
+            self.profile,
+            callback=self._avatarGetCb,
+            errback=self._avatarGetEb,
+        )
 
 
 class Avatar(base.CommandBase):
     subcommands = (Set, Get)
 
     def __init__(self, host):
-        super(Avatar, self).__init__(host, 'avatar', use_profile=False, help=_('avatar uploading/retrieving'))
+        super(Avatar, self).__init__(
+            host, "avatar", use_profile=False, help=_("avatar uploading/retrieving")
+        )