Added "cls" as a parameter that should be discarded for Python2 and Python3.

Fri, 28 Sep 2012 18:00:28 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 28 Sep 2012 18:00:28 +0200
changeset 61
b88fd1352be6
parent 60
9d7da7dc2585
child 62
1b0491135c52

Added "cls" as a parameter that should be discarded for Python2 and Python3.

AssistantEric/APIsManager.py file | annotate | diff | comparison | revisions
PluginAssistantEric.py file | annotate | diff | comparison | revisions
--- a/AssistantEric/APIsManager.py	Tue Jun 12 19:11:16 2012 +0200
+++ b/AssistantEric/APIsManager.py	Fri Sep 28 18:00:28 2012 +0200
@@ -569,10 +569,9 @@
         Private method to initialize as a language API object.
         """
         if self.__language in ["Python", "Python2", "Python3"]:
-            self.__discardFirst = "self"
-            # TODO: discard first can be 'cls' as well
+            self.__discardFirst = ["self", "cls"]
         else:
-            self.__discardFirst = ""
+            self.__discardFirst = []
         self.__lexer = QScintilla.Lexers.getLexer(self.__language)
         self.__apifiles = Preferences.getEditorAPI(self.__language)
         self.__apifiles.sort()
@@ -806,9 +805,10 @@
                     fullCtx = query.value(2)
                     if sig:
                         if self.__discardFirst:
-                            sig = "({0}".format(sig[1:])\
-                                    .replace(self.__discardFirst, "", 1)\
-                                    .strip(", \t\r\n")
+                            sig = "({0}".format(sig[1:])
+                            for discard in self.__discardFirst:
+                                sig = sig.replace(discard, "", 1)
+                            sig = sig.strip(", \t\r\n")
                         if self.__enoughCommas(sig, commas):
                             if showContext:
                                 calltips.append("{0}{1}{2}{3}".format(
@@ -983,10 +983,10 @@
         """
         Private slot to perform actions after a project has been opened.
         """
-        if self.__project.getProjectLanguage() in ["Python", "Python3"]:
-            self.__discardFirst = "self"
+        if self.__project.getProjectLanguage() in ["Python", "Python2", "Python3"]:
+            self.__discardFirst = ["self", "cls"]
         else:
-            self.__discardFirst = ""
+            self.__discardFirst = []
         self.__lexer = QScintilla.Lexers.getLexer(self.__project.getProjectLanguage())
         self.__openAPIs()
     
--- a/PluginAssistantEric.py	Tue Jun 12 19:11:16 2012 +0200
+++ b/PluginAssistantEric.py	Fri Sep 28 18:00:28 2012 +0200
@@ -23,7 +23,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "2.3.1"
+version = "2.3.2"
 className = "AssistantEricPlugin"
 packageName = "AssistantEric"
 shortDescription = "Alternative autocompletion and calltips provider."

eric ide

mercurial