Skip to content

Commit 7f5ef82

Browse files
committed
chore: Refactor get_outdated_docs to return set instead of generator
1 parent a43d479 commit 7f5ef82

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/sphinxnotes/picker/ext.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"""
1010

1111
from __future__ import annotations
12-
from typing import TYPE_CHECKING
12+
from typing import TYPE_CHECKING, override
1313
import re
1414
from os import path
1515
import time
@@ -23,7 +23,6 @@
2323
from sphinx.application import Sphinx
2424
from sphinx.environment import BuildEnvironment
2525
from sphinx.config import Config as SphinxConfig
26-
from collections.abc import Iterator
2726

2827
from .config import Config
2928
from .snippets import Snippet, WithTitle, Document, Section, Code
@@ -166,12 +165,14 @@ class SnippetBuilder(DummyBuilder): # DummyBuilder has dummy impls we need.
166165
'The snippet builder produces snippets (not to OUTPUTDIR) for use by snippet CLI tool'
167166
)
168167

169-
def get_outdated_docs(self) -> Iterator[str]:
168+
@override
169+
def get_outdated_docs(self) -> set[str]:
170170
"""Modified from :py:meth:`sphinx.builders.html.StandaloneHTMLBuilder.get_outdated_docs`."""
171+
outdated_docs = set()
171172
for docname in self.env.found_docs:
172173
if docname not in self.env.all_docs:
173174
logger.debug('[build target] did not in env: %r', docname)
174-
yield docname
175+
outdated_docs.add(docname)
175176
continue
176177

177178
assert cache is not None
@@ -192,10 +193,11 @@ def get_outdated_docs(self) -> Iterator[str]:
192193
path.getmtime(self.env.doc2path(docname))
193194
),
194195
)
195-
yield docname
196+
outdated_docs.add(docname)
196197
except OSError:
197198
# source doesn't exist anymore
198199
pass
200+
return outdated_docs
199201

200202

201203
def _format_modified_time(timestamp: float) -> str:

0 commit comments

Comments
 (0)