diff --git a/Apps/ReorderSongs.py b/Apps/ReorderSongs.py
index 3da2bd05..3db33a81 100755
--- a/Apps/ReorderSongs.py
+++ b/Apps/ReorderSongs.py
@@ -45,20 +45,9 @@
etc.
"""
-
from gettext import gettext as _
-
-LAST_MODIFIED_DATE = '2017-09-27' # by RJH
-SHORT_PROGRAM_NAME = "ReorderSongs"
-PROGRAM_NAME = "Reorder Songs"
-PROGRAM_VERSION = '0.03'
-programNameVersion = f'{SHORT_PROGRAM_NAME} v{PROGRAM_VERSION}'
-
-debuggingThisModule = False
-
-
import sys
-import os #, logging
+import os
if __name__ == '__main__':
import sys
@@ -69,6 +58,15 @@
from BibleOrgSys.InputOutput import SFMFile
+LAST_MODIFIED_DATE = '2017-09-27' # by RJH
+SHORT_PROGRAM_NAME = "ReorderSongs"
+PROGRAM_NAME = "Reorder Songs"
+PROGRAM_VERSION = '0.03'
+programNameVersion = f'{SHORT_PROGRAM_NAME} v{PROGRAM_VERSION}'
+
+debuggingThisModule = False
+
+
testFolder = 'Tests/DataFilesForTests/'
testFile = 'Songs.sfm'
outputFolder = BibleOrgSysGlobals.DEFAULT_WRITEABLE_OUTPUT_FOLDERPATH
@@ -87,7 +85,7 @@ def main() -> None:
# Left the four default parameters at the end of the next line so you can see what's available
songs.read( songsInputFilepath, key='c', ignoreSFMs=None, ignoreEntries=None, changePairs=None, encoding='utf-8' )
vPrint( 'Normal', debuggingThisModule, " {} songs loaded".format( len(songs.records) ) )
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, songs )
+ vPrint( 'Never', debuggingThisModule, songs )
# Extract the information out of the file that we want to use for sorting
# (We get the \s field, plus keep track of the index of each record)
diff --git a/BibleOrgSys/BibleOrgSysGlobals.py b/BibleOrgSys/BibleOrgSysGlobals.py
index 7e301aea..7f65c1d5 100755
--- a/BibleOrgSys/BibleOrgSysGlobals.py
+++ b/BibleOrgSys/BibleOrgSysGlobals.py
@@ -1314,8 +1314,8 @@ def setVerbosity( verbosityLevelParameter ):
"""
Sets the VerbosityLevel global variable to an integer value depending on the Verbosity control.
"""
-
global verbosityString, verbosityLevel
+
if isinstance( verbosityLevelParameter, str ):
if verbosityLevelParameter == 'Silent':
verbosityString = verbosityLevelParameter
@@ -1333,6 +1333,7 @@ def setVerbosity( verbosityLevelParameter ):
verbosityString = verbosityLevelParameter
verbosityLevel = 4
else: logging.error( f"Invalid '{verbosityLevelParameter}' verbosity parameter" )
+
else: # assume it's an integer
if verbosityLevelParameter == 0:
verbosityLevel = verbosityLevelParameter
diff --git a/BibleOrgSys/BibleWriter.py b/BibleOrgSys/BibleWriter.py
index 547e14e6..f10a782f 100755
--- a/BibleOrgSys/BibleWriter.py
+++ b/BibleOrgSys/BibleWriter.py
@@ -673,7 +673,7 @@ def toUSFM2( self, outputFolderpath:Optional[Path]=None, removeVerseBridges=Fals
ignoredMarkers.add( pseudoMarker )
continue
#fullText = cleanText # (temp)
- #if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "toUSFM: pseudoMarker = {!r} fullText = {!r}".format( pseudoMarker, fullText ) )
+ #vPrint( 'Never', debuggingThisModule, "toUSFM: pseudoMarker = {!r} fullText = {!r}".format( pseudoMarker, fullText ) )
if removeVerseBridges and pseudoMarker in ('v','c',):
if vBridgeStartInt and vBridgeEndInt:
for vNum in range( vBridgeStartInt+1, vBridgeEndInt+1 ): # Fill in missing verse numbers
@@ -844,7 +844,7 @@ def toUSFM3( self, outputFolderpath:Optional[Path]=None, removeVerseBridges=Fals
addedUSFMfield = True
#fullText = cleanText # (temp)
- #if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "toUSFM: pseudoMarker = {!r} fullText = {!r}".format( pseudoMarker, fullText ) )
+ #vPrint( 'Never', debuggingThisModule, "toUSFM: pseudoMarker = {!r} fullText = {!r}".format( pseudoMarker, fullText ) )
if removeVerseBridges and pseudoMarker in ('v','c',):
if vBridgeStartInt and vBridgeEndInt:
for vNum in range( vBridgeStartInt+1, vBridgeEndInt+1 ): # Fill in missing verse numbers
@@ -1019,7 +1019,7 @@ def toESFM( self, outputFolderpath:Optional[Path]=None ): #, removeVerseBridges=
continue
#value = cleanText # (temp)
- #if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "toESFM: pseudoMarker = {!r} value = {!r}".format( pseudoMarker, value ) )
+ #vPrint( 'Never', debuggingThisModule, "toESFM: pseudoMarker = {!r} value = {!r}".format( pseudoMarker, value ) )
if 0 and removeVerseBridges and pseudoMarker in ('v','c',):
if vBridgeStartInt and vBridgeEndInt:
for vNum in range( vBridgeStartInt+1, vBridgeEndInt+1 ): # Fill in missing verse numbers
@@ -1583,7 +1583,7 @@ def processFigure( MDfigure ):
extra = ''
elif extraType == 'vp':
extra = "\\vp {}\\vp*".format( extraText ) # Will be handled later
- elif BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, 'eT', extraType ); halt
+ elvPrint( 'Never', debuggingThisModule, 'eT', extraType ); halt
#vPrint( 'Quiet', debuggingThisModule, "was", verse )
if extra:
adjText = adjText[:adjIndex] + str(extra) + adjText[adjIndex:]
@@ -1964,7 +1964,7 @@ def processFigure( HTML5figure, ourGlobals ):
extra = ''
elif extraType == 'vp':
extra = "\\vp {}\\vp*".format( extraText ) # Will be handled later
- elif BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, 'eT', extraType ); halt
+ elvPrint( 'Never', debuggingThisModule, 'eT', extraType ); halt
#vPrint( 'Quiet', debuggingThisModule, "was", verse )
adjText = adjText[:adjIndex] + str(extra) + adjText[adjIndex:]
offset -= len( extra )
@@ -2654,7 +2654,7 @@ def savePreviousSection() -> None:
ignoredMarkers.add( pseudoMarker )
continue
#fullText = cleanText # (temp)
- #if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "toUSFM: pseudoMarker = {!r} fullText = {!r}".format( pseudoMarker, fullText ) )
+ #vPrint( 'Never', debuggingThisModule, "toUSFM: pseudoMarker = {!r} fullText = {!r}".format( pseudoMarker, fullText ) )
#vPrint( 'Quiet', debuggingThisModule, 'BDText2', BBB, pseudoMarker, repr(fullText) )
if (BBB=='FRT' and pseudoMarker=='is1') \
@@ -3776,7 +3776,7 @@ def handleInternalTextMarkersForUSX2( originalText ):
"""
if not originalText: return ''
if '\\' not in originalText: return originalText
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "toUSX2XML:hITM4USX:", BBB, C, V, marker, "'"+originalText+"'" )
+ vPrint( 'Never', debuggingThisModule, "toUSX2XML:hITM4USX:", BBB, C, V, marker, "'"+originalText+"'" )
markerList = sorted( BibleOrgSysGlobals.loadedUSFMMarkers.getMarkerListFromText( originalText ),
key=lambda s: -len(s[4])) # Sort by longest characterContext first (maximum nesting)
# for insideMarker, iMIndex, nextSignificantChar, fullMarker, characterContext, endIndex, markerField in markerList: # check for internal markers
@@ -4081,7 +4081,7 @@ def processFootnote( USXfootnote ):
extra = '' # temp
elif extraType == 'vp':
extra = "\\vp {}\\vp*".format( extraText ) # Will be handled later
- elif BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, extraType ); halt
+ elvPrint( 'Never', debuggingThisModule, extraType ); halt
#vPrint( 'Quiet', debuggingThisModule, "was", verse )
adjText = adjText[:adjIndex] + str(extra) + adjText[adjIndex:]
offset -= len( extra )
@@ -4347,7 +4347,7 @@ def handleInternalTextMarkersForUSFX( originalText ):
"""
if not originalText: return ''
if '\\' not in originalText: return originalText
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "toUSFXXML:hITM4USFX:", BBB, C, V, marker, "'"+originalText+"'" )
+ vPrint( 'Never', debuggingThisModule, "toUSFXXML:hITM4USFX:", BBB, C, V, marker, "'"+originalText+"'" )
markerList = sorted( BibleOrgSysGlobals.loadedUSFMMarkers.getMarkerListFromText( originalText ),
key=lambda s: -len(s[4])) # Sort by longest characterContext first (maximum nesting)
for insideMarker, iMIndex, nextSignificantChar, fullMarker, characterContext, endIndex, markerField in markerList: # check for internal markers
@@ -4591,7 +4591,7 @@ def processFootnote( USFXfootnote ):
extra = '' # temp
elif extraType == 'vp':
extra = "\\vp {}\\vp*".format( extraText ) # Will be handled later
- elif BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, extraType ); halt
+ elvPrint( 'Never', debuggingThisModule, extraType ); halt
#vPrint( 'Quiet', debuggingThisModule, "was", verse )
adjText = adjText[:adjIndex] + str(extra) + adjText[adjIndex:]
offset -= len( extra )
@@ -5142,7 +5142,7 @@ def processFootnote( USFMfootnote ):
extra = '' # temp
elif extraType == 'vp':
extra = "\\vp {}\\vp*".format( extraText ) # Will be handled later
- elif BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, extraType ); halt
+ elvPrint( 'Never', debuggingThisModule, extraType ); halt
#vPrint( 'Quiet', debuggingThisModule, "was", verse )
verse = verse[:adjIndex] + str(extra) + verse[adjIndex:]
offset -= len( extra )
@@ -5927,7 +5927,7 @@ def processFootnote( USFMfootnote ):
extra = '' # temp
elif extraType == 'vp':
extra = "\\vp {}\\vp*".format( extraText ) # Will be handled later
- elif BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, extraType ); halt
+ elvPrint( 'Never', debuggingThisModule, extraType ); halt
#vPrint( 'Quiet', debuggingThisModule, "was", verse )
verse = verse[:adjIndex] + str(extra) + verse[adjIndex:]
offset -= len( extra )
@@ -9710,7 +9710,7 @@ def doAllExports( self, givenOutputFolderName=None, wantPhotoBible=None, wantODF
if not self.projectName: self.projectName = self.getAName() # Seems no post-processing was done???
- if givenOutputFolderName == None:
+ if givenOutputFolderName is None:
givenOutputFolderName = BibleOrgSysGlobals.DEFAULT_WRITEABLE_OUTPUT_FOLDERPATH
if not os.access( givenOutputFolderName, os.F_OK ):
vPrint( 'Info', debuggingThisModule, "BibleWriter.doAllExports: " + _("creating {!r} output folder").format( givenOutputFolderName ) )
diff --git a/BibleOrgSys/Formats/BCVBible.py b/BibleOrgSys/Formats/BCVBible.py
index 74990315..b9760b51 100755
--- a/BibleOrgSys/Formats/BCVBible.py
+++ b/BibleOrgSys/Formats/BCVBible.py
@@ -26,6 +26,7 @@
Module for defining and manipulating complete or partial BCV Bibles.
"""
from gettext import gettext as _
+from typing import Optional
import os
import logging
import multiprocessing
@@ -41,7 +42,7 @@
from BibleOrgSys.Internals.InternalBibleInternals import InternalBibleEntryList, InternalBibleEntry
-LAST_MODIFIED_DATE = '2020-04-18' # by RJH
+LAST_MODIFIED_DATE = '2020-05-06' # by RJH
SHORT_PROGRAM_NAME = "BCVBible"
PROGRAM_NAME = "BCV Bible handler"
PROGRAM_VERSION = '0.22'
diff --git a/BibleOrgSys/Formats/PTX8Bible.py b/BibleOrgSys/Formats/PTX8Bible.py
index 66d94dfe..28efd76b 100755
--- a/BibleOrgSys/Formats/PTX8Bible.py
+++ b/BibleOrgSys/Formats/PTX8Bible.py
@@ -2634,7 +2634,7 @@ def loadPTX8TermRenderings( self ):
BibleOrgSysGlobals.checkXMLNoAttributes( sub2element, sub2location )
BibleOrgSysGlobals.checkXMLNoSubelements( sub2element, sub2location )
BibleOrgSysGlobals.checkXMLNoTail( sub2element, sub2location )
- if termRenderingEntryDict[subelement.tag] == None:
+ if termRenderingEntryDict[subelement.tag] is None:
termRenderingEntryDict[subelement.tag] = []
#if sub2element.tag == 'VerseRef':
## Process the VerseRef attributes first
diff --git a/BibleOrgSys/Formats/PickledBible.py b/BibleOrgSys/Formats/PickledBible.py
index 7bd8385b..49c0e191 100755
--- a/BibleOrgSys/Formats/PickledBible.py
+++ b/BibleOrgSys/Formats/PickledBible.py
@@ -45,6 +45,7 @@ class PickledBible( Bible )
loadBooks( self )
"""
from gettext import gettext as _
+from typing import Optional
import os
from pathlib import Path
import logging
@@ -59,13 +60,13 @@ class PickledBible( Bible )
sys.path.insert( 0, aboveAboveFolderpath )
from BibleOrgSys import BibleOrgSysGlobals
from BibleOrgSys.BibleOrgSysGlobals import vPrint
-from BibleOrgSys.Bible import Bible
+from BibleOrgSys.Bible import Bible, BibleBook
from BibleOrgSys.Internals.InternalBibleBook import InternalBibleBook
from BibleOrgSys.Internals.InternalBibleInternals import InternalBibleEntryList
from BibleOrgSys.Internals.InternalBibleIndexes import InternalBibleCVIndex, InternalBibleSectionIndex
-LAST_MODIFIED_DATE = '2020-04-15' # by RJH
+LAST_MODIFIED_DATE = '2020-05-07' # by RJH
SHORT_PROGRAM_NAME = "PickledBible"
PROGRAM_NAME = "Pickle Bible handler"
PROGRAM_VERSION = '0.17'
@@ -546,7 +547,7 @@ def __str__( self ) -> str:
@return: the name of a Bible object formatted as a string
@rtype: string
"""
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "PickledBible.__str__()" )
+ vPrint( 'Never', debuggingThisModule, "PickledBible.__str__()" )
set1 = ( 'Title', 'Description', 'Version', 'Revision', ) # Ones to print at verbosityLevel > 1
set2 = ( 'Status', 'Font', 'Copyright', 'Licence', ) # Ones to print at verbosityLevel > 2
diff --git a/BibleOrgSys/Formats/SwordResources.py b/BibleOrgSys/Formats/SwordResources.py
index 6fb2455b..d896de87 100755
--- a/BibleOrgSys/Formats/SwordResources.py
+++ b/BibleOrgSys/Formats/SwordResources.py
@@ -343,7 +343,7 @@ def handleOSISWordAttributes( attributeString ):
'mapm','oshb','oss','porcap','ruscars','russynodal',) \
and BBB not in ('EZR','NEH','EST','JOB','PSA','PRO','ECC',): # not sure what this is about---------needs attention
assert V == '0'
- #if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "CCCC {!r}(:{!r})".format( C, V ) )
+ #vPrint( 'Never', debuggingThisModule, "CCCC {!r}(:{!r})".format( C, V ) )
verseLine = verseLine[:match.start()] + verseLine[match.end():]
match = re.search( ']*?)osisID="([^/>]+?)"([^/>]*?)>', verseLine ) # open chapter container
if match:
@@ -351,7 +351,7 @@ def handleOSISWordAttributes( attributeString ):
#vPrint( 'Quiet', debuggingThisModule, 'Chapter osisID {!r} attributes={!r} @ {} {}:{}'.format( osisID, attributes, BBB, C, V ) )
#assert C and C != '0'
assert V == '0'
- #if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "CCCC {!r}(:{!r})".format( C, V ) )
+ #vPrint( 'Never', debuggingThisModule, "CCCC {!r}(:{!r})".format( C, V ) )
verseLine = verseLine[:match.start()] + verseLine[match.end():]
verseLine = verseLine.replace( '', '' )
while True:
@@ -390,7 +390,7 @@ def handleOSISWordAttributes( attributeString ):
match = re.search( '
]*?)type="([^/>]+?)"([^/>]*?)/>.NL..(.+?)', verseLine )
if not match: break
attributes, sectionType, words = match.group(1) + match.group(3), match.group(2), match.group(4)
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, 'Section title {!r} attributes={!r} Words={!r}'.format( sectionType, attributes, words ) )
+ vPrint( 'Never', debuggingThisModule, 'Section title {!r} attributes={!r} Words={!r}'.format( sectionType, attributes, words ) )
if sectionType == 'outline': titleMarker = 'iot'
else: vPrint( 'Quiet', debuggingThisModule, 'filterOSISVerseLine KG535 matched:', repr(match.group(0)) ); halt
replacement = '\\NL**\\{} {}\\NL**'.format( titleMarker, words )
@@ -400,7 +400,7 @@ def handleOSISWordAttributes( attributeString ):
match = re.search( ']*?)type="([^/>]+?)"([^/>]*?)/?>', verseLine )
if not match: break
attributes, divType = match.group(1) + match.group(3), match.group(2)
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, 'Div type={!r} attributes={!r}'.format( divType, attributes ) )
+ vPrint( 'Never', debuggingThisModule, 'Div type={!r} attributes={!r}'.format( divType, attributes ) )
if divType == 'x-p': replacement = '\\NL**\\p\\NL**'
elif divType == 'glossary': replacement = '\\NL**\\id GLO\\NL**' #### WEIRD -- appended to 3 John
elif divType == 'book': replacement = '' # We don't need this
@@ -426,7 +426,7 @@ def handleOSISWordAttributes( attributeString ):
match = re.search( '(.+?)', verseLine )
if not match: break
reference = match.group(1)
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, 'Parallel reference={!r}'.format( reference ) )
+ vPrint( 'Never', debuggingThisModule, 'Parallel reference={!r}'.format( reference ) )
replacement = '\\NL**\\r {}\\NL**'.format( reference )
#vPrint( 'Quiet', debuggingThisModule, 'replacement', repr(replacement) )
verseLine = verseLine[:match.start()] + replacement + verseLine[match.end():]
@@ -434,7 +434,7 @@ def handleOSISWordAttributes( attributeString ):
match = re.search( '(.+?)', verseLine )
if not match: break
reference = match.group(1)
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, 'Section Parallel reference={!r}'.format( reference ) )
+ vPrint( 'Never', debuggingThisModule, 'Section Parallel reference={!r}'.format( reference ) )
replacement = '\\NL**\\sr {}\\NL**'.format( reference )
#vPrint( 'Quiet', debuggingThisModule, 'replacement', repr(replacement) )
verseLine = verseLine[:match.start()] + replacement + verseLine[match.end():]
@@ -442,7 +442,7 @@ def handleOSISWordAttributes( attributeString ):
match = re.search( ']+?)>(.+?)', verseLine )
if not match: break
attributes, words = match.group(1), match.group(2)
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, 'Title attributes={!r} Words={!r}'.format( attributes, words ) )
+ vPrint( 'Never', debuggingThisModule, 'Title attributes={!r} Words={!r}'.format( attributes, words ) )
titleMarker = 's1'
replacement = '\\NL**\\{} {}\\NL**'.format( titleMarker, words )
#vPrint( 'Quiet', debuggingThisModule, 'replacement', repr(replacement) )
@@ -575,7 +575,7 @@ def handleOSISWordAttributes( attributeString ):
match = re.search( ' ]*?)type="(.+?)"([^/>]*?)>', verseLine )
if match: # Handle left-over list items
attributes, itemType = match.group(1)+match.group(3), match.group(2)
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, 'Item Type={!r} attributes={!r}'.format( itemType, attributes ) )
+ vPrint( 'Never', debuggingThisModule, 'Item Type={!r} attributes={!r}'.format( itemType, attributes ) )
assert itemType in ( 'x-indent-1', 'x-indent-2', )
marker = 'io' if 'x-introduction' in attributes else 'li'
replacement = '\\NL**\\{}\\NL**'.format( marker+itemType[-1] )
@@ -586,7 +586,7 @@ def handleOSISWordAttributes( attributeString ):
match = re.search( ']*?)type="(.+?)"([^/>]*?)>(.+?)', verseLine )
if not match: break
attributes, nameType, name = match.group(1)+match.group(3), match.group(2), match.group(4)
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, 'Name={!r} Type={!r} attributes={!r}'.format( name, nameType, attributes ) )
+ vPrint( 'Never', debuggingThisModule, 'Name={!r} Type={!r} attributes={!r}'.format( name, nameType, attributes ) )
if nameType == 'x-workTitle': marker = 'bk'
else: halt
replacement = '\\{} {}\\{}*'.format( marker, name, marker )
@@ -596,7 +596,7 @@ def handleOSISWordAttributes( attributeString ):
match = re.search( ']+?)>([^<]+?)', verseLine )
if not match: break
attributes, words = match.group(1), match.group(2)
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, 'Seg attributes={!r} Words={!r}'.format( attributes, words ) )
+ vPrint( 'Never', debuggingThisModule, 'Seg attributes={!r} Words={!r}'.format( attributes, words ) )
if 'type="keyword"' in attributes: replacement = '\\k {}\\k*'.format( words)
elif 'type="verseNumber"' in attributes: replacement = '\\vp {}\\NL**'.format( words)
elif 'type="x-us-time"' in attributes: replacement = '{}'.format( words)
diff --git a/BibleOrgSys/Formats/USFM2Bible.py b/BibleOrgSys/Formats/USFM2Bible.py
index 08d4ca85..0e7eec57 100755
--- a/BibleOrgSys/Formats/USFM2Bible.py
+++ b/BibleOrgSys/Formats/USFM2Bible.py
@@ -293,7 +293,7 @@ def findReplaceText( self, optionsDict, confirmCallback ):
assert 'findText' in optionsDict
assert 'replaceText' in optionsDict
- optionsList = ( 'parentApp', 'parentWindow', 'parentBox', 'givenBible', 'workName',
+ optionsList = ( 'parentWindow', 'parentBox', 'givenBible', 'workName',
'findText', 'replaceText', 'findHistoryList', 'replaceHistoryList', 'wordMode',
#'caselessFlag', 'ignoreDiacriticsFlag', 'includeIntroFlag', 'includeMainTextFlag',
#'includeMarkerTextFlag', 'includeExtrasFlag', 'markerList', 'chapterList',
diff --git a/BibleOrgSys/Formats/USFMBible.py b/BibleOrgSys/Formats/USFMBible.py
index 85cf78fe..da1a647b 100755
--- a/BibleOrgSys/Formats/USFMBible.py
+++ b/BibleOrgSys/Formats/USFMBible.py
@@ -264,7 +264,7 @@ def findReplaceText( self, optionsDict, confirmCallback ):
assert 'findText' in optionsDict
assert 'replaceText' in optionsDict
- optionsList = ( 'parentApp', 'parentWindow', 'parentBox', 'givenBible', 'workName',
+ optionsList = ( 'parentWindow', 'parentBox', 'givenBible', 'workName',
'findText', 'replaceText', 'findHistoryList', 'replaceHistoryList', 'wordMode',
#'caselessFlag', 'ignoreDiacriticsFlag', 'includeIntroFlag', 'includeMainTextFlag',
#'includeMarkerTextFlag', 'includeExtrasFlag', 'markerList', 'chapterList',
diff --git a/BibleOrgSys/Formats/USXXMLBible.py b/BibleOrgSys/Formats/USXXMLBible.py
index 289201b0..eb8f769c 100755
--- a/BibleOrgSys/Formats/USXXMLBible.py
+++ b/BibleOrgSys/Formats/USXXMLBible.py
@@ -518,7 +518,7 @@ def handleInternalTextMarkersForUSX3( originalText ):
"""
if not originalText: return ''
if '\\' not in originalText: return originalText
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "toUSXXML:hITM4USX:", BBB, C,V, marker, "'"+originalText+"'" )
+ vPrint( 'Never', debuggingThisModule, "toUSXXML:hITM4USX:", BBB, C,V, marker, "'"+originalText+"'" )
markerList = sorted( BibleOrgSysGlobals.loadedUSFMMarkers.getMarkerListFromText( originalText ),
key=lambda s: -len(s[4])) # Sort by longest characterContext first (maximum nesting)
# for insideMarker, iMIndex, nextSignificantChar, fullMarker, characterContext, endIndex, markerField in markerList: # check for internal markers
@@ -839,7 +839,7 @@ def processFootnote( USXfootnote:str ) -> str:
extra = '' # temp
elif extraType == 'vp':
extra = "\\vp {}\\vp*".format( extraText ) # Will be handled later
- elif BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, extraType ); halt
+ elvPrint( 'Never', debuggingThisModule, extraType ); halt
#vPrint( 'Quiet', debuggingThisModule, "was", verse )
adjText = adjText[:adjIndex] + str(extra) + adjText[adjIndex:]
offset -= len( extra )
diff --git a/BibleOrgSys/InputOutput/ControlFiles.py b/BibleOrgSys/InputOutput/ControlFiles.py
index fcf7f3de..64180070 100755
--- a/BibleOrgSys/InputOutput/ControlFiles.py
+++ b/BibleOrgSys/InputOutput/ControlFiles.py
@@ -136,7 +136,7 @@ def booleanValue ( value ):
def booleanControl( controlName, controlDict=None ):
"""Return True if the given control name exists in the control dictionary
and has a suitable value such as TRUE or ON."""
- if controlDict==None: controlDict = Controls
+ if controlDict is None: controlDict = Controls
if controlName not in controlDict:
return False
diff --git a/BibleOrgSys/InputOutput/USFMFilenames.py b/BibleOrgSys/InputOutput/USFMFilenames.py
index 5f3be09f..5ea40c14 100755
--- a/BibleOrgSys/InputOutput/USFMFilenames.py
+++ b/BibleOrgSys/InputOutput/USFMFilenames.py
@@ -98,7 +98,7 @@ def __init__( self, givenFolderName ):
bbb = book code (lower case) or BBB = book code (UPPER CASE)
dd = digits
"""
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "USFMFilenames( {} )".format( givenFolderName ) )
+ vPrint( 'Never', debuggingThisModule, "USFMFilenames( {} )".format( givenFolderName ) )
self.givenFolderName = givenFolderName
self.pattern, self.fileExtension = '', ''
self.fileList = [] # A list of all files in our folder (excluding folder names and backup filenames)
@@ -319,7 +319,7 @@ def getUSFMIDsFromFiles( self, givenFolder ):
Populates the two dictionaries.
Returns the number of files found.
"""
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "getUSFMIDsFromFiles( {} )".format( repr(givenFolder) ) )
+ vPrint( 'Never', debuggingThisModule, "getUSFMIDsFromFiles( {} )".format( repr(givenFolder) ) )
# Empty the two dictionaries
self._fileDictionary = {} # The keys are 2-tuples of folder, filename, the values are all valid BBB values
@@ -436,7 +436,7 @@ def getConfirmedFilenameTuples( self, strictCheck=False ):
resultList = []
for BBB,derivedFilename in self.getDerivedFilenameTuples():
derivedFilepath = os.path.join( self.givenFolderName, derivedFilename )
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, ' getConfirmedFilenameTuples: Checking for existence of: ' + derivedFilename )
+ vPrint( 'Never', debuggingThisModule, ' getConfirmedFilenameTuples: Checking for existence of: ' + derivedFilename )
if os.access( derivedFilepath, os.R_OK ):
if strictCheck:
USFMId = self.getUSFMIDFromFile( self.givenFolderName, derivedFilename, derivedFilepath )
diff --git a/BibleOrgSys/Internals/InternalBible.py b/BibleOrgSys/Internals/InternalBible.py
index f02ddc9c..d445ba43 100755
--- a/BibleOrgSys/Internals/InternalBible.py
+++ b/BibleOrgSys/Internals/InternalBible.py
@@ -74,7 +74,7 @@
from BibleOrgSys.Reference.VerseReferences import SimpleVerseKey
-LAST_MODIFIED_DATE = '2020-05-06' # by RJH
+LAST_MODIFIED_DATE = '2020-05-10' # by RJH
SHORT_PROGRAM_NAME = "InternalBible"
PROGRAM_NAME = "Internal Bible handler"
PROGRAM_VERSION = '0.84'
@@ -86,10 +86,10 @@
OT39_BOOKLIST = ( 'GEN', 'EXO', 'LEV', 'NUM', 'DEU', 'JOS', 'JDG', 'RUT', 'SA1', 'SA2', 'KI1', 'KI2', 'CH1', 'CH2', \
'EZR', 'NEH', 'EST', 'JOB', 'PSA', 'PRO', 'ECC', 'SNG', 'ISA', 'JER', 'LAM', 'EZE', 'DAN', \
'HOS', 'JOL', 'AMO', 'OBA', 'JNA', 'MIC', 'NAH', 'HAB', 'ZEP', 'HAG', 'ZEC', 'MAL' )
-assert len(OT39_BOOKLIST) == 39
+assert len( OT39_BOOKLIST ) == 39
NT27_BOOKLIST = ( 'MAT', 'MRK', 'LUK', 'JHN', 'ACT', 'ROM', 'CO1', 'CO2', 'GAL', 'EPH', 'PHP', 'COL', \
'TH1', 'TH2', 'TI1', 'TI2', 'TIT', 'PHM', 'HEB', 'JAM', 'PE1', 'PE2', 'JN1', 'JN2', 'JN3', 'JDE', 'REV' )
-assert len(NT27_BOOKLIST) == 27
+assert len( NT27_BOOKLIST ) == 27
@@ -120,6 +120,7 @@ def __init__( self ):
# Set up empty containers for the object
self.books = {}
self.availableBBBs = set() # Will eventually contain a set of the books codes which we know are in this particular Bible (even if the book is not loaded yet)
+ self.givenBookList = [] # Only if we're given this (cf. deduced)
self.suppliedMetadata = None
self.settingsDict = {} # This is often filled from self.suppliedMetadata in applySuppliedMetadata()
self.BBBToNameDict, self.bookNameDict, self.combinedBookNameDict, self.bookAbbrevDict = {}, {}, {}, {} # Used to store book name and abbreviations (pointing to the BBB codes)
@@ -139,7 +140,7 @@ def __str__( self ) -> str:
@return: the name of a Bible object formatted as a string
@rtype: string
"""
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "InternalBible.__str__()…" )
+ vPrint( 'Never', debuggingThisModule, "InternalBible.__str__()…" )
set1 = ( 'Title', 'Description', 'Version', 'Revision', ) # Ones to print at verbosityLevel > 1
set2 = ( 'Status', 'Font', 'Copyright', 'Licence', ) # Ones to print at verbosityLevel > 2
@@ -765,8 +766,8 @@ def applySuppliedMetadata( self, applyMetadataType ):
filename = bookDict['path']
if filename.startswith( './' ): filename = filename[2:]
self.possibleFilenameDict[BBB] = filename
+ self.givenBookList.append( BBB )
self.availableBBBs.add( BBB )
- self.givenBookList = self.availableBBBs # TODO: Clean this up
elif applyMetadataType == 'OSIS':
# Available fields include: Version, Creator, Contributor, Subject, Format, Type, Identifier, Source,
@@ -866,7 +867,7 @@ def getSetting( self, settingName ):
Returns None if nothing found.
"""
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, _("getSetting( {} )").format( settingName ) )
+ vPrint( 'Never', debuggingThisModule, _("getSetting( {} )").format( settingName ) )
#vPrint( 'Quiet', debuggingThisModule, "\nSettingsDict:", self.settingsDict )
#vPrint( 'Quiet', debuggingThisModule, "\nSupplied Metadata:", self.suppliedMetadata )
@@ -1024,7 +1025,7 @@ def guessXRefBBB( self, referenceString:str ) -> str:
for BBB in self.reverseDict: assert self.reverseDict[BBB] != referenceString
# See if a book name starts with this string
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, " getXRefBBB using startswith1…" )
+ vPrint( 'Never', debuggingThisModule, " getXRefBBB using startswith1…" )
count = 0
for bookName in self.bookNameDict:
if bookName.startswith( adjRefString ):
@@ -1049,7 +1050,7 @@ def guessXRefBBB( self, referenceString:str ) -> str:
if BibleOrgSysGlobals.debugFlag and debuggingThisModule and count > 1:
vPrint( 'Quiet', debuggingThisModule, _(" guessXRefBBB has multiple startswith matches for {!r} in {}").format( adjRefString, self.combinedBookNameDict ) )
if count == 0:
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, " getXRefBBB using startswith2…" )
+ vPrint( 'Never', debuggingThisModule, " getXRefBBB using startswith2…" )
for bookName in self.combinedBookNameDict:
if bookName.startswith( adjRefString ):
BBB = self.combinedBookNameDict[bookName]
@@ -1073,7 +1074,7 @@ def guessXRefBBB( self, referenceString:str ) -> str:
# See if a book name contains a word that starts with this string
if count == 0:
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, " getXRefBBB using word startswith…" )
+ vPrint( 'Never', debuggingThisModule, " getXRefBBB using word startswith…" )
for bookName in self.bookNameDict:
if ' ' in bookName:
for bit in bookName.split():
@@ -1090,7 +1091,7 @@ def guessXRefBBB( self, referenceString:str ) -> str:
# See if a book name starts with the same letter plus contains the letters in this string (slow)
if count == 0:
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, _(" guessXRefBBB using first plus other characters…") )
+ vPrint( 'Never', debuggingThisModule, _(" guessXRefBBB using first plus other characters…") )
for bookName in self.bookNameDict:
if not bookName: vPrint( 'Quiet', debuggingThisModule, self.bookNameDict ); halt # temp……
#vPrint( 'Quiet', debuggingThisModule, "aRS={!r}, bN={!r}".format( adjRefString, bookName ) )
@@ -1114,7 +1115,7 @@ def guessXRefBBB( self, referenceString:str ) -> str:
if 0: # Too error prone!!!
# See if a book name contains the letters in this string (slow)
if count == 0:
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, " getXRefBBB using characters…" )
+ vPrint( 'Never', debuggingThisModule, " getXRefBBB using characters…" )
for bookName in self.bookNameDict:
found = True
for char in adjRefString:
@@ -1501,7 +1502,7 @@ def check( self, givenBookList=None ):
if BibleOrgSysGlobals.debugFlag: assert self.discoveryResults
vPrint( 'Info', debuggingThisModule, _("Running checks on {}…").format( self.name ) )
if givenBookList is None:
- givenBookList = self.books # this is a dict
+ givenBookList = self.books.keys()
for BBB in givenBookList: # Do individual book checks
vPrint( 'Info', debuggingThisModule, " " + _("Checking {}…").format( BBB ) )
self.books[BBB].check( self.discoveryResults['ALL'], typicalAddedUnitData )
@@ -1522,7 +1523,7 @@ def doExtensiveChecks( self, givenOutputFolderName=None, ntFinished=None, otFini
"""
vPrint( 'Normal', debuggingThisModule, "InternalBible-V{}.doExtensiveChecks: ".format(PROGRAM_VERSION) + _("Doing extensive checks on {} ({})…").format( self.name, self.objectTypeString ) )
- if givenOutputFolderName == None:
+ if givenOutputFolderName is None:
givenOutputFolderName = BibleOrgSysGlobals.DEFAULT_WRITEABLE_OUTPUT_FOLDERPATH.joinpath( 'CheckResultFiles/' )
if not os.access( givenOutputFolderName, os.F_OK ):
if 1 or BibleOrgSysGlobals.verbosityLevel > 2: vPrint( 'Quiet', debuggingThisModule, "BibleWriter.doExtensiveChecks: " + _("creating {!r} output folder").format( givenOutputFolderName ) )
@@ -1568,7 +1569,7 @@ def getCheckResults( self, givenBookList=None ):
['Headings']: dict
['ByCategory']: dict
"""
- if givenBookList is None: givenBookList = self.books # this is a dict
+ if givenBookList is None: givenBookList = self.books.keys() # this is a dict
def appendList( BBB, errorDict, firstKey, secondKey=None ):
"""Appends a list to the ALL BOOKS errors."""
@@ -1755,7 +1756,7 @@ def makeErrorHTML( self, givenOutputFolder, givenBookList=None, titlePrefix=None
#vPrint( 'Info', debuggingThisModule, "Doing Bible checks…" )
errorDictionary = self.getCheckResults( givenBookList )
- if givenBookList is None: givenBookList = self.books # this is a dict
+ if givenBookList is None: givenBookList = self.books.keys() # this is a dict
# Note that this requires a CSS file called Overall.css
if webPageTemplate is None:
@@ -2328,7 +2329,7 @@ def findText( self, optionsDict ):
vPrint( 'Quiet', debuggingThisModule, _("findText( {} )").format( optionsDict ) )
assert 'findText' in optionsDict
- optionsList = ( 'parentApp', 'parentWindow', 'parentBox', 'givenBible', 'workName',
+ optionsList = ( 'parentWindow', 'parentBox', 'givenBible', 'workName',
'findText', 'findHistoryList', 'wordMode', 'caselessFlag', 'ignoreDiacriticsFlag',
'includeIntroFlag', 'includeMainTextFlag', 'includeMarkerTextFlag', 'includeExtrasFlag',
'contextLength', 'bookList', 'chapterList', 'markerList', 'regexFlag',
diff --git a/BibleOrgSys/Internals/InternalBibleBook.py b/BibleOrgSys/Internals/InternalBibleBook.py
index 8922af7c..61783ded 100755
--- a/BibleOrgSys/Internals/InternalBibleBook.py
+++ b/BibleOrgSys/Internals/InternalBibleBook.py
@@ -73,7 +73,7 @@
from BibleOrgSys.Reference.BibleReferences import BibleAnchorReference
-LAST_MODIFIED_DATE = '2020-05-06' # by RJH
+LAST_MODIFIED_DATE = '2020-05-12' # by RJH
SHORT_PROGRAM_NAME = "InternalBibleBook"
PROGRAM_NAME = "Internal Bible book handler"
PROGRAM_VERSION = '0.97'
@@ -2727,8 +2727,8 @@ def getVersification( self ):
#vPrint( 'Quiet', debuggingThisModule, "{} chapter {}".format( self.BBB, chapterText ) )
chapterNumber = int( chapterText)
if chapterNumber != lastChapterNumber+1:
- versificationErrors.append( _("{} ({} after {}) USFM chapter numbers out of sequence in Bible book").format( self.BBB, chapterNumber, lastChapterNumber ) )
- logging.error( _("USFM chapter numbers out of sequence in Bible book {} ({} after {})").format( self.BBB, chapterNumber, lastChapterNumber ) )
+ versificationErrors.append( _("{} ({} after {}) USFM chapter numbers out of sequence in {} Bible book").format( self.BBB, chapterNumber, lastChapterNumber, self.workName ) )
+ logging.error( _("USFM chapter numbers out of sequence in {} Bible book {} ({} after {})").format( self.workName, self.BBB, chapterNumber, lastChapterNumber ) )
lastChapterNumber = chapterNumber
verseText = verseNumberString = lastVerseNumberString = '0'
elif marker == 'cp':
@@ -2838,7 +2838,7 @@ def getVersificationIfNecessary( self ):
Stores it in self.versification and self.missingVersesList
"""
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "getVersificationIfNecessary()" )
+ vPrint( 'Never', debuggingThisModule, "getVersificationIfNecessary()" )
if self.versificationList is None:
assert self.omittedVersesList is None and self.combinedVersesList is None and self.reorderedVersesList is None # also
versificationResult = self.getVersification()
@@ -4752,7 +4752,7 @@ def getNumChapters( self ) -> int:
"""
Returns the number of chapters (int) in this book.
"""
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "getNumChapters()" )
+ vPrint( 'Never', debuggingThisModule, "getNumChapters()" )
self.getVersificationIfNecessary()
#vPrint( 'Quiet', debuggingThisModule, self.getVersification() )
@@ -4792,8 +4792,8 @@ def getContextVerseData( self, BCVReference ):
if BibleOrgSysGlobals.debugFlag:
if debuggingThisModule:
vPrint( 'Quiet', debuggingThisModule, "InternalBibleBook.getContextVerseData( {} ) for {}".format( BCVReference, self.BBB ) )
- assert self._processedFlag
- assert self._indexedCVFlag
+ # assert self._processedFlag
+ # assert self._indexedCVFlag
if isinstance( BCVReference, tuple ): assert BCVReference[0] == self.BBB
else: assert BCVReference.getBBB() == self.BBB
diff --git a/BibleOrgSys/Misc/USFMBookCompare.py b/BibleOrgSys/Misc/USFMBookCompare.py
index 7a9521ef..a9238d00 100755
--- a/BibleOrgSys/Misc/USFMBookCompare.py
+++ b/BibleOrgSys/Misc/USFMBookCompare.py
@@ -257,10 +257,10 @@ def USFMBookCompare( filepath1, filepath2, file1Name='file1', file2Name='file2'
startedCVs1 = startedCVs2 = False
while True:
if lineIndex >= resultDict['File1']['LineCount']:
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "File1 done" )
+ vPrint( 'Never', debuggingThisModule, "File1 done" )
break
if lineIndex >= resultDict['File2']['LineCount']:
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "File2 done" )
+ vPrint( 'Never', debuggingThisModule, "File2 done" )
break
(m1,l1), (m2,l2) = uf1.lines[lineIndex], uf2.lines[lineIndex+lineOffset]
#vPrint( 'Quiet', debuggingThisModule, lineIndex, lineOffset, m1, m2 )
diff --git a/BibleOrgSys/Online/DBPOnline.py b/BibleOrgSys/Online/DBPOnline.py
index 9dd1b63d..9bdd9860 100755
--- a/BibleOrgSys/Online/DBPOnline.py
+++ b/BibleOrgSys/Online/DBPOnline.py
@@ -512,7 +512,7 @@ def __init__( self, damRoot ) -> None:
#self.bookList = None
if self.onlineVersion: # Check that this particular resource is available by getting a list of books
bookList = self.getOnlineData( "library/book", "dam_id="+self.damRoot ) # Get an ordered list of dictionaries -- one for each book
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "DBPBible.__init__: bookList", len(bookList))#, bookList )
+ vPrint( 'Never', debuggingThisModule, "DBPBible.__init__: bookList", len(bookList))#, bookList )
#if 0:# Get all book codes and English names
#bookCodeDictList = self.getOnlineData( "library/bookname", "language_code=ENG" )
diff --git a/BibleOrgSys/Online/Door43ContentServiceOnline.py b/BibleOrgSys/Online/Door43ContentServiceOnline.py
index ed9cd2b8..7d599538 100755
--- a/BibleOrgSys/Online/Door43ContentServiceOnline.py
+++ b/BibleOrgSys/Online/Door43ContentServiceOnline.py
@@ -54,7 +54,7 @@
from BibleOrgSys.Formats.USFMBible import USFMBible
-LAST_MODIFIED_DATE = '2020-04-22' # by RJH
+LAST_MODIFIED_DATE = '2020-05-06' # by RJH
SHORT_PROGRAM_NAME = "Door43ContentService"
PROGRAM_NAME = "Door43 Content Service online handler"
PROGRAM_VERSION = '0.04'
@@ -460,6 +460,7 @@ def briefDemo() -> None:
Demonstrate how some of the above classes can be used.
"""
from BibleOrgSys.Reference.VerseReferences import SimpleVerseKey
+ import random
BibleOrgSysGlobals.introduceProgram( __name__, programNameVersion, LAST_MODIFIED_DATE )
@@ -498,7 +499,7 @@ def processSearchResult( searchResult:dict, downloadAllBooks:bool=False ) -> Non
vPrint( 'Quiet', debuggingThisModule, f"Unexpected search result: {searchResult}" )
# end of processSearchResult function
- if 1: # Test the DCSBible class with the ULT
+ if random.random() > 0.5: # Test the DCSBible class with the ULT
if BibleOrgSysGlobals.verbosityLevel > 0: vPrint( 'Quiet', debuggingThisModule, "\n\nB/ ULT test")
downloadAllBooks = True
searchResult = dcsBibles.searchReposExact( 'unfoldingWord', 'en_ult' )
diff --git a/BibleOrgSys/Online/Door43OnlineCatalog.py b/BibleOrgSys/Online/Door43OnlineCatalog.py
index 4624bce5..1908cbc7 100755
--- a/BibleOrgSys/Online/Door43OnlineCatalog.py
+++ b/BibleOrgSys/Online/Door43OnlineCatalog.py
@@ -44,18 +44,20 @@
import tempfile
import zipfile
from datetime import datetime
+import logging
if __name__ == '__main__':
import sys
- import re
-import logging # Append the containing folder to the path to search for the BOS
+ aboveAboveFolderpath = os.path.dirname( os.path.dirname( os.path.dirname( os.path.abspath( __file__ ) ) ) )
+ if aboveAboveFolderpath not in sys.path:
+ sys.path.insert( 0, aboveAboveFolderpath )
from BibleOrgSys import BibleOrgSysGlobals
from BibleOrgSys.BibleOrgSysGlobals import vPrint
from BibleOrgSys.Misc.singleton import singleton
from BibleOrgSys.Formats.USFMBible import USFMBible
-LAST_MODIFIED_DATE = '2020-05-06' # by RJH
+LAST_MODIFIED_DATE = '2020-05-07' # by RJH
SHORT_PROGRAM_NAME = "Door43OnlineCatalog"
PROGRAM_NAME = "Door43 Online Catalog online handler"
PROGRAM_VERSION = '0.08'
@@ -549,7 +551,7 @@ def briefDemo() -> None:
('MAT','1','1'), ('JHN','3','16'), ('TIT','2','2'), ('JDE','1','14'), ('REV','22','21'), )
if 1: # Test the Door43CatalogBible class by finding a Bible
- for lgCode, desiredTitle in random.choice( (
+ lgCode, desiredTitle = random.choice( (
('ru','Russian Synodal Bible'),
('ru','Russian Unlocked Literal Bible'),
('ru','Russian Open Bible'),
@@ -558,23 +560,22 @@ def briefDemo() -> None:
('en', 'unfoldingWord Simplified Text'),
('fr','unfoldingWord Literal Text'),
('el-x-koine','unfoldingWord Greek New Testament'),
- ) ):
- vPrint( 'Quiet', debuggingThisModule, '' )
- searchResultDict = door43CatalogResources.searchBibles( lgCode, desiredTitle )
- if searchResultDict:
- Door43CatalogBible1 = Door43CatalogBible( searchResultDict )
- vPrint( 'Quiet', debuggingThisModule, Door43CatalogBible1 )
- Door43CatalogBible1.preload()
- vPrint( 'Quiet', debuggingThisModule, Door43CatalogBible1 )
- for testRef in testRefs:
- verseKey = SimpleVerseKey( *testRef )
- if BibleOrgSysGlobals.verbosityLevel > 0:
- vPrint( 'Quiet', debuggingThisModule, verseKey )
- vPrint( 'Quiet', debuggingThisModule, " ", Door43CatalogBible1.getVerseDataList( verseKey ) )
- vPrint( 'Quiet', debuggingThisModule, Door43CatalogBible1 )
- break
- elif BibleOrgSysGlobals.verbosityLevel > 0:
- vPrint( 'Quiet', debuggingThisModule, f"{lgCode} '{desiredTitle}' was not found!" )
+ ) )
+ vPrint( 'Quiet', debuggingThisModule, '' )
+ searchResultDict = door43CatalogResources.searchBibles( lgCode, desiredTitle )
+ if searchResultDict:
+ Door43CatalogBible1 = Door43CatalogBible( searchResultDict )
+ vPrint( 'Quiet', debuggingThisModule, Door43CatalogBible1 )
+ Door43CatalogBible1.preload()
+ vPrint( 'Quiet', debuggingThisModule, Door43CatalogBible1 )
+ for testRef in testRefs:
+ verseKey = SimpleVerseKey( *testRef )
+ if BibleOrgSysGlobals.verbosityLevel > 0:
+ vPrint( 'Quiet', debuggingThisModule, verseKey )
+ vPrint( 'Quiet', debuggingThisModule, " ", Door43CatalogBible1.getVerseDataList( verseKey ) )
+ vPrint( 'Quiet', debuggingThisModule, Door43CatalogBible1 )
+ elif BibleOrgSysGlobals.verbosityLevel > 0:
+ vPrint( 'Quiet', debuggingThisModule, f"{lgCode} '{desiredTitle}' was not found!" )
# end of Door43OnlineCatalog.briefDemo
def fullDemo() -> None:
diff --git a/BibleOrgSys/Online/GenericOnlineBible.py b/BibleOrgSys/Online/GenericOnlineBible.py
index 2e509fef..a237c75e 100755
--- a/BibleOrgSys/Online/GenericOnlineBible.py
+++ b/BibleOrgSys/Online/GenericOnlineBible.py
@@ -148,7 +148,7 @@ def cacheVerse( self, key, verseData ):
vPrint( 'Never', debuggingThisModule, f"GenericOnlineBible.cacheVerse( {key}, {verseData} )…" )
if str(key) in self.cache:
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, " " + _("Retrieved from cache") )
+ vPrint( 'Never', debuggingThisModule, " " + _("Retrieved from cache") )
self.cache.move_to_end( str(key) )
cachedVerseData = self.cache[str(key)]
if cachedVerseData != verseData:
@@ -168,7 +168,7 @@ def getCachedVerseDataList( self, key ):
vPrint( 'Never', debuggingThisModule, f"GenericOnlineBible.getCachedVerseDataList( {key} )…" )
if str(key) in self.cache:
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, " " + _("Retrieved from cache") )
+ vPrint( 'Never', debuggingThisModule, " " + _("Retrieved from cache") )
self.cache.move_to_end( str(key) )
return self.cache[str(key)]
diff --git a/BibleOrgSys/Online/SwordInstallManager.py b/BibleOrgSys/Online/SwordInstallManager.py
index 8472bd99..e66e3a8f 100755
--- a/BibleOrgSys/Online/SwordInstallManager.py
+++ b/BibleOrgSys/Online/SwordInstallManager.py
@@ -51,7 +51,7 @@
from BibleOrgSys.BibleOrgSysGlobals import vPrint
-LAST_MODIFIED_DATE = '2020-05-05' # by RJH
+LAST_MODIFIED_DATE = '2020-05-07' # by RJH
SHORT_PROGRAM_NAME = "SwordInstallManager"
PROGRAM_NAME = "Sword download handler"
PROGRAM_VERSION = '0.12'
@@ -115,7 +115,8 @@
# Ones that have an underline and then a subfield such as a language _en or _ru
SWORD_CONF_FIELD_NAMES_ALLOWED_VERSIONING = ('History', 'Description', 'About',
'Copyright', 'CopyrightHolder', 'CopyrightContactAddress',
- 'DistributionNotes', 'DistributionLicense', )
+ 'DistributionNotes', 'DistributionLicense',
+ 'TextSource', 'ShortPromo' )
# These are the only ones where we expect multiple values (and some of these are probably module bugs)
SWORD_CONF_FIELD_NAMES_ALLOWED_DUPLICATES = ('Feature', 'GlobalOptionFilter', 'DistributionLicense', 'LCSH',
@@ -127,7 +128,7 @@
-def processConfLines( abbreviation:str, openFile, confDict ):
+def processConfLines( abbreviation:str, openFile, confDict:Dict[str,str] ) -> None:
"""
Process a line from a Sword .conf file
and saves the results in the given confDict.
@@ -155,7 +156,7 @@ def processConfLines( abbreviation:str, openFile, confDict ):
if abbreviation=='burjudson' and thisLine.endswith(" available from "): continuationFlag = True # Bad module it seems
if not continuationFlag: # process the line
- if lineCount==1 or lastLine==None: # First (non-blank) line should contain a name in square brackets
+ if lineCount==1 or lastLine is None: # First (non-blank) line should contain a name in square brackets
assert '=' not in thisLine and thisLine[0]=='[' and thisLine[-1]==']'
confDict['Name'] = thisLine[1:-1]
else: # not the first line in the conf file
@@ -166,6 +167,7 @@ def processConfLines( abbreviation:str, openFile, confDict ):
continue
if 'History=1.4-081031=' in thisLine and not BibleOrgSysGlobals.strictCheckingFlag:
thisLine = thisLine.replace( '=', '_', 1 ) # Fix module error in strongsrealgreek.conf
+ thisLine = thisLine.replace( 'Hisotry', 'History' ) # Fix module error in 'twenty'
bits = thisLine.split( '=', 1 )
#vPrint( 'Quiet', debuggingThisModule, "processConfLines", abbreviation, bits )
assert len(bits) == 2
@@ -190,7 +192,8 @@ def processConfLines( abbreviation:str, openFile, confDict ):
#vPrint( 'Quiet', debuggingThisModule, "processConfLinesFC", abbreviation, "fieldContents", repr(fieldContents) )
assert len(fieldContents) == 2
#vPrint( 'Quiet', debuggingThisModule, j, "Now", abbreviation, repr(fieldName), repr(fieldContents) )
- if BibleOrgSysGlobals.debugFlag or debuggingThisModule:
+ if BibleOrgSysGlobals.debugFlag or debuggingThisModule or BibleOrgSysGlobals.strictCheckingFlag:
+ # print( f"fieldName: '{fieldName}'")
assert '_' not in fieldName # now
if fieldName=='MinumumVersion': fieldName = 'MinimumVersion' # Fix spelling error in several modules: nheb,nhebje,nhebme,cslelizabeth,khmernt, morphgnt, etc.
if fieldName=='CompressType' and fieldContents=='Zip': fieldContents = 'ZIP' # Fix error in romcor.conf
@@ -479,7 +482,7 @@ def _getConfFile( self, confName:str, confPath:Path ) -> Dict[str,Any]:
vPrint( 'Never', debuggingThisModule, _("SwordInstallManager._getConfFile( {}, {} )").format( confName, confPath ) )
# Read the conf file
- confDict = {}
+ confDict:Dict[str,str] = {}
with open( confPath, 'rt', encoding=DEFAULT_SWORD_CONF_ENCODING ) as confFile:
processConfLines( confName, confFile, confDict )
diff --git a/BibleOrgSys/Reference/BibleBookOrders.py b/BibleOrgSys/Reference/BibleBookOrders.py
index a23dfa77..b201567a 100755
--- a/BibleOrgSys/Reference/BibleBookOrders.py
+++ b/BibleOrgSys/Reference/BibleBookOrders.py
@@ -63,7 +63,7 @@ def __init__( self ): # We can't give this parameters because of the singleton
"""
Constructor:
"""
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "BibleBookOrderSystems:__init__()" )
+ vPrint( 'Never', debuggingThisModule, "BibleBookOrderSystems:__init__()" )
self.__DataDicts = self.__DataLists = None # We'll import into these in loadData
# end of BibleBookOrderSystems.__init__
@@ -272,7 +272,7 @@ def __init__( self, systemName ):
"""
Constructor:
"""
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "BibleBookOrderSystem:__init__({})".format( systemName ) )
+ vPrint( 'Never', debuggingThisModule, "BibleBookOrderSystem:__init__({})".format( systemName ) )
self.__systemName = systemName
self.__bbos = BibleBookOrderSystems().loadData() # Doesn't reload the XML unnecessarily :)
results = self.__bbos.getBookOrderSystem( self.__systemName )
diff --git a/BibleOrgSys/Reference/BibleReferences.py b/BibleOrgSys/Reference/BibleReferences.py
index 3eb757dd..33c20183 100755
--- a/BibleOrgSys/Reference/BibleReferences.py
+++ b/BibleOrgSys/Reference/BibleReferences.py
@@ -1237,9 +1237,9 @@ def getFirstReference( self, referenceString, location=None ):
Basically just returns the first result (if any) from parseReferenceString.
"""
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "BibleReferences.getFirstReference( {}, {} )".format( repr(referenceString), location ) )
+ vPrint( 'Never', debuggingThisModule, "BibleReferences.getFirstReference( {}, {} )".format( repr(referenceString), location ) )
hE, hW, refList = self.parseReferenceString( referenceString, location )
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, "gFR", hE, hW, refList )
+ vPrint( 'Never', debuggingThisModule, "gFR", hE, hW, refList )
for something in refList: # Just return the first one
if isinstance( something, tuple ):
if len(something)==4: return something
diff --git a/BibleOrgSys/Reference/BibleVersificationSystems.py b/BibleOrgSys/Reference/BibleVersificationSystems.py
index 48052a3f..96e296c3 100755
--- a/BibleOrgSys/Reference/BibleVersificationSystems.py
+++ b/BibleOrgSys/Reference/BibleVersificationSystems.py
@@ -923,7 +923,7 @@ def expandCVRange( self, startRef, endRef, referenceString=None, bookOrderSystem
else: S = ''
resultList.append( (BBB2, str(Cint), str(Vint), S,) )
- if BibleOrgSysGlobals.debugFlag and debuggingThisModule: vPrint( 'Quiet', debuggingThisModule, startRef, endRef, resultList, haveErrors, haveWarnings )
+ vPrint( 'Never', debuggingThisModule, startRef, endRef, resultList, haveErrors, haveWarnings )
return resultList #, haveErrors, haveWarnings
# end of BibleVersificationSystem.expandCVRange
diff --git a/BibleOrgSys/Reference/Converters/BibleBookOrdersConverter.py b/BibleOrgSys/Reference/Converters/BibleBookOrdersConverter.py
index f3bd3e18..8fc772f8 100755
--- a/BibleOrgSys/Reference/Converters/BibleBookOrdersConverter.py
+++ b/BibleOrgSys/Reference/Converters/BibleBookOrdersConverter.py
@@ -90,7 +90,7 @@ def loadSystems( self, XMLFolder=None ):
Load and pre-process the specified book order systems.
"""
if not self._XMLSystems: # Only ever do this once
- if XMLFolder==None: XMLFolder = BibleOrgSysGlobals.BOS_DATAFILES_FOLDERPATH.joinpath( 'BookOrders/' ) # Relative to module, not cwd
+ if XMLFolder is None: XMLFolder = BibleOrgSysGlobals.BOS_DATAFILES_FOLDERPATH.joinpath( 'BookOrders/' ) # Relative to module, not cwd
self.__XMLFolder = XMLFolder
vPrint( 'Info', debuggingThisModule, _("Loading book order systems from {}…").format( self.__XMLFolder ) )
filenamePrefix = "BIBLEBOOKORDER_"
diff --git a/BibleOrgSys/Reference/Converters/BibleBooksNamesConverter.py b/BibleOrgSys/Reference/Converters/BibleBooksNamesConverter.py
index c0d7e7a6..49bddace 100755
--- a/BibleOrgSys/Reference/Converters/BibleBooksNamesConverter.py
+++ b/BibleOrgSys/Reference/Converters/BibleBooksNamesConverter.py
@@ -87,7 +87,7 @@ def loadSystems( self, folder=None ):
Load and pre-process the specified booksNames systems.
"""
if not self.__XMLSystems: # Only ever do this once
- if folder==None: folder = BibleOrgSysGlobals.BOS_DATAFILES_FOLDERPATH.joinpath( 'BookNames/' ) # Relative to module, not cwd
+ if folder is None: folder = BibleOrgSysGlobals.BOS_DATAFILES_FOLDERPATH.joinpath( 'BookNames/' ) # Relative to module, not cwd
self.__XMLFolder = folder
vPrint( 'Info', debuggingThisModule, _("Loading book names systems from {}…").format( folder ) )
for filename in os.listdir( folder ):
diff --git a/BibleOrgSys/Reference/Converters/BiblePunctuationSystemsConverter.py b/BibleOrgSys/Reference/Converters/BiblePunctuationSystemsConverter.py
index 723bdbc0..3d3f3531 100755
--- a/BibleOrgSys/Reference/Converters/BiblePunctuationSystemsConverter.py
+++ b/BibleOrgSys/Reference/Converters/BiblePunctuationSystemsConverter.py
@@ -91,7 +91,7 @@ def loadSystems( self, XMLFolder=None ):
Load and pre-process the specified punctuation systems.
"""
if not self._XMLSystems: # Only ever do this once
- if XMLFolder==None: XMLFolder = BibleOrgSysGlobals.BOS_DATAFILES_FOLDERPATH.joinpath( 'PunctuationSystems/' ) # Relative to module, not cwd
+ if XMLFolder is None: XMLFolder = BibleOrgSysGlobals.BOS_DATAFILES_FOLDERPATH.joinpath( 'PunctuationSystems/' ) # Relative to module, not cwd
self.__XMLFolder = XMLFolder
vPrint( 'Info', debuggingThisModule, _("Loading punctuations systems from {}…").format( self.__XMLFolder ) )
filenamePrefix = "BIBLEPUNCTUATIONSYSTEM_"
diff --git a/BibleOrgSys/Reference/Converters/BibleVersificationSystemsConverter.py b/BibleOrgSys/Reference/Converters/BibleVersificationSystemsConverter.py
index 55202650..5a2217ff 100755
--- a/BibleOrgSys/Reference/Converters/BibleVersificationSystemsConverter.py
+++ b/BibleOrgSys/Reference/Converters/BibleVersificationSystemsConverter.py
@@ -90,7 +90,7 @@ def loadSystems( self, XMLFolder=None ):
Load and pre-process the specified versification systems.
"""
if not self.__XMLSystems: # Only ever do this once
- if XMLFolder==None: XMLFolder = BibleOrgSysGlobals.BOS_DATAFILES_FOLDERPATH.joinpath( "VersificationSystems" ) # Relative to module, not cwd
+ if XMLFolder is None: XMLFolder = BibleOrgSysGlobals.BOS_DATAFILES_FOLDERPATH.joinpath( "VersificationSystems" ) # Relative to module, not cwd
self.__XMLFolder = XMLFolder
vPrint( 'Info', debuggingThisModule, _("Loading versification systems from {}…").format( XMLFolder ) )
filenamePrefix = "BIBLEVERSIFICATIONSYSTEM_"
diff --git a/setup.py b/setup.py
index d9c508b5..b678f154 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@
from setuptools import setup # Always prefer setuptools over distutils
# from os import path
-VERSION = '0.0.19'
+VERSION = '0.0.20'
LAST_MODIFIED_DATE = '2020-05-04' # by RJH — when setup.py was modified below