5
0

Removes the walrus operator so we can also use Python 3.7

This commit is contained in:
Llewellyn van der Merwe 2023-11-14 07:58:20 +02:00
parent 270c8f3d48
commit a0d2c61547
Signed by: Llewellyn
GPG Key ID: A9201372263741E7

View File

@ -28,13 +28,15 @@ class GetBibleBookNumber:
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
@ -43,7 +45,8 @@ class GetBibleBookNumber:
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