brails.utils.input_validator module

This module provides a utility class for validating input data in BRAILS.

InputValidator()

A utility class for validating BRAILS input data.

class brails.utils.input_validator.InputValidator

Bases: object

A utility class for validating BRAILS input data.

The InputValidator class provides static methods to ensure that the inputs provided to brails are of the correct type and format. It includes methods to validate coordinate lists, polygons, and other relevant data structures.

Methods:
  • is_float(element: Any) -> bool: Checks if the given input_value can

    be converted to a float.

  • validate_coordinates(coordinates: list[list[float]]

    ) -> tuple[bool, str]: Validates a two-dimensional list of coordinates ensuring that each coordinate pair consists of two floats within the valid range for longitude and latitude.

static is_float(input_value: Any) bool

Check if the given input_value can be converted to a float.

Args:

input_value (Any): The input_value to check.

Returns:
bool: True if the input_value can be converted to a float, False

otherwise.

validate_coordinates() tuple[bool, str]

Validate input for coordinates.

Args:
coordinates (list[list[float]]): A two-dimensional list

representing the geometry in [[lon1, lat1], [lon2, lat2], …, [lonN, latN]] format.

Returns:
tuple[bool, str]: A tuple containing:
  • A boolean indicating if all coordinates are valid.

  • A message string describing any issues found, or confirming

    validation success.