def image_type()

in src/mapillary/utils/filter.py [0:0]


def image_type(data: list, image_type: str) -> list:
    """
    The parameter might be 'all' (both is_pano == true and false), 'pano' (is_pano == true only),
    or 'flat' (is_pano == false only)

    :param data: The data to be filtered
    :type data: list

    :param image_type: Either 'pano' (True), 'flat' (False), or 'all' (None)
    :type image_type: str

    :return: A feature list
    :rtype: list
    """

    # Checking what kind of parameter is passed
    bool_for_pano_filtering = (
        # Return true if type == 'pano'
        True
        if image_type == "pano"
        # Else false if type == 'flat'
        else False
    )

    # Return the images based on image type
    return [
        feature
        for feature in data
        if feature["properties"]["is_pano"] == bool_for_pano_filtering
    ]