register_circuity_function¶
-
passengersim.connection_builder.circuity.register_circuity_function(func: Callable[[dict[str, Airport], tuple[Leg, ...], str | None, int], bool], name: str | None =
None) Callable[[dict[str, Airport], tuple[Leg, ...], str | None, int], bool][source]¶ Register a circuity function.
This can be used to register a user-defined circuity function that can then be used in the connection builder. The name used for registration is the provided name parameter, or the function’s __name__ if name is not provided. The registered circuity function can then be retrieved by name using get_registered_circuity_function(name).
- Parameters:
- Returns:
CircuityFunc – The same circuity function that was registered. This allows this function to be used as a decorator to register a circuity function but otherwise act transparently.
- Raises:
ValueError – If a circuity function is already registered under name.