Esempio n. 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
 def __makeAbsoluteVerseList( self ):
     """
     Make up a list of four-tuples containing
         BBB, chapterNumber, firstVerseNumber, lastVerseNumber
     """
     accumulatedCount = 0
     for BBB in self.getBookList():
         #print( BBB, BibleVersificationSystem.getNumVersesList( self, BBB ) )
         for j,numVerses in enumerate( BibleVersificationSystem.getNumVersesList( self, BBB ) ):
             #print( BBB, j, numVerses )
             BibleOrganizationalSystem.__absoluteVerseDict[(BBB,j+1)] = (accumulatedCount+1,accumulatedCount+numVerses)
             accumulatedCount += numVerses
Esempio n. 3
0
 def __makeAbsoluteVerseList( self ):
     """
     Make up a list of four-tuples containing
         BBB, chapterNumber, firstVerseNumber, lastVerseNumber
     """
     accumulatedCount = 0
     for BBB in self.getBookList():
         #print( BBB, BibleVersificationSystem.getNumVersesList( self, BBB ) )
         for j,numVerses in enumerate( BibleVersificationSystem.getNumVersesList( self, BBB ) ):
             #print( BBB, j, numVerses )
             BibleOrganisationalSystem.__absoluteVerseDict[(BBB,j+1)] = (accumulatedCount+1,accumulatedCount+numVerses)
             accumulatedCount += numVerses