Skip to content

Style

route_type_emoji

route_type_emoji(route_type: int | str) -> str

Returns a display emoji for a GTFS route_type code.

Parameters:

Name Type Description Default
route_type int | str

A GTFS route type code (standard or extended), as an int or a string coercible to one of the known codes.

required

Returns:

Name Type Description
str str

The matching emoji, or a generic fallback emoji if the code

str

is not recognized.

Source code in pyGTFSHandler/maps/style.py
def route_type_emoji(route_type: int | str) -> str:
    """Returns a display emoji for a GTFS `route_type` code.

    Args:
        route_type: A GTFS route type code (standard or extended), as an
            int or a string coercible to one of the known codes.

    Returns:
        str: The matching emoji, or a generic fallback emoji if the code
        is not recognized.
    """
    return ROUTE_TYPE_EMOJI.get(str(route_type), ROUTE_TYPE_EMOJI_FALLBACK)

route_type_name

route_type_name(route_type: int | str) -> str

Returns a human-readable name for a GTFS route_type code.

Parameters:

Name Type Description Default
route_type int | str

A GTFS route type code (standard or extended), as an int or a string coercible to one of the known codes.

required

Returns:

Name Type Description
str str

The matching name (e.g. "Bus"), or a generic fallback name

str

if the code is not recognized.

Source code in pyGTFSHandler/maps/style.py
def route_type_name(route_type: int | str) -> str:
    """Returns a human-readable name for a GTFS `route_type` code.

    Args:
        route_type: A GTFS route type code (standard or extended), as an
            int or a string coercible to one of the known codes.

    Returns:
        str: The matching name (e.g. `"Bus"`), or a generic fallback name
        if the code is not recognized.
    """
    return ROUTE_TYPE_NAME.get(str(route_type), ROUTE_TYPE_NAME_FALLBACK)