Commits

Georg Brandl committed 06950c4

Rename doc_read_data to temp_data, which reflects better what it does.

Comments (0)

Files changed (8)

sphinx/directives/__init__.py

         node.append(contentnode)
         if self.names:
             # needed for association of version{added,changed} directives
-            self.env.doc_read_data['object'] = self.names[0]
+            self.env.temp_data['object'] = self.names[0]
         self.before_content()
         self.state.nested_parse(self.content, self.content_offset, contentnode)
         #self.handle_doc_fields(contentnode)
         DocFieldTransformer(self).transform_all(contentnode)
-        self.env.doc_read_data['object'] = None
+        self.env.temp_data['object'] = None
         self.after_content()
         return [self.indexnode, node]
 
     def run(self):
         env = self.state.document.settings.env
         domain_name = self.arguments[0]
-        env.doc_read_data['default_domain'] = env.domains.get(domain_name)
+        env.temp_data['default_domain'] = env.domains.get(domain_name)
 
 
 directives.register_directive('default-domain', DefaultDomain)

sphinx/directives/other.py

             ret = [node]
         env = self.state.document.settings.env
         env.versionchanges.setdefault(node['version'], []).append(
-            (node['type'], env.doc_read_data['docname'], self.lineno,
+            (node['type'], env.temp_data['docname'], self.lineno,
              # XXX: python domain specific
-             env.doc_read_data.get('py:module'),
-             env.doc_read_data.get('object'),
+             env.temp_data.get('py:module'),
+             env.temp_data.get('object'),
              node.astext()))
         return ret
 

sphinx/domains/python.py

 
         # determine module and class name (if applicable), as well as full name
         modname = self.options.get(
-            'module', self.env.doc_read_data.get('py:module'))
-        classname = self.env.doc_read_data.get('py:class')
+            'module', self.env.temp_data.get('py:module'))
+        classname = self.env.temp_data.get('py:class')
         if classname:
             add_module = False
             if name_prefix and name_prefix.startswith(classname):
         # 'exceptions' module.
         elif add_module and self.env.config.add_module_names:
             modname = self.options.get(
-                'module', self.env.doc_read_data.get('py:module'))
+                'module', self.env.temp_data.get('py:module'))
             if modname and modname != 'exceptions':
                 nodetext = modname + '.'
                 signode += addnodes.desc_addname(nodetext, nodetext)
 
     def add_target_and_index(self, name_cls, sig, signode):
         modname = self.options.get(
-            'module', self.env.doc_read_data.get('py:module'))
+            'module', self.env.temp_data.get('py:module'))
         fullname = (modname and modname + '.' or '') + name_cls[0]
         # note target
         if fullname not in self.state.document.ids:
 
     def after_content(self):
         if self.clsname_set:
-            self.env.doc_read_data['py:class'] = None
+            self.env.temp_data['py:class'] = None
 
 
 class PyModulelevel(PyObject):
     def before_content(self):
         PyObject.before_content(self)
         if self.names:
-            self.env.doc_read_data['py:class'] = self.names[0][0]
+            self.env.temp_data['py:class'] = self.names[0][0]
             self.clsname_set = True
 
 
     def before_content(self):
         PyObject.before_content(self)
         lastname = self.names and self.names[-1][1]
-        if lastname and not self.env.doc_read_data.get('py:class'):
-            self.env.doc_read_data['py:class'] = lastname.strip('.')
+        if lastname and not self.env.temp_data.get('py:class'):
+            self.env.temp_data['py:class'] = lastname.strip('.')
             self.clsname_set = True
 
 
         env = self.state.document.settings.env
         modname = self.arguments[0].strip()
         noindex = 'noindex' in self.options
-        env.doc_read_data['py:module'] = modname
+        env.temp_data['py:module'] = modname
         env.domaindata['py']['modules'][modname] = \
             (env.docname, self.options.get('synopsis', ''),
              self.options.get('platform', ''), 'deprecated' in self.options)
         env = self.state.document.settings.env
         modname = self.arguments[0].strip()
         if modname == 'None':
-            env.doc_read_data['py:module'] = None
+            env.temp_data['py:module'] = None
         else:
-            env.doc_read_data['py:module'] = modname
+            env.temp_data['py:module'] = modname
         return []
 
 
 class PyXRefRole(XRefRole):
     def process_link(self, env, refnode, has_explicit_title, title, target):
-        refnode['py:module'] = env.doc_read_data.get('py:module')
-        refnode['py:class'] = env.doc_read_data.get('py:class')
+        refnode['py:module'] = env.temp_data.get('py:module')
+        refnode['py:class'] = env.temp_data.get('py:class')
         if not has_explicit_title:
             title = title.lstrip('.')   # only has a meaning for the target
             target = target.lstrip('~') # only has a meaning for the title

sphinx/domains/std.py

 
     def add_target_and_index(self, name, sig, signode):
         targetname = name.replace('/', '-')
-        currprogram = self.env.doc_read_data.get('std:program')
+        currprogram = self.env.temp_data.get('std:program')
         if currprogram:
             targetname = '-' + currprogram + targetname
         targetname = 'cmdoption' + targetname
         env = self.state.document.settings.env
         program = ws_re.sub('-', self.arguments[0].strip())
         if program == 'None':
-            env.doc_read_data['std:program'] = None
+            env.temp_data['std:program'] = None
         else:
-            env.doc_read_data['std:program'] = program
+            env.temp_data['std:program'] = program
         return []
 
 
     innernodeclass = addnodes.literal_emphasis
 
     def process_link(self, env, refnode, has_explicit_title, title, target):
-        program = env.doc_read_data.get('std:program')
+        program = env.temp_data.get('std:program')
         if not has_explicit_title:
             if ' ' in title and not (title.startswith('/') or
                                      title.startswith('-')):
     def run(self):
         env = self.state.document.settings.env
         objects = env.domaindata['std']['objects']
-        gloss_entries = env.doc_read_data.setdefault('gloss_entries', set())
+        gloss_entries = env.temp_data.setdefault('gloss_entries', set())
         node = addnodes.glossary()
         node.document = self.state.document
         self.state.nested_parse(self.content, self.content_offset, node)

sphinx/environment.py

         self.dlfiles = FilenameUniqDict()
 
         # temporary data storage while reading a document
-        self.doc_read_data = {}
+        self.temp_data = {}
 
         # Some magically present labels
         def add_magic_label(name, description):
                     return element, []
         # else look in the default domain
         else:
-            def_domain = self.doc_read_data.get('default_domain')
+            def_domain = self.temp_data.get('default_domain')
             if def_domain is not None:
                 element = getattr(def_domain, type)(name)
                 if element is not None:
                 self.warn(docname, 'default role %s not found' %
                           self.config.default_role)
 
-        self.doc_read_data['docname'] = docname
+        self.temp_data['docname'] = docname
         # defaults to the global default, but can be re-set in a document
-        self.doc_read_data['default_domain'] = \
+        self.temp_data['default_domain'] = \
             self.domains.get(self.config.default_domain)
 
         self.settings['input_encoding'] = self.config.source_encoding
             metanode.__class__ = addnodes.meta
 
         # cleanup
-        self.doc_read_data.clear()
+        self.temp_data.clear()
 
         if save_parsed:
             # save the parsed doctree
     @property
     def docname(self):
         """Backwards compatible alias."""
-        return self.doc_read_data['docname']
+        return self.temp_data['docname']
 
     @property
     def currmodule(self):
         """Backwards compatible alias."""
-        return self.doc_read_data.get('py:module')
+        return self.temp_data.get('py:module')
 
     @property
     def currclass(self):
         """Backwards compatible alias."""
-        return self.doc_read_data.get('py:class')
+        return self.temp_data.get('py:class')
 
     def new_serialno(self, category=''):
         """Return a serial number, e.g. for index entry targets."""
         key = category + 'serialno'
-        cur = self.doc_read_data.get(key, 0)
-        self.doc_read_data[key] = cur + 1
+        cur = self.temp_data.get(key, 0)
+        self.temp_data[key] = cur + 1
         return cur
 
     def note_dependency(self, filename):

sphinx/ext/autodoc.py

         do all members, else those given by *self.options.members*.
         """
         # set current namespace for finding members
-        self.env.doc_read_data['autodoc:module'] = self.modname
+        self.env.temp_data['autodoc:module'] = self.modname
         if self.objpath:
-            self.env.doc_read_data['autodoc:class'] = self.objpath[0]
+            self.env.temp_data['autodoc:class'] = self.objpath[0]
 
         want_all = all_members or self.options.inherited_members or \
                    self.options.members is ALL
                                 check_module=members_check_module)
 
         # reset current objects
-        self.env.doc_read_data['autodoc:module'] = None
-        self.env.doc_read_data['autodoc:class'] = None
+        self.env.temp_data['autodoc:module'] = None
+        self.env.temp_data['autodoc:class'] = None
 
     def generate(self, more_content=None, real_modname=None,
                  check_module=False, all_members=False):
             else:
                 # if documenting a toplevel object without explicit module,
                 # it can be contained in another auto directive ...
-                modname = self.env.doc_read_data.get('autodoc:module')
+                modname = self.env.temp_data.get('autodoc:module')
                 # ... or in the scope of a module directive
                 if not modname:
-                    modname = self.env.doc_read_data.get('py:module')
+                    modname = self.env.temp_data.get('py:module')
                 # ... else, it stays None, which means invalid
         return modname, parents + [base]
 
                 # if documenting a class-level object without path,
                 # there must be a current class, either from a parent
                 # auto directive ...
-                mod_cls = self.env.doc_read_data.get('autodoc:class')
+                mod_cls = self.env.temp_data.get('autodoc:class')
                 # ... or from a class directive
                 if mod_cls is None:
-                    mod_cls = self.env.doc_read_data.get('py:class')
+                    mod_cls = self.env.temp_data.get('py:class')
                 # ... if still None, there's no way to know
                 if mod_cls is None:
                     return None, []
             parents = [cls]
             # if the module name is still missing, get it like above
             if not modname:
-                modname = self.env.doc_read_data.get('autodoc:module')
+                modname = self.env.temp_data.get('autodoc:module')
             if not modname:
-                modname = self.env.doc_read_data.get('py:module')
+                modname = self.env.temp_data.get('py:module')
             # ... else, it stays None, which means invalid
         return modname, parents + [base]
 

sphinx/ext/autosummary/__init__.py

         env = self.state.document.settings.env
 
         prefixes = ['']
-        currmodule = env.doc_read_data.get('py:module')
+        currmodule = env.temp_data.get('py:module')
         if currmodule:
             prefixes.insert(0, currmodule)
 

sphinx/ext/inheritance_diagram.py

         # Create a graph starting with the list of classes
         try:
             graph = InheritanceGraph(class_names,
-                                     env.doc_read_data.get('py:module'))
+                                     env.temp_data.get('py:module'))
         except InheritanceException, err:
             return [node.document.reporter.warning(err.args[0],
                                                    line=self.lineno)]