Skip to content

Commit

Permalink
Move versification constants so that they can be used within scriptur…
Browse files Browse the repository at this point in the history
…e modules and use constant in get_chapters signature
  • Loading branch information
isaac091 committed Nov 21, 2023
1 parent 3f29098 commit 9f460cf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
15 changes: 8 additions & 7 deletions machine/scripture/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
is_ot,
is_ot_nt,
)
from .constants import (
ENGLISH_VERSIFICATION,
ORIGINAL_VERSIFICATION,
RUSSIAN_ORTHODOX_VERSIFICATION,
RUSSIAN_PROTESTANT_VERSIFICATION,
SEPTUAGINT_VERSIFICATION,
VULGATE_VERSIFICATION,
)
from .parse import get_books, get_chapters
from .verse_ref import (
NULL_VERSIFICATION,
Expand All @@ -27,13 +35,6 @@
get_bbbcccvvv,
)

ORIGINAL_VERSIFICATION: Versification
ENGLISH_VERSIFICATION: Versification
SEPTUAGINT_VERSIFICATION: Versification
VULGATE_VERSIFICATION: Versification
RUSSIAN_ORTHODOX_VERSIFICATION: Versification
RUSSIAN_PROTESTANT_VERSIFICATION: Versification


def __getattr__(name: str) -> Any:
if name.endswith("_VERSIFICATION"):
Expand Down
8 changes: 8 additions & 0 deletions machine/scripture/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from .verse_ref import Versification

ORIGINAL_VERSIFICATION = Versification.get_builtin("Original")
ENGLISH_VERSIFICATION = Versification.get_builtin("English")
SEPTUAGINT_VERSIFICATION = Versification.get_builtin("Septuagint")
VULGATE_VERSIFICATION = Versification.get_builtin("Vulgate")
RUSSIAN_ORTHODOX_VERSIFICATION = Versification.get_builtin("RussianOrthodox")
RUSSIAN_PROTESTANT_VERSIFICATION = Versification.get_builtin("RussianProtestant")
3 changes: 2 additions & 1 deletion machine/scripture/parse.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Dict, List, Set, Union

from .canon import book_id_to_number
from .constants import ORIGINAL_VERSIFICATION
from .verse_ref import Versification


Expand Down Expand Up @@ -37,7 +38,7 @@ def get_books(books: Union[str, List[str]]) -> Set[int]:
# Output format: { book_num: [chapters] }
# An empty list, i.e. book_num: [] signifies the inclusion of all chapters
def get_chapters(
chapter_selections: str, versification: Versification = Versification.create("Original")
chapter_selections: str, versification: Versification = ORIGINAL_VERSIFICATION
) -> Dict[int, List[int]]:
chapters = {}

Expand Down

0 comments on commit 9f460cf

Please sign in to comment.