How to use the routemaster.config.model.ContextNextStates function in routemaster

To help you get started, we’ve selected a few routemaster examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thread / routemaster / routemaster / config / loader.py View on Github external
def _load_context_next_states(
    path: Path,
    yaml_next_states: Yaml,
    feed_names: List[str],
) -> NextStates:
    context_path = yaml_next_states['path']

    _validate_context_lookups(path + ['path'], (context_path,), feed_names)

    return ContextNextStates(
        path=context_path,
        destinations=[
            _load_context_next_state_option(
                path + ['destinations', str(idx)],
                yaml_option,
            )
            for idx, yaml_option in enumerate(yaml_next_states['destinations'])
        ],
        default=yaml_next_states['default'],
    )