summaryrefslogtreecommitdiffstats
path: root/sphinx/project.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/project.py')
-rw-r--r--sphinx/project.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/sphinx/project.py b/sphinx/project.py
index 57813fa..0ac9f1e 100644
--- a/sphinx/project.py
+++ b/sphinx/project.py
@@ -28,7 +28,7 @@ class Project:
#: source_suffix. Same as :confval:`source_suffix`.
self.source_suffix = tuple(source_suffix)
- self._first_source_suffix = next(iter(self.source_suffix), "")
+ self._first_source_suffix = next(iter(self.source_suffix), '')
#: The name of documents belonging to this project.
self.docnames: set[str] = set()
@@ -43,12 +43,12 @@ class Project:
self._path_to_docname = other._path_to_docname
self._docname_to_path = other._docname_to_path
- def discover(self, exclude_paths: Iterable[str] = (),
- include_paths: Iterable[str] = ("**",)) -> set[str]:
+ def discover(
+ self, exclude_paths: Iterable[str] = (), include_paths: Iterable[str] = ('**',)
+ ) -> set[str]:
"""Find all document files in the source directory and put them in
:attr:`docnames`.
"""
-
self.docnames.clear()
self._path_to_docname.clear()
self._docname_to_path.clear()
@@ -56,23 +56,30 @@ class Project:
for filename in get_matching_files(
self.srcdir,
include_paths,
- [*exclude_paths] + EXCLUDE_PATHS,
+ [*exclude_paths, *EXCLUDE_PATHS],
):
if docname := self.path2doc(filename):
if docname in self.docnames:
pattern = os.path.join(self.srcdir, docname) + '.*'
files = [relpath(f, self.srcdir) for f in glob(pattern)]
- logger.warning(__('multiple files found for the document "%s": %r\n'
- 'Use %r for the build.'),
- docname, files, self.doc2path(docname, absolute=True),
- once=True)
+ logger.warning(
+ __(
+ 'multiple files found for the document "%s": %r\n'
+ 'Use %r for the build.'
+ ),
+ docname,
+ files,
+ self.doc2path(docname, absolute=True),
+ once=True,
+ )
elif os.access(os.path.join(self.srcdir, filename), os.R_OK):
self.docnames.add(docname)
self._path_to_docname[filename] = docname
self._docname_to_path[docname] = filename
else:
- logger.warning(__("Ignored unreadable document %r."),
- filename, location=docname)
+ logger.warning(
+ __('Ignored unreadable document %r.'), filename, location=docname
+ )
return self.docnames