Source code for mimesis.providers.transport

"""Provides data related to transports."""

import typing as t

from mimesis.data import (
    AIRPLANES,
    AUTO_MANUFACTURERS,
    CARS,
    VR_CODES,
    VRC_BY_LOCALES,
)
from mimesis.locales import Locale
from mimesis.providers.base import BaseProvider

__all__ = ["Transport"]


[docs]class Transport(BaseProvider): """Class for generating data related to transports."""
[docs] class Meta: """Class for metadata.""" name: t.Final[str] = "transport"
[docs] def manufacturer(self) -> str: """Get a random car manufacturer. :return: A car manufacturer :Example: Tesla. """ return self.random.choice(AUTO_MANUFACTURERS)
[docs] def car(self) -> str: """Get a random vehicle. :return: A vehicle. :Example: Tesla Model S. """ return self.random.choice(CARS)
[docs] def airplane(self) -> str: """Generate a dummy airplane model. :return: Airplane model. :Example: Boeing 727. """ return self.random.choice(AIRPLANES)
[docs] def vehicle_registration_code(self, locale: t.Optional[Locale] = None) -> str: """Get vehicle registration code of country. :param locale: Registration code for locale (country). :return: Vehicle registration code. """ if locale: return VRC_BY_LOCALES[locale.value] return self.random.choice(VR_CODES)