thejourneyplanner.utilities package

Submodules

thejourneyplanner.utilities.file_interaction module

file_interaction.py: Functions for interacting with files.

thejourneyplanner.utilities.file_interaction.open_html_file(file_path: Path) None

Open the specified HTML file in the default web browser.

Parameters:

file_path (Path) – The path to the HTML file to open.

thejourneyplanner.utilities.polyline_interaction module

polyline_interaction.py: Contains functions for interacting with polylines.

thejourneyplanner.utilities.polyline_interaction.plot_polyline(encoded_polyline: str, save_path: Path = PosixPath('thejourneyplanner-map.html'), open_map: bool = False) Path

Plot the given encoded polyline on a map.

Parameters:
  • encoded_polyline (str) – The encoded polyline to be plotted.

  • save_path (Path, optional) – The path to save the map, by default Constants.DEFAULT_MAP_SAVE_PATH

  • open_map (bool, optional) – Whether to open the map in the default web browser, by default False

Raises:

PermissionError – If the save path is invalid.

Returns:

The path to the saved map.

Return type:

Path

thejourneyplanner.utilities.unit_conversion module

unit_conversion.py: Functions for unit conversion.

thejourneyplanner.utilities.unit_conversion.convert_distance(distance: float, units: str) str

Convert distance to the most appropriate units for readability.

Parameters:
  • distance (float) – The distance to be converted.

  • units (str) – The units of the given distance.

Returns:

The distance in the most appropriate units.

Return type:

str

thejourneyplanner.utilities.unit_conversion.convert_duration(duration: int, units: str) str

Convert duration to the most appropriate units for readability.

Parameters:
  • duration (int) – The duration to be converted.

  • units (str) – The units of the given duration.

Returns:

The duration in the most appropriate units.

Return type:

str

Module contents

Utilities package for the project.