summaryrefslogtreecommitdiff
path: root/sphinx/directives/other.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-12-03 01:59:58 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-12-03 01:59:58 +0900
commit503309d39e1d2b92b147df9cf3bb447efeb5efdf (patch)
tree2dbe404a068dffaa9ab55987b3713ef9e48758f9 /sphinx/directives/other.py
parentfc253e5a4cf2b1cd30e0f33a85d6e413dd3d7c9a (diff)
downloadsphinx-git-503309d39e1d2b92b147df9cf3bb447efeb5efdf.tar.gz
Fix annotations: Give Any type to state.memo to conceal errors
Diffstat (limited to 'sphinx/directives/other.py')
-rw-r--r--sphinx/directives/other.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/sphinx/directives/other.py b/sphinx/directives/other.py
index 62509de46..cc76275b9 100644
--- a/sphinx/directives/other.py
+++ b/sphinx/directives/other.py
@@ -336,14 +336,15 @@ class Only(SphinxDirective):
# Same as util.nested_parse_with_titles but try to handle nested
# sections which should be raised higher up the doctree.
- surrounding_title_styles = self.state.memo.title_styles
- surrounding_section_level = self.state.memo.section_level
- self.state.memo.title_styles = []
- self.state.memo.section_level = 0
+ memo = self.state.memo # type: Any
+ surrounding_title_styles = memo.title_styles
+ surrounding_section_level = memo.section_level
+ memo.title_styles = []
+ memo.section_level = 0
try:
self.state.nested_parse(self.content, self.content_offset,
node, match_titles=True)
- title_styles = self.state.memo.title_styles
+ title_styles = memo.title_styles
if (not surrounding_title_styles or
not title_styles or
title_styles[0] not in surrounding_title_styles or
@@ -371,8 +372,8 @@ class Only(SphinxDirective):
parent.append(node)
return []
finally:
- self.state.memo.title_styles = surrounding_title_styles
- self.state.memo.section_level = surrounding_section_level
+ memo.title_styles = surrounding_title_styles
+ memo.section_level = surrounding_section_level
class Include(BaseInclude, SphinxDirective):