betty.ancestry.name - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
Toggle table of contents sidebar

# Source code for betty.ancestry.name

    """
    Data types to represent names.
    """

    from __future__ import annotations

    from typing import final, TYPE_CHECKING

    from betty.ancestry.date import HasDate
    from betty.locale.localizable import (
        ShorthandStaticTranslations,
        RequiredStaticTranslationsLocalizableAttr,
    )

    if TYPE_CHECKING:
        from betty.date import Datey

    @final
    class Name(HasDate):
        """
        A name.

        A name can be translated, and have a date expressing the period the name was in use.
        """

        #: The name.
        name = RequiredStaticTranslationsLocalizableAttr("name")

        def __init__(
            self,
            name: ShorthandStaticTranslations,
            *,
            date: Datey | None = None,
        ):
            super().__init__(date=date)
            self.name = name