nico 8 éve
szülő
commit
b46752638f

+ 8 - 9
neurons/gmail_checker/gmail_checker.py

@@ -57,15 +57,14 @@ class Gmail_checker(NeuronModule):
 
     @staticmethod
     def try_parse(header, encoding):
-
         """
-            Verifying the Encoding and return unicode
+        Verifying the Encoding and return unicode
 
-            :param header: the header to decode
-            :param encoding: the targeted encoding
-            :return: either 'ASCII' or 'ISO-8859-1' or 'UTF-8'
+        :param header: the header to decode
+        :param encoding: the targeted encoding
+        :return: either 'ASCII' or 'ISO-8859-1' or 'UTF-8'
 
-            .. raises:: UnicodeDecodeError
+        .. raises:: UnicodeDecodeError
         """
         if encoding is None:
             encoding = 'ASCII'
@@ -79,10 +78,10 @@ class Gmail_checker(NeuronModule):
 
     def _is_parameters_ok(self):
         """
-            Check if received parameters are ok to perform operations in the neuron
-            :return: true if parameters are ok, raise an exception otherwise
+        Check if received parameters are ok to perform operations in the neuron
+        :return: true if parameters are ok, raise an exception otherwise
 
-            .. raises:: MissingParameterException
+        .. raises:: MissingParameterException
         """
         if self.username is None:
             raise MissingParameterException("Username parameter required")

+ 1 - 1
neurons/kill_switch/kill_switch.py

@@ -5,7 +5,7 @@ from core.NeuronModule import NeuronModule
 
 class Kill_switch(NeuronModule):
     """
-        Class used to exit Kalliope process from system command
+    Class used to exit Kalliope process from system command
     """
     def __init__(self, **kwargs):
         super(Kill_switch, self).__init__(**kwargs)

+ 4 - 4
neurons/neurotransmitter/neurotransmitter.py

@@ -20,7 +20,7 @@ class Neurotransmitter(NeuronModule):
 
     def callback(self, audio):
         """
-            The callback used by the STT module to get the linked synapse
+        The callback used by the STT module to get the linked synapse
 
         :param audio: the audio to play by STT
         """
@@ -40,10 +40,10 @@ class Neurotransmitter(NeuronModule):
 
     def _links_content_ok(self):
         """
-            Check if received links are ok to perform operations
-            :return: true if links are ok, raise an exception otherwise
+        Check if received links are ok to perform operations
+        :return: true if links are ok, raise an exception otherwise
 
-            .. raises:: MissingParameterException
+        .. raises:: MissingParameterException
         """
 
         if self.links is None:

+ 3 - 3
neurons/openweathermap/Openweathermap.py

@@ -114,10 +114,10 @@ class Openweathermap(NeuronModule):
 
     def _is_parameters_ok(self):
         """
-            Check if received parameters are ok to perform operations in the neuron
-            :return: true if parameters are ok, raise an exception otherwise
+        Check if received parameters are ok to perform operations in the neuron
+        :return: true if parameters are ok, raise an exception otherwise
 
-            .. raises:: NotImplementedError
+        .. raises:: NotImplementedError
         """
         if self.api_key is None:
             raise NotImplementedError("OpenWeatherMap neuron needs an api_key")

+ 9 - 9
neurons/push_message/Push_message.py

@@ -10,10 +10,10 @@ class Push_message(NeuronModule):
     """
     def __init__(self, **kwargs):
         """
-            Send a push message to an android phone via Pushetta API
-            :param message: Message to send
-            :param api_key: The Pushetta service secret token
-            :param channel_name: Pushetta channel name
+        Send a push message to an android phone via Pushetta API
+        :param message: Message to send
+        :param api_key: The Pushetta service secret token
+        :param channel_name: Pushetta channel name
         """
         super(Push_message, self).__init__(**kwargs)
 
@@ -23,15 +23,15 @@ class Push_message(NeuronModule):
 
         # check if parameters have been provided
         if self._is_parameters_ok():
-            p = Pushetta( self.api_key)
+            p = Pushetta(self.api_key)
             p.pushMessage(self.channel_name, self.message)
 
     def _is_parameters_ok(self):
         """
-            Check if received parameters are ok to perform operations in the neuron
-            :return: true if parameters are ok, raise an exception otherwise
+        Check if received parameters are ok to perform operations in the neuron
+        :return: true if parameters are ok, raise an exception otherwise
 
-            .. raises:: NotImplementedError
+        .. raises:: NotImplementedError
         """
         if self.message is None:
             raise NotImplementedError("Pushetta neuron needs message to send")
@@ -40,4 +40,4 @@ class Push_message(NeuronModule):
         if self.channel_name is None:
             raise NotImplementedError("Pushetta neuron needs channel_name")
 
-        return True
+        return True

+ 3 - 3
neurons/say/say.py

@@ -12,10 +12,10 @@ class Say(NeuronModule):
 
     def _is_parameters_ok(self):
         """
-            Check if received parameters are ok to perform operations in the neuron
-            :return: true if parameters are ok, raise an exception otherwise
+        Check if received parameters are ok to perform operations in the neuron
+        :return: true if parameters are ok, raise an exception otherwise
 
-            .. raises:: MissingParameterException
+        .. raises:: MissingParameterException
         """
         if self.message is None:
             raise MissingParameterException("You must specify a message string or a list of messages as parameter")

+ 3 - 3
neurons/script/script.py

@@ -16,10 +16,10 @@ class Script(NeuronModule):
 
     def _is_parameters_ok(self):
         """
-            Check if received parameters are ok to perform operations in the neuron
-            :return: true if parameters are ok, raise an exception otherwise
+        Check if received parameters are ok to perform operations in the neuron
+        :return: true if parameters are ok, raise an exception otherwise
 
-            .. raises:: MissingParameterException, InvalidParameterException
+        .. raises:: MissingParameterException, InvalidParameterException
         """
         if self.path is None:
             raise MissingParameterException("You must provide a script path.")

+ 6 - 9
neurons/shell/shell.py

@@ -8,12 +8,10 @@ logger = logging.getLogger("kalliope")
 
 
 class AsyncShell(threading.Thread):
-
     """
+    Class used to run an asynchrone Shell command
 
-        Class used to run an asynchrone Shell command
-
-        .. notes:: Impossible to get the success code of the command
+    .. notes:: Impossible to get the success code of the command
     """
     def __init__(self, cmd):
         self.stdout = None
@@ -31,9 +29,8 @@ class AsyncShell(threading.Thread):
 
 
 class Shell(NeuronModule):
-
     """
-        Run a shell command in a synchron mode
+    Run a shell command in a synchron mode
     """
     def __init__(self, **kwargs):
         super(Shell, self).__init__(**kwargs)
@@ -61,10 +58,10 @@ class Shell(NeuronModule):
 
     def _is_parameters_ok(self):
         """
-            Check if received parameters are ok to perform operations in the neuron
-            :return: true if parameters are ok, raise an exception otherwise
+        Check if received parameters are ok to perform operations in the neuron
+        :return: true if parameters are ok, raise an exception otherwise
 
-            .. raises:: MissingParameterException
+        .. raises:: MissingParameterException
         """
         if self.cmd is None:
             raise MissingParameterException("cmd parameter required")

+ 9 - 11
neurons/sleep/sleep.py

@@ -12,14 +12,12 @@ class Sleep(NeuronModule):
         if self._is_parameters_ok():
             time.sleep(self.seconds)
 
-        def _is_parameters_ok(self):
-            """
-                Check if received parameters are ok to perform operations in the neuron
-                :return: true if parameters are ok, raise an exception otherwise
-
-                .. raises:: MissingParameterException
-            """
-            if self.seconds is None:
-                raise MissingParameterException("You must set a number of seconds as parameter")
-
-
+    def _is_parameters_ok(self):
+        """
+        Check if received parameters are ok to perform operations in the neuron
+        :return: true if parameters are ok, raise an exception otherwise
+
+        .. raises:: MissingParameterException
+        """
+        if self.seconds is None:
+            raise MissingParameterException("You must set a number of seconds as parameter")

+ 0 - 2
neurons/systemdate/systemdate.py

@@ -11,8 +11,6 @@ class Systemdate(NeuronModule):
             cache = False
         super(Systemdate, self).__init__(cache=cache, **kwargs)
 
-
-
         # local time and date
         hour = time.strftime("%H")          # Hour (24-hour clock) as a decimal number [00,23].
         minute = time.strftime("%M")        # Minute as a decimal number [00,59].

+ 3 - 3
neurons/tasker_autoremote/tasker_autoremote.py

@@ -28,10 +28,10 @@ class Tasker_autoremote(NeuronModule):
 
     def _is_parameters_ok(self):
         """
-            Check if received parameters are ok to perform operations in the neuron
-            :return: true if parameters are ok, raise an exception otherwise
+        Check if received parameters are ok to perform operations in the neuron
+        :return: true if parameters are ok, raise an exception otherwise
 
-            .. raises:: MissingParameterException
+        .. raises:: MissingParameterException
         """
         if self.key is None:
             raise MissingParameterException("key parameter required")

+ 3 - 3
neurons/twitter/Twitter.py

@@ -30,10 +30,10 @@ class Twitter(NeuronModule):
 
     def _is_parameters_ok(self):
         """
-            Check if received parameters are ok to perform operations in the neuron
-            :return: true if parameters are ok, raise an exception otherwise
+        Check if received parameters are ok to perform operations in the neuron
+        :return: true if parameters are ok, raise an exception otherwise
 
-            .. raises:: InvalidParameterException
+        .. raises:: InvalidParameterException
         """
         if self.consumer_key is None:
             raise InvalidParameterException("Twitter needs a consumer_key")

+ 4 - 4
neurons/wikipedia/Wikipedia.py

@@ -41,7 +41,7 @@ class Wikipedia(NeuronModule):
                 self.may_refer = list(set(self.may_refer))
                 self.returncode = "DisambiguationError"
                 summary = ""
-            except wikipedia.exceptions.PageError, e:
+            except wikipedia.exceptions.PageError:
                 # Exception raised when no Wikipedia matched a query.
                 self.returncode = "PageError"
                 summary = ""
@@ -57,10 +57,10 @@ class Wikipedia(NeuronModule):
 
     def _is_parameters_ok(self):
         """
-            Check if received parameters are ok to perform operations in the neuron
-            :return: true if parameters are ok, raise an exception otherwise
+        Check if received parameters are ok to perform operations in the neuron
+        :return: true if parameters are ok, raise an exception otherwise
 
-            .. raises:: InvalidParameterException
+        .. raises:: InvalidParameterException
         """
 
         if self.query is None: