eric6/Utilities/BackgroundService.py

changeset 7965
48fbf9149d16
parent 7923
91e843545d9a
child 8043
0acf98cd089a
child 8143
2c730d5fd177
diff -r 19bbd56ac5f2 -r 48fbf9149d16 eric6/Utilities/BackgroundService.py
--- a/eric6/Utilities/BackgroundService.py	Thu Jan 07 17:22:16 2021 +0100
+++ b/eric6/Utilities/BackgroundService.py	Thu Jan 07 18:11:11 2021 +0100
@@ -2,11 +2,10 @@
 
 # Copyright (c) 2013 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
 #
-# pylint: disable=C0103
 
 """
 Module implementing a background service for the various checkers and other
-python interpreter dependent functions.
+Python interpreter dependent functions.
 """
 
 import json
@@ -42,7 +41,7 @@
     
     def __init__(self):
         """
-        Constructor of the BackgroundService class.
+        Constructor
         """
         self.processes = {}
         self.connections = {}
@@ -64,7 +63,7 @@
         
         port = self.serverPort()
         ## Note: Need the port if started external in debugger:
-        print('BackgroundService listening on: {0:d}'.format(port))
+        print('Background Service listening on: {0:d}'.format(port))
         # __IGNORE_WARNING__
         venvName = Preferences.getDebugger("Python3VirtualEnv")
         interpreter = e5App().getObject(
@@ -80,9 +79,12 @@
         """
         Private method to start the background client as external process.
         
-        @param interpreter path and name of the executable to start (string)
-        @param port socket port to which the interpreter should connect (int)
-        @return the process object (QProcess or None)
+        @param interpreter path and name of the executable to start
+        @type str
+        @param port socket port to which the interpreter should connect
+        @type int
+        @return the process object
+        @rtype QProcess or None
         """
         if interpreter == "" or not Utilities.isinpath(interpreter):
             return None
@@ -114,10 +116,14 @@
         """
         Private method to send a job request to one of the clients.
         
-        @param fx remote function name to execute (str)
-        @param lang language to connect to (str)
-        @param fn filename for identification (str)
-        @param data function argument(s) (any basic datatype)
+        @param fx remote function name to execute
+        @type str
+        @param lang language to connect to
+        @type str
+        @param fn filename for identification
+        @type str
+        @param data function argument(s)
+        @type any basic datatype
         """
         self.__cancelled = False
         connection = self.connections.get(lang)
@@ -146,7 +152,8 @@
         """
         Private method to receive the response from the clients.
         
-        @param lang language of the incomming connection (str)
+        @param lang language of the incoming connection
+        @type str
         @exception RuntimeError raised if hashes don't match
         """
         connection = self.connections[lang]
@@ -206,8 +213,8 @@
                     fx, lng, fn, data = self.runningJob
                     try:
                         self.services[(fx, lng)][3](fx, lng, fn, self.tr(
-                            'An error in Erics background client stopped the'
-                            ' service.')
+                            "An error in Eric's background client stopped the"
+                            " service.")
                         )
                     except (KeyError, TypeError):
                         # ignore silently
@@ -258,10 +265,12 @@
 
     def restartService(self, language, forceKill=False):
         """
-        Public method to restart a given lanuage.
+        Public method to restart a given language.
         
-        @param language to restart (str)
-        @param forceKill flag to kill a running task (bool)
+        @param language to restart
+        @type str
+        @param forceKill flag to kill a running task
+        @type bool
         """
         try:
             proc, interpreter = self.processes.pop(language)
@@ -288,14 +297,19 @@
 
     def enqueueRequest(self, fx, lang, fn, data):
         """
-        Public method implementing a queued processing of incomming events.
+        Public method implementing a queued processing of incoming events.
         
-        Dublicate service requests updates an older request to avoid overrun or
+        Duplicate service requests update an older request to avoid overrun or
         starving of the services.
-        @param fx function name of the service (str)
-        @param lang language to connect to (str)
-        @param fn filename for identification (str)
-        @param data function argument(s) (any basic datatype(s))
+        
+        @param fx function name of the service
+        @type str
+        @param lang language to connect to
+        @type str
+        @param fn filename for identification
+        @type str
+        @param data function argument(s)
+        @type any basic datatype
         """
         args = [fx, lang, fn, data]
         if fx == 'INIT':
@@ -315,8 +329,10 @@
         """
         Public method to ask a batch job to terminate.
         
-        @param fx function name of the service (str)
-        @param lang language to connect to (str)
+        @param fx function name of the service
+        @type str
+        @param lang language to connect to
+        @type str
         """
         self.__cancelled = True
         
@@ -342,14 +358,20 @@
         Public method to announce a new service to the background
         service/client.
         
-        @param fx function name of the service (str)
-        @param lang language of the new service (str)
-        @param modulepath full path to the module (str)
-        @param module name to import (str)
-        @param callback function called on service response (function)
+        @param fx function name of the service
+        @type str
+        @param lang language of the new service
+        @type str
+        @param modulepath full path to the module
+        @type str
+        @param module name to import
+        @type str
+        @param callback function called on service response
+        @type function
         @param onErrorCallback function called, if client isn't available
             (function)
-        @param onBatchDone function called when a batch job is done (function)
+        @param onBatchDone function called when a batch job is done
+        @type function
         """
         self.services[(fx, lang)] = (
             modulepath, module, callback, onErrorCallback
@@ -364,8 +386,10 @@
         """
         Public method to remove the service from the service list.
         
-        @param fx function name of the service (function)
-        @param lang language of the service (str)
+        @param fx function name of the service
+        @type function
+        @param lang language of the service
+        @type str
         """
         serviceArgs = self.services.pop((fx, lang), None)
         if serviceArgs and serviceArgs[3]:
@@ -373,7 +397,7 @@
 
     def on_newConnection(self):
         """
-        Private slot for new incomming connections from the clients.
+        Private slot for new incoming connections from the clients.
         """
         connection = self.nextPendingConnection()
         if not connection.waitForReadyRead(1000):
@@ -409,7 +433,8 @@
         """
         Private slot called when connection to a client is lost.
         
-        @param lang client language which connection is lost (str)
+        @param lang client language which connection is lost
+        @type str
         """
         conn = self.connections.pop(lang, None)
         if conn:

eric ide

mercurial