summaryrefslogtreecommitdiff
path: root/sphinx/pycode/nodes.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/pycode/nodes.py')
-rw-r--r--sphinx/pycode/nodes.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/sphinx/pycode/nodes.py b/sphinx/pycode/nodes.py
index e3a1bc9f6..b4b681d78 100644
--- a/sphinx/pycode/nodes.py
+++ b/sphinx/pycode/nodes.py
@@ -9,12 +9,16 @@
:license: BSD, see LICENSE for details.
"""
+if False:
+ # For type annotation
+ from typing import Callable # NOQA
+
class BaseNode(object):
"""
Node superclass for both terminal and nonterminal nodes.
"""
- parent = None
+ parent = None # type: BaseNode
def _eq(self, other):
raise NotImplementedError
@@ -29,7 +33,7 @@ class BaseNode(object):
return NotImplemented
return not self._eq(other)
- __hash__ = None
+ __hash__ = None # type: Callable[[object], int]
def get_prev_sibling(self):
"""Return previous child in parent's children, or None."""
@@ -204,5 +208,5 @@ class NodeVisitor(object):
def generic_visit(self, node):
"""Called if no explicit visitor function exists for a node."""
if isinstance(node, Node):
- for child in node:
+ for child in node: # type: ignore
self.visit(child)