Coverage for portality/lib/nav.py: 100%
10 statements
« prev ^ index » next coverage.py v6.4.2, created at 2022-11-09 16:22 +0000
« prev ^ index » next coverage.py v6.4.2, created at 2022-11-09 16:22 +0000
1from typing import Iterable
3from portality.core import app
6def yield_all_route(entries: Iterable[dict]) -> Iterable[str]:
7 """
8 :param entries:
9 :return: iterable of route name (endpoint)
10 """
12 for e in entries:
13 if 'route' in e:
14 yield e['route']
15 if 'entries' in e:
16 yield from yield_all_route(e['entries'])
19def get_nav_entries() -> Iterable[dict]:
20 return app.jinja_env.globals.get("data", {}).get('nav', {}).get('entries', [])