Migrate to py3 style type annotation: sphinx.util.fileutil

This commit is contained in:
Takeshi KOMIYA 2019-06-02 17:40:33 +09:00
parent 850bfa07d2
commit ba8bf2c2ce

View File

@ -10,20 +10,20 @@
import os import os
import posixpath import posixpath
from typing import Dict
from docutils.utils import relative_path from docutils.utils import relative_path
from sphinx.util.osutil import copyfile, ensuredir from sphinx.util.osutil import copyfile, ensuredir
from sphinx.util.typing import PathMatcher
if False: if False:
# For type annotation # For type annotation
from typing import Callable, Dict, Union # NOQA from sphinx.util.template import BaseRenderer
from sphinx.util.matching import Matcher # NOQA
from sphinx.util.template import BaseRenderer # NOQA
def copy_asset_file(source, destination, context=None, renderer=None): def copy_asset_file(source: str, destination: str,
# type: (str, str, Dict, BaseRenderer) -> None context: Dict = None, renderer: "BaseRenderer" = None) -> None:
"""Copy an asset file to destination. """Copy an asset file to destination.
On copying, it expands the template variables if context argument is given and On copying, it expands the template variables if context argument is given and
@ -55,8 +55,8 @@ def copy_asset_file(source, destination, context=None, renderer=None):
copyfile(source, destination) copyfile(source, destination)
def copy_asset(source, destination, excluded=lambda path: False, context=None, renderer=None): def copy_asset(source: str, destination: str, excluded: PathMatcher = lambda path: False,
# type: (str, str, Union[Callable[[str], bool], Matcher], Dict, BaseRenderer) -> None context: Dict = None, renderer: "BaseRenderer" = None) -> None:
"""Copy asset files to destination recursively. """Copy asset files to destination recursively.
On copying, it expands the template variables if context argument is given and On copying, it expands the template variables if context argument is given and