diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-07-17 01:01:51 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-04-08 01:54:17 +0900 |
commit | eb68c237dddbceecb7a295642e51e4ac8a5b36c2 (patch) | |
tree | 5cd9f57808fe4dd067b1d75d840157c8d5129e63 /sphinx/config.py | |
parent | 245b3c32df1965b6bd5952cf25e19beef965a01b (diff) | |
download | sphinx-git-eb68c237dddbceecb7a295642e51e4ac8a5b36c2.tar.gz |
refactor: Use PEP-526 based variable annotation
Diffstat (limited to 'sphinx/config.py')
-rw-r--r-- | sphinx/config.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sphinx/config.py b/sphinx/config.py index d7f9c4f8a..a9fdddc8a 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -14,7 +14,7 @@ import types from collections import OrderedDict from os import getenv, path from typing import (TYPE_CHECKING, Any, Callable, Dict, Generator, Iterator, List, NamedTuple, - Set, Tuple, Union) + Optional, Set, Tuple, Union) from sphinx.errors import ConfigError, ExtensionError from sphinx.locale import _, __ @@ -88,7 +88,7 @@ class Config: # If you add a value here, don't forget to include it in the # quickstart.py file template as well as in the docs! - config_values = { + config_values: Dict[str, Tuple] = { # general options 'project': ('Python', 'env', []), 'author': ('unknown', 'env', []), @@ -146,20 +146,20 @@ class Config: 'smartquotes_excludes': ({'languages': ['ja'], 'builders': ['man', 'text']}, 'env', []), - } # type: Dict[str, Tuple] + } def __init__(self, config: Dict[str, Any] = {}, overrides: Dict[str, Any] = {}) -> None: self.overrides = dict(overrides) self.values = Config.config_values.copy() self._raw_config = config - self.setup = config.get('setup', None) # type: Callable + self.setup: Optional[Callable] = config.get('setup', None) if 'extensions' in self.overrides: if isinstance(self.overrides['extensions'], str): config['extensions'] = self.overrides.pop('extensions').split(',') else: config['extensions'] = self.overrides.pop('extensions') - self.extensions = config.get('extensions', []) # type: List[str] + self.extensions: List[str] = config.get('extensions', []) @classmethod def read(cls, confdir: str, overrides: Dict = None, tags: Tags = None) -> "Config": @@ -311,7 +311,7 @@ class Config: def eval_config_file(filename: str, tags: Tags) -> Dict[str, Any]: """Evaluate a config file.""" - namespace = {} # type: Dict[str, Any] + namespace: Dict[str, Any] = {} namespace['__file__'] = filename namespace['tags'] = tags |