summaryrefslogtreecommitdiff
path: root/sphinx/writers/xml.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2016-11-10 14:05:58 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2016-11-16 12:06:22 +0900
commit3407ef0ca8a8ce41e67092d2605f8fc77bebb982 (patch)
tree973ed8a909a41e157b3cd58cf619042a4f3584ce /sphinx/writers/xml.py
parent0d1875e2b5458e0f1f12aa4bfa538ca9c27fb908 (diff)
downloadsphinx-git-3407ef0ca8a8ce41e67092d2605f8fc77bebb982.tar.gz
Add type-check annotations to sphinx.writers
Diffstat (limited to 'sphinx/writers/xml.py')
-rw-r--r--sphinx/writers/xml.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/sphinx/writers/xml.py b/sphinx/writers/xml.py
index 5aa0ad96a..879f65dd3 100644
--- a/sphinx/writers/xml.py
+++ b/sphinx/writers/xml.py
@@ -12,16 +12,23 @@
from docutils import writers
from docutils.writers.docutils_xml import Writer as BaseXMLWriter
+if False:
+ # For type annotation
+ from typing import Any, Tuple # NOQA
+ from sphinx.builders import Builder # NOQA
+
class XMLWriter(BaseXMLWriter):
def __init__(self, builder):
+ # type: (Builder) -> None
BaseXMLWriter.__init__(self)
self.builder = builder
if self.builder.translator_class:
self.translator_class = self.builder.translator_class
def translate(self, *args, **kwargs):
+ # type: (Any, Any) -> None
self.document.settings.newlines = \
self.document.settings.indents = \
self.builder.env.config.xml_pretty
@@ -36,18 +43,21 @@ class PseudoXMLWriter(writers.Writer):
"""Formats this writer supports."""
config_section = 'pseudoxml writer'
- config_section_dependencies = ('writers',)
+ config_section_dependencies = ('writers',) # type: Tuple[unicode]
output = None
"""Final translated form of `document`."""
def __init__(self, builder):
+ # type: (Builder) -> None
writers.Writer.__init__(self)
self.builder = builder
def translate(self):
+ # type: () -> None
self.output = self.document.pformat()
def supports(self, format):
+ # type: (unicode) -> bool
"""This writer supports all format-specific elements."""
return True