Skip to content

Commit

Permalink
Merge "[bugfix] remove content parameter of ItemPage.page_gen method"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Mar 2, 2024
2 parents 1f639e6 + cbbc875 commit 0e24cdc
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions pywikibot/proofreadpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
from pywikibot.data.api import ListGenerator, Request
from pywikibot.exceptions import Error, InvalidTitleError, OtherPageSaveError
from pywikibot.page import PageSourceType
from pywikibot.tools import MediaWikiVersion, cached
from pywikibot.tools import MediaWikiVersion, cached, remove_last_args


try:
Expand Down Expand Up @@ -1305,12 +1305,13 @@ def num_pages(self) -> int:
"""
return len(self._page_from_numbers)

def page_gen(self, start: int = 1,
end: int | None = None,
filter_ql: Sequence[int] | None = None,
only_existing: bool = False,
content: bool = True
) -> Iterable[pywikibot.page.Page]:
@remove_last_args(['content']) # since 9.0.0
def page_gen(
self, start: int = 1,
end: int | None = None,
filter_ql: Sequence[int] | None = None,
only_existing: bool = False
) -> Iterable[pywikibot.page.Page]:
"""Return a page generator which yields pages contained in Index page.
Range is [start ... end], extremes included.
Expand All @@ -1324,7 +1325,6 @@ def page_gen(self, start: int = 1,
:param filter_ql: filters quality levels
if None: all but 'Without Text'.
:param only_existing: yields only existing pages.
:param content: preload content.
"""
if end is None:
end = self.num_pages
Expand All @@ -1346,8 +1346,7 @@ def page_gen(self, start: int = 1,
gen = [(self.get_number(p), p) for p in gen]
gen = [p for n, p in sorted(gen)]

if content:
gen = self.site.preloadpages(gen)
gen = self.site.preloadpages(gen)
# Filter by QL.
gen = (p for p in gen if p.ql in filter_ql)
# Yield only existing.
Expand Down

0 comments on commit 0e24cdc

Please sign in to comment.