diff options
author | danieleades <33452915+danieleades@users.noreply.github.com> | 2022-07-18 22:08:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-18 22:08:16 +0100 |
commit | a504ac6100a577cbda1bedf80d69636603ee287c (patch) | |
tree | 0aa79585440486bdb109f7238f8f5c992dad0d99 /sphinx/ext/apidoc.py | |
parent | a340427ba4d208193d539cb7e8401be23d75547e (diff) | |
download | sphinx-git-a504ac6100a577cbda1bedf80d69636603ee287c.tar.gz |
Improve static typing strictness (#10569)
Diffstat (limited to 'sphinx/ext/apidoc.py')
-rw-r--r-- | sphinx/ext/apidoc.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sphinx/ext/apidoc.py b/sphinx/ext/apidoc.py index ebea66a6c..9bfd69051 100644 --- a/sphinx/ext/apidoc.py +++ b/sphinx/ext/apidoc.py @@ -18,7 +18,7 @@ from copy import copy from fnmatch import fnmatch from importlib.machinery import EXTENSION_SUFFIXES from os import path -from typing import Any, Generator, List, Tuple +from typing import Any, Generator, List, Optional, Tuple import sphinx.locale from sphinx import __display_version__, package_dir @@ -58,7 +58,7 @@ def module_join(*modnames: str) -> str: return '.'.join(filter(None, modnames)) -def is_packagedir(dirname: str = None, files: List[str] = None) -> bool: +def is_packagedir(dirname: Optional[str] = None, files: Optional[List[str]] = None) -> bool: """Check given *files* contains __init__ file.""" if files is None and dirname is None: return False @@ -88,7 +88,7 @@ def write_file(name: str, text: str, opts: Any) -> None: def create_module_file(package: str, basename: str, opts: Any, - user_template_dir: str = None) -> None: + user_template_dir: Optional[str] = None) -> None: """Build the text of the file and write the file.""" options = copy(OPTIONS) if opts.includeprivate and 'private-members' not in options: @@ -107,7 +107,8 @@ def create_module_file(package: str, basename: str, opts: Any, def create_package_file(root: str, master_package: str, subroot: str, py_files: List[str], opts: Any, subs: List[str], is_namespace: bool, - excludes: List[str] = [], user_template_dir: str = None) -> None: + excludes: List[str] = [], user_template_dir: Optional[str] = None + ) -> None: """Build the text of the file and write the file.""" # build a list of sub packages (directories containing an __init__ file) subpackages = [module_join(master_package, subroot, pkgname) @@ -145,7 +146,7 @@ def create_package_file(root: str, master_package: str, subroot: str, py_files: def create_modules_toc_file(modules: List[str], opts: Any, name: str = 'modules', - user_template_dir: str = None) -> None: + user_template_dir: Optional[str] = None) -> None: """Create the module's index.""" modules.sort() prev_module = '' @@ -231,7 +232,7 @@ def has_child_module(rootpath: str, excludes: List[str], opts: Any) -> bool: def recurse_tree(rootpath: str, excludes: List[str], opts: Any, - user_template_dir: str = None) -> List[str]: + user_template_dir: Optional[str] = None) -> List[str]: """ Look for every file in the directory tree and create the corresponding ReST files. |