Dvorapa added a comment.

  Reverting `subcategories` method to its state from May fixes the issue:
  
        def subcategories(self,
                              recurse: Union[int, bool] = False,
                              total: Optional[int] = None,
                              content: bool = False):
                """
                Iterate all subcategories of the current category.
        
                :param recurse: if not False or 0, also iterate subcategories of
                    subcategories. If an int, limit recursion to this number of
                    levels. (Example: recurse=1 will iterate direct subcats and
                    first-level sub-sub-cats, but no deeper.)
                :param total: iterate no more than this number of
                    subcategories in total (at all levels)
                :param content: if True, retrieve the content of the current 
version
                    of each category description page (default False)
                """
                if not isinstance(recurse, bool) and recurse:
                    recurse = recurse - 1
                if not hasattr(self, '_subcats'):
                    self._subcats = []
                    for member in self.site.categorymembers(
                            self, member_type='subcat', total=total, 
content=content):
                        subcat = Category(member)
                        self._subcats.append(subcat)
                        yield subcat
                        if total is not None:
                            total -= 1
                            if total == 0:
                                return
                        if recurse:
                            for item in subcat.subcategories(
                                    recurse, total=total, content=content):
                                yield item
                                if total is not None:
                                    total -= 1
                                    if total == 0:
                                        return
                else:
                    for subcat in self._subcats:
                        yield subcat
                        if total is not None:
                            total -= 1
                            if total == 0:
                                return
                        if recurse:
                            for item in subcat.subcategories(
                                    recurse, total=total, content=content):
                                yield item
                                if total is not None:
                                    total -= 1
                                    if total == 0:
                                        return

TASK DETAIL
  https://phabricator.wikimedia.org/T323413

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Dvorapa
Cc: Xqt, Aklapper, pywikibot-bugs-list, Dvorapa, PotsdamLamb, Jyoo1011, 
JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, 
Mdupont, JJMC89, Altostratus, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to