[geany/geany] baafa6: Strip more tags which start with a keyword

Enrico Tröger git-noreply at xxxxx
Wed Sep 12 17:29:21 UTC 2012


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Wed, 12 Sep 2012 17:29:21
Commit:      baafa6325c344bbc2c2370835c9be6968d1a4a67
             https://github.com/geany/geany/commit/baafa6325c344bbc2c2370835c9be6968d1a4a67

Log Message:
-----------
Strip more tags which start with a keyword


Modified Paths:
--------------
    scripts/create_py_tags.py

Modified: scripts/create_py_tags.py
19 files changed, 12 insertions(+), 7 deletions(-)
===================================================================
@@ -142,13 +142,8 @@ def _add_tag(self, obj, tag_type, parent=''):
             # skip short tags
             return
         tag = '%s%s%s%s%s%s\n' % (tagname, TA_TYPE, tag_type, TA_ARGLIST, args, scope)
-        for keyword in PYTHON_KEYWORDS:
-            # ignore tags which start with a keyword to avoid
-            # annoying completions of 'pass_' and similar ones
-            if tagname.startswith(keyword):
-                return
 
-        if not tagname in self.tags:
+        if not tagname in self.tags and not tagname_is_like_keyword(tagname):
             self.tags[tagname] = tag
 
     #----------------------------------------------------------------------
@@ -206,7 +201,7 @@ def process_file(self, filename):
                         tag_type = TYPE_FUNCTION
                     args = args.strip()
                     tag = '%s%s%s%s%s\n' % (tagname, TA_TYPE, tag_type, TA_ARGLIST, args)
-                    if not tagname in self.tags:
+                    if not tagname in self.tags and not tagname_is_like_keyword(tagname):
                         self.tags[tagname] = tag
             filep.close()
 
@@ -248,6 +243,16 @@ def write_to_file(self, filename):
 
 
 #----------------------------------------------------------------------
+def tagname_is_like_keyword(tagname):
+    """ignore tags which start with a keyword to avoid annoying completions of 'pass_' and similar ones"""
+    # this is not really efficient but in this script speed doesn't really matter
+    for keyword in PYTHON_KEYWORDS:
+        if tagname.startswith(keyword):
+            return True
+    return False
+
+
+#----------------------------------------------------------------------
 def is_private_identifier(tagname):
     return tagname.startswith('_') or tagname.endswith('_')
 


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Commits mailing list