Пример #1
0
    def getNumVersesList(self, BBB, allowAlternatives=False):
        """
        Returns a list containing an integer for each chapter indicating the number of verses.

        The length of the list is the number of chapters in the book.
        """
        if BibleOrgSysGlobals.debugFlag and debuggingThisModule:
            print(exp("getNumVersesList( {} )").format(BBB))
            assert len(BBB) == 3

        if not allowAlternatives:
            return BibleVersificationSystem.getNumVersesList(self, BBB)

        # Well, we are allowed alternatives, but try the given BBB first anyway
        bookVersesList = None
        try:
            bookVersesList = BibleVersificationSystem.getNumVersesList(
                self, BBB)
        except KeyError:  # BBB doesn't exist in this BOS -- try an alternative
            # Next line will raise an error if no alternatives (coz returns None)
            for altBBB in BibleOrgSysGlobals.BibleBooksCodes.getPossibleAlternativeBooksCodes(
                    BBB):
                try:
                    bookVersesList = BibleVersificationSystem.getNumVersesList(
                        self, altBBB)
                    break
                except KeyError:
                    continue  # BBB doesn't exist in this BOS -- try an alternative
            if bookVersesList is not None:
                print("Changed {} to {} in {!r} versification scheme".format(
                    BBB, altBBB,
                    BibleVersificationSystem.getVersificationSystemName(self)))
        return bookVersesList