diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-02-07 13:29:24 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-02-09 16:49:01 +0300 |
commit | d25c3ad2419aa01ab0b64898ebe71bb7139928cb (patch) | |
tree | 8fd4655ec193f4bde52f75828803769d491ba734 /sphinx/util/logging.py | |
parent | 84458da82889e28fc44988601a79c0c562e0e994 (diff) |
Update type annotations
Diffstat (limited to 'sphinx/util/logging.py')
-rw-r--r-- | sphinx/util/logging.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sphinx/util/logging.py b/sphinx/util/logging.py index 1c480e017..dd04b3f23 100644 --- a/sphinx/util/logging.py +++ b/sphinx/util/logging.py @@ -12,7 +12,7 @@ import logging import logging.handlers from collections import defaultdict from contextlib import contextmanager -from typing import IO, TYPE_CHECKING, Any, Dict, Generator, List, Tuple, Type, Union +from typing import IO, TYPE_CHECKING, Any, Dict, Generator, List, Optional, Tuple, Type, Union from docutils import nodes from docutils.nodes import Node @@ -353,6 +353,8 @@ def is_suppressed_warning(type: str, subtype: str, suppress_warnings: List[str]) if type is None: return False + subtarget: Optional[str] + for warning_type in suppress_warnings: if '.' in warning_type: target, subtarget = warning_type.split('.', 1) @@ -506,7 +508,7 @@ class WarningLogRecordTranslator(SphinxLogRecordTranslator): LogRecordClass = SphinxWarningLogRecord -def get_node_location(node: Node) -> str: +def get_node_location(node: Node) -> Optional[str]: (source, line) = get_source_line(node) if source and line: return "%s:%s" % (source, line) |