This commit is contained in:
sigma67 2023-12-31 19:55:38 +01:00 • committed by sigma67
commit 70a260b516
23 changed files with 312 additions and 148 deletions

View file

@ -1,4 +1,6 @@
# commonly used navigation paths
from typing import Any, Dict, List
CONTENT = ["contents", 0]
RUN_TEXT = ["runs", 0, "text"]
TAB_CONTENT = ["tabs", 0, "tabRenderer", "content"]
@ -67,7 +69,7 @@ CARD_SHELF_TITLE = ["header", "musicCardShelfHeaderBasicRenderer"] + TITLE_TEXT
FRAMEWORK_MUTATIONS = ["frameworkUpdates", "entityBatchUpdate", "mutations"]
def nav(root, items, none_if_absent=False):
def nav(root: Dict[str, Any], items: List[Any], none_if_absent: bool = False) -> Any:
"""Access a nested object in root by item sequence."""
try:
for k in items: