Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: Enrico Tröger enrico.troeger@uvena.de Date: Wed, 29 Aug 2012 21:03:25 Commit: 883ce3acb6cb760e8b8ef3238141243f74da8878 https://github.com/geany/geany/commit/883ce3acb6cb760e8b8ef3238141243f74da88...
Log Message: ----------- Add method to generate also tags for __builtins__
This way we get easily also tags for standard exceptions and a few builtin types.
Modified Paths: -------------- scripts/create_py_tags.py
Modified: scripts/create_py_tags.py 22 files changed, 21 insertions(+), 1 deletions(-) =================================================================== @@ -133,7 +133,10 @@ def _add_tag(self, obj, tag_type, parent=''): args = '(%s)' % parent else: scope = '%s%s' % (TA_SCOPE, parent) - tagname = obj.__name__ + if isinstance(obj, basestring): + tagname = obj + else: + tagname = obj.__name__ # check for duplicates if len(tagname) < 4: # skip short tags @@ -208,6 +211,22 @@ def process_file(self, filename): filep.close()
#---------------------------------------------------------------------- + def add_builtins(self): + """ + Add the contents of __builtins__ as simple tags + """ + for tag_name in dir(__builtins__): + # check if the tag name starts with upper case, then we assume it is a class + # note that this is a very very simple heuristic to determine the type and will give + # false positives + if tag_name[0].isupper(): + tag_type = TYPE_CLASS + else: + tag_type = TYPE_FUNCTION + + self._add_tag(tag_name, tag_type) + + #---------------------------------------------------------------------- def write_to_file(self, filename): """ Sort the found tags and write them into the file specified by filename @@ -266,6 +285,7 @@ def main(): args = get_module_filenames(PYTHON_LIB_DIRECTORY)
parser = Parser() + parser.add_builtins()
for filename in args: parser.process_file(filename)
@@ Diff output truncated at 100000 characters. @@
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).