Use a Matcher as default argument to simplify type anotation.

This commit is contained in:
Julien Palard 2018-05-16 10:50:23 +02:00
parent 6dcdce685d
commit 6740d2d391

View File

@ -22,13 +22,9 @@ from babel.messages.pofile import read_po
from sphinx.errors import SphinxError from sphinx.errors import SphinxError
from sphinx.util import logging from sphinx.util import logging
from sphinx.util.matching import Matcher
from sphinx.util.osutil import SEP, relpath, walk from sphinx.util.osutil import SEP, relpath, walk
if False:
# For type annotation
from typing import Union # NOQA
from sphinx.util.matching import Matcher # NOQA
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -108,8 +104,8 @@ def find_catalog_files(docname, srcdir, locale_dirs, lang, compaction):
def find_catalog_source_files(locale_dirs, locale, domains=None, gettext_compact=False, def find_catalog_source_files(locale_dirs, locale, domains=None, gettext_compact=False,
charset='utf-8', force_all=False, charset='utf-8', force_all=False,
excluded=lambda path: False): excluded=Matcher([])):
# type: (List[unicode], unicode, List[unicode], bool, unicode, bool, Union[Callable[[unicode], bool], Matcher]) -> Set[CatalogInfo] # NOQA # type: (List[unicode], unicode, List[unicode], bool, unicode, bool, Matcher) -> Set[CatalogInfo] # NOQA
""" """
:param list locale_dirs: :param list locale_dirs:
list of path as `['locale_dir1', 'locale_dir2', ...]` to find list of path as `['locale_dir1', 'locale_dir2', ...]` to find