diff options
author | Georg Brandl <georg@python.org> | 2009-01-04 19:16:52 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-01-04 19:16:52 +0100 |
commit | 8cf33a70439d91b85d500908bde1bb7f6e9958af (patch) | |
tree | 88c769a5ba6581fd8baad34e1d3a95f4b9532c79 /sphinx/pycode | |
parent | 5df8e162f9b2740ac2b74fa15bc3c0be8b56a02b (diff) | |
download | sphinx-git-8cf33a70439d91b85d500908bde1bb7f6e9958af.tar.gz |
Cache tags and attribute docs in the analyzer.
Diffstat (limited to 'sphinx/pycode')
-rw-r--r-- | sphinx/pycode/__init__.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py index a61a051a5..0141ede40 100644 --- a/sphinx/pycode/__init__.py +++ b/sphinx/pycode/__init__.py @@ -176,6 +176,10 @@ class ModuleAnalyzer(object): self.tokens = None # will be filled by parse() self.parsetree = None + # will be filled by find_attr_docs() + self.attr_docs = None + # will be filled by find_tags() + self.tags = None def tokenize(self): """Generate tokens from the source.""" @@ -193,13 +197,18 @@ class ModuleAnalyzer(object): def find_attr_docs(self, scope=''): """Find class and module-level attributes and their documentation.""" + if self.attr_docs is not None: + return self.attr_docs self.parse() attr_visitor = AttrDocVisitor(number2name, scope) attr_visitor.visit(self.parsetree) + self.attr_docs = attr_visitor.collected return attr_visitor.collected def find_tags(self): """Find class, function and method definitions and their location.""" + if self.tags is not None: + return self.tags self.tokenize() result = {} namespace = [] @@ -246,6 +255,7 @@ class ModuleAnalyzer(object): if defline: defline = False expect_indent = True + self.tags = result return result |