[geany/geany] f1cb61: Ignore tag names starting a Python keyword

Enrico Tröger git-noreply at xxxxx
Wed Aug 29 20:22:57 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, 29 Aug 2012 20:22:57
Commit:      f1cb61f6cbe7e52c33eed60fa36b40826a792258
             https://github.com/geany/geany/commit/f1cb61f6cbe7e52c33eed60fa36b40826a792258

Log Message:
-----------
Ignore tag names starting a Python keyword

This removes tags like 'pass_', 'pass_stmt' or 'return_stmt' which are quite annoying
when typing the actual keywords and pressing Enter afterwards.
Also add some more modules and packages to the ignore list to avoid weird side effects
when importing them (even though antigravity is funny).


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

Modified: scripts/create_py_tags.py
17 files changed, 14 insertions(+), 3 deletions(-)
===================================================================
@@ -21,9 +21,14 @@
 import types
 
 PYTHON_LIB_DIRECTORY = os.path.dirname(os.__file__)
-PYTHON_LIB_IGNORE_PACKAGES = (u'test', u'dist-packages', u'site-packages')
-# multiprocessing.util registers an atexit function which breaks this script on exit
-PYTHON_LIB_IGNORE_MODULES = (u'multiprocessing/util.py',)
+PYTHON_LIB_IGNORE_PACKAGES = (u'test', u'dist-packages', u'site-packages', 'Tools')
+# some modules execute funky code when they are imported which we really don't want here
+# (though if you feel funny, try: 'import antigravity')
+PYTHON_LIB_IGNORE_MODULES = (u'antigravity.py', u'idlelib/idle.py', u'multiprocessing/util.py')
+PYTHON_KEYWORDS = ('and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif',
+                   'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import',
+                   'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try',
+                   'while', 'with', 'yield', 'False', 'None', 'True')
 
 # (from tagmanager/tm_tag.c:32)
 TA_NAME = '%c' % 200,
@@ -123,6 +128,12 @@ 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:
             self.tags[tagname] = tag
 


@@ 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