Skip to content

Commit

Permalink
Removes the walrus operator so we can also use Python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Llewellynvdm committed Nov 14, 2023
1 parent 270c8f3 commit a0d2c61
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/getbible/getbible_book_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ def number(self, reference, translation_code=None, fallback_translations=None):
translation_code = 'kjv'

translation = self._tries.get(translation_code)
if translation and (result := translation.search(reference)):
result = translation.search(reference) if translation else None
if result:
return result

# If 'kjv' is not the original choice, try it next
if translation_code != 'kjv':
translation = self._tries.get('kjv')
if translation and (result := translation.search(reference)):
result = translation.search(reference) if translation else None
if result:
return result

# Fallback to other translations
Expand All @@ -43,7 +45,8 @@ def number(self, reference, translation_code=None, fallback_translations=None):

for code in fallback_translations:
translation = self._tries.get(code)
if translation and (result := translation.search(reference)):
result = translation.search(reference) if translation else None
if result:
return result

return None
Expand Down

0 comments on commit a0d2c61

Please sign in to comment.