def _filterTag(wildcard, tag, parent): """Filter tag by returning NEW tag, which matches the filter. Original tag is not modified """ newTag = ctags.Tag(tag.type, tag.name, tag.lineNumber, parent) children = _filterTags(wildcard, tag.children, newTag) if children or fnmatch.fnmatch(tag.name.lower(), wildcard): newTag.children = children return newTag else: return None
def format_tag_for_quickopen(tag, file=1): format = [] tag = ctags.Tag(tag) f='' for field in getattr(tag, "field_keys", []): if field in PATH_ORDER: punct = OBJECT_PUNCTUATORS.get(field, ' -> ') f += string.Template ( ' %($field)s$punct%(symbol)s' ).substitute(locals()) format = [(f or tag.symbol) % tag, tag.ex_command] format[1] = format[1].strip() if file: format.insert(1, tag.filename ) return format