translator_directory.utils
Functions
|
|
|
|
|
Checks if distances are off by +- a factor, but returns False if a |
|
|
|
|
|
|
|
Handles updating Translator.driving_distance. Can be used in a cli or view. |
|
|
|
|
|
Returns a dict of country codes mapped to its country names according |
|
Returns a custom text from the app's custom_texts dict. |
Module Contents
- translator_directory.utils.to_tuple(coordinate: onegov.gis.models.coordinates.RealCoordinates) tuple[float, float] [source]
- translator_directory.utils.out_of_tolerance(old_distance: float | None, new_distance: float | None, tolerance_factor: float, max_tolerance: float | None = None) bool [source]
Checks if distances are off by +- a factor, but returns False if a set max_tolerance is not exceeded.
- translator_directory.utils.validate_geocode_result(response: requests.Response, zip_code: str | int | None, zoom: int | None = None, bbox: Collection[RealCoordinates] | None = None) RealCoordinates | None [source]
- translator_directory.utils.same_coords(this: onegov.gis.Coordinates, other: onegov.gis.Coordinates) bool [source]
- translator_directory.utils.update_drive_distances(request: onegov.translator_directory.request.TranslatorAppRequest, only_empty: bool, tolerance_factor: float = 0.1, max_tolerance: float | None = None, max_distance: float | None = None) tuple[int, int, int, list[onegov.translator_directory.models.translator.Translator], list[tuple[onegov.translator_directory.models.translator.Translator, float]]] [source]
Handles updating Translator.driving_distance. Can be used in a cli or view.
- translator_directory.utils.geocode_translator_addresses(request: onegov.translator_directory.request.TranslatorAppRequest, only_empty: bool, bbox: Collection[RealCoordinates] | None = None) tuple[int, int, int, int, list[onegov.translator_directory.models.translator.Translator]] [source]
- translator_directory.utils.nationality_choices(locale: str | None) list[wtforms.fields.choices._Choice] [source]