|
1 | 1 | import hashlib |
2 | 2 | import re |
3 | | -import typing |
4 | 3 | from typing import Any, Dict, List, Optional, Sequence, Tuple |
5 | 4 |
|
6 | 5 | from docutils import nodes |
@@ -240,7 +239,7 @@ def get_sections_and_signature_and_needs( |
240 | 239 | current_node = need_node |
241 | 240 | while current_node: |
242 | 241 | if isinstance(current_node, nodes.section): |
243 | | - title = typing.cast(str, current_node.children[0].astext()) |
| 242 | + title = current_node.children[0].astext() |
244 | 243 | # If using auto-section numbering, then Sphinx inserts |
245 | 244 | # multiple non-breaking space unicode characters into the title |
246 | 245 | # we'll replace those with a simple space to make them easier to |
@@ -344,16 +343,16 @@ def analyse_need_locations(app: Sphinx, doctree: nodes.document) -> None: |
344 | 343 | # we can remove the hidden needs from the doctree |
345 | 344 | for need_node in hidden_needs: |
346 | 345 | if need_node.parent is not None: |
347 | | - need_node.parent.remove(need_node) # type: ignore[attr-defined] |
| 346 | + need_node.parent.remove(need_node) |
348 | 347 |
|
349 | 348 |
|
350 | 349 | def previous_sibling(node: nodes.Node) -> Optional[nodes.Node]: |
351 | 350 | """Return preceding sibling node or ``None``.""" |
352 | 351 | try: |
353 | | - i = node.parent.index(node) # type: ignore |
| 352 | + i = node.parent.index(node) |
354 | 353 | except AttributeError: |
355 | 354 | return None |
356 | | - return node.parent[i - 1] if i > 0 else None # type: ignore |
| 355 | + return node.parent[i - 1] if i > 0 else None |
357 | 356 |
|
358 | 357 |
|
359 | 358 | @profile("NEEDS_POST_PROCESS") |
@@ -391,7 +390,7 @@ def process_need_nodes(app: Sphinx, doctree: nodes.document, fromdocname: str) - |
391 | 390 | if not needs_config.include_needs: |
392 | 391 | for node in doctree.findall(Need): |
393 | 392 | if node.parent is not None: |
394 | | - node.parent.remove(node) # type: ignore |
| 393 | + node.parent.remove(node) |
395 | 394 | return |
396 | 395 |
|
397 | 396 | needs_data = SphinxNeedsData(app.env) |
|
0 commit comments