Source code for

# -*- coding: utf-8 -*-

"""Specific data provider for Ukraine (uk)."""
from typing import Final, List, Optional

from mimesis.builtins.base import BaseSpecProvider
from mimesis.enums import Gender
from mimesis.locales import Locale
from mimesis.typing import Seed

__all__ = ["UkraineSpecProvider"]

[docs]class UkraineSpecProvider(BaseSpecProvider): """Class that provides special data for Ukraine (uk)."""
[docs] def __init__(self, seed: Optional[Seed] = None) -> None: """Initialize attributes.""" super().__init__(locale=Locale.UK, seed=seed) self._load_datafile(self._datafile)
[docs] class Meta: """The name of the provider.""" name: Final[str] = "ukraine_provider"
[docs] def patronymic(self, gender: Optional[Gender] = None) -> str: """Generate random patronymic name. :param gender: Gender of person. :type gender: str or int :return: Patronymic name. """ gender = self.validate_enum(gender, Gender) patronymics: List[str] = self.extract(["patronymic", str(gender)]) return self.random.choice(patronymics)