diff src/plugins/plugin_misc_text_commands.py @ 594:e629371a28d3

Fix pep8 support in src/plugins.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 18 Jan 2013 17:55:35 +0100
parents beaf6bec2fcd
children c5451501465b
line wrap: on
line diff
--- a/src/plugins/plugin_misc_text_commands.py	Mon Jan 21 00:59:50 2013 +0100
+++ b/src/plugins/plugin_misc_text_commands.py	Fri Jan 18 17:55:35 2013 +0100
@@ -23,16 +23,17 @@
 from logging import debug, info, warning, error
 
 PLUGIN_INFO = {
-"name": "Text commands",
-"import_name": "text-commands",
-"type": "Misc",
-"protocols": [],
-"dependencies": ["XEP-0045", "EXP-PARROT"],
-"main": "TextCommands",
-"handler": "no",
-"description": _("""IRC like text commands""")
+    "name": "Text commands",
+    "import_name": "text-commands",
+    "type": "Misc",
+    "protocols": [],
+    "dependencies": ["XEP-0045", "EXP-PARROT"],
+    "main": "TextCommands",
+    "handler": "no",
+    "description": _("""IRC like text commands""")
 }
 
+
 class TextCommands(object):
     #FIXME: doc strings for commands have to be translatable
     #       plugins need a dynamic translation system (translation
@@ -52,13 +53,13 @@
                 if command.isalpha():
                     # looks like an actual command, we try to call the corresponding method
                     try:
-                        mess_data["unparsed"] = msg[1+len(command):] #part not yet parsed of the message
-                        return getattr(self,"cmd_%s" % command)(mess_data,profile)
+                        mess_data["unparsed"] = msg[1 + len(command):]  # part not yet parsed of the message
+                        return getattr(self, "cmd_%s" % command)(mess_data, profile)
                     except AttributeError:
                         pass
-            elif msg[0] == '\\': #we have escape char
+            elif msg[0] == '\\':  # we have escape char
                 try:
-                    if msg[1] in ('/','\\'): # we have '\/' or '\\', we escape to '/' or '\'
+                    if msg[1] in ('/', '\\'):  # we have '\/' or '\\', we escape to '/' or '\'
                         mess_data["message"] = msg[1:]
                 except IndexError:
                     pass
@@ -72,9 +73,9 @@
         """
         nb_arobas = arg.count('@')
         if nb_arobas == 1:
-            if arg[-1] !='@':
+            if arg[-1] != '@':
                 return jid.JID(arg)
-            return jid.JID(arg+service_jid)
+            return jid.JID(arg + service_jid)
         return jid.JID(u"%s@%s" % (arg, service_jid))
 
     def _feedBack(self, message, mess_data, profile):
@@ -99,7 +100,7 @@
         nick = mess_data["unparsed"].strip()
         room = mess_data["to"]
 
-        self.host.plugins["XEP-0045"].nick(room,nick,profile)
+        self.host.plugins["XEP-0045"].nick(room, nick, profile)
 
         return False
 
@@ -134,7 +135,7 @@
         else:
             room = mess_data["to"]
 
-        self.host.plugins["XEP-0045"].leave(room,profile)
+        self.host.plugins["XEP-0045"].leave(room, profile)
 
         return False
 
@@ -183,7 +184,7 @@
         self.host.plugins["EXP-PARROT"].addParrot(link_left_jid, link_right_jid, profile)
         self.host.plugins["EXP-PARROT"].addParrot(link_right_jid, link_left_jid, profile)
 
-        self._feedBack("Parrot mode activated for %s" % (unicode(link_left_jid),), mess_data, profile)
+        self._feedBack("Parrot mode activated for %s" % (unicode(link_left_jid), ), mess_data, profile)
 
         return False
 
@@ -210,7 +211,7 @@
 
     def cmd_help(self, mess_data, profile):
         """show help on available commands"""
-        commands=filter(lambda method: method.startswith('cmd_'), dir(self))
+        commands = filter(lambda method: method.startswith('cmd_'), dir(self))
         longuest = max([len(command) for command in commands])
         help_cmds = []
 
@@ -223,7 +224,5 @@
             spaces = (longuest - len(command)) * ' '
             help_cmds.append("    /%s: %s %s" % (command[4:], spaces, help_str))
 
-        help_mess = _(u"Text commands available:\n%s") % (u'\n'.join(help_cmds),)
+        help_mess = _(u"Text commands available:\n%s") % (u'\n'.join(help_cmds), )
         self._feedBack(help_mess, mess_data, profile)
-
-