How to use the mimesis.builtins.base.BaseSpecProvider function in mimesis

To help you get started, we’ve selected a few mimesis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lk-geimfari / mimesis / mimesis / builtins / uk.py View on Github external
# -*- coding: utf-8 -*-

"""Specific data provider for Ukraine (uk)."""

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

__all__ = ['UkraineSpecProvider']


class UkraineSpecProvider(BaseSpecProvider):
    """Class that provides special data for Ukraine (uk)."""

    def __init__(self, seed: Seed = None):
        """Initialize attributes."""
        super().__init__(locale='uk', seed=seed)
        self.pull(self._datafile)

    class Meta:
        """The name of the provider."""

        name = 'ukraine_provider'

    def patronymic(self, gender: Gender = None) -> str:
        """Generate random patronymic name.

        :param gender: Gender of person.
github lk-geimfari / mimesis / mimesis / builtins / pl.py View on Github external
# -*- coding: utf-8 -*-

"""Specific data provider for Poland (pl)."""

from mimesis.builtins.base import BaseSpecProvider
from mimesis.enums import Gender
from mimesis.providers import Datetime
from mimesis.typing import DateTime, Seed

__all__ = ['PolandSpecProvider']


class PolandSpecProvider(BaseSpecProvider):
    """Class that provides special data for Poland (pl)."""

    def __init__(self, seed: Seed = None):
        """Initialize attributes."""
        super().__init__(locale='pl', seed=seed)

    class Meta:
        """The name of the provider."""

        name = 'poland_provider'

    def nip(self) -> str:
        """Generate random valid 10-digit NIP.

        :return: Valid 10-digit NIP
        """
github lk-geimfari / mimesis / mimesis / builtins / da.py View on Github external
# -*- coding: utf-8 -*-

"""Specific data provider for Denmark (da)."""

from mimesis.builtins.base import BaseSpecProvider
from mimesis.typing import Seed

__all__ = ['DenmarkSpecProvider']


class DenmarkSpecProvider(BaseSpecProvider):
    """Class that provides special data for Denmark (da)."""

    def __init__(self, seed: Seed = None):
        """Initialize attributes."""
        super().__init__(locale='da', seed=seed)

    class Meta:
        """The name of the provider."""

        name = 'denmark_provider'

    def cpr(self) -> str:
        """Generate a random CPR number (Central Person Registry).

        :return: CPR number.
github lk-geimfari / mimesis / mimesis / builtins / de.py View on Github external
# -*- coding: utf-8 -*-

"""Specific data provider for Germany (de)."""

from mimesis.builtins.base import BaseSpecProvider
from mimesis.typing import Seed

__all__ = ['GermanySpecProvider']


class GermanySpecProvider(BaseSpecProvider):
    """Specific-provider of misc data for Germany."""

    def __init__(self, seed: Seed = None):
        """Initialize attributes."""
        super().__init__(locale='de', seed=seed)
        self.pull(self._datafile)

    class Meta:
        """The name of the provider."""

        name = 'germany_provider'

    def noun(self, plural: bool = False) -> str:
        """Return a random noun in German.

        :param plural: Return noun in plural.
github lk-geimfari / mimesis / mimesis / builtins / nl.py View on Github external
# -*- coding: utf-8 -*-

"""Specific data provider for Netherlands (nl)."""

from mimesis.builtins.base import BaseSpecProvider
from mimesis.typing import Seed

__all__ = ['NetherlandsSpecProvider']


class NetherlandsSpecProvider(BaseSpecProvider):
    """Class that provides special data for Netherlands (nl)."""

    def __init__(self, seed: Seed = None):
        """Initialize attributes."""
        super().__init__(locale='nl', seed=seed)

    class Meta:
        """The name of the provider."""

        name = 'netherlands_provider'

    def bsn(self) -> str:
        """Generate a random, but valid ``Burgerservicenummer``.

        :returns: Random BSN.
github lk-geimfari / mimesis / mimesis / builtins / pt_br.py View on Github external
# -*- coding: utf-8 -*-

"""Specific data provider for Brazil (pt-br)."""

from mimesis.builtins.base import BaseSpecProvider
from mimesis.typing import Seed

__all__ = ['BrazilSpecProvider']


class BrazilSpecProvider(BaseSpecProvider):
    """Class that provides special data for Brazil (pt-br)."""

    def __init__(self, seed: Seed = None):
        """Initialize attributes."""
        super().__init__(locale='pt-br', seed=seed)

    class Meta:
        """The name of the provider."""

        name = 'brazil_provider'

    def cpf(self, with_mask: bool = True) -> str:
        """Get a random CPF.

        :param with_mask: Use CPF mask (###.###.###-##).
        :returns: Random CPF.
github lk-geimfari / mimesis / mimesis / builtins / en.py View on Github external
# -*- coding: utf-8 -*-

"""Specific data provider for USA (en)."""

from typing import Optional, Union

from mimesis.builtins.base import BaseSpecProvider
from mimesis.typing import Seed

__all__ = ['USASpecProvider']


class USASpecProvider(BaseSpecProvider):
    """Class that provides special data for USA (en)."""

    def __init__(self, seed: Seed = None):
        """Initialize attributes."""
        super().__init__(locale='en', seed=seed)

    class Meta:
        """The name of the provider."""

        name = 'usa_provider'

    def tracking_number(self, service: str = 'usps') -> str:
        """Generate random tracking number.

        Supported services: USPS, FedEx and UPS.
github lk-geimfari / mimesis / mimesis / builtins / ru.py View on Github external
# -*- coding: utf-8 -*-

"""Specific data provider for Russia (ru)."""

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

__all__ = ['RussiaSpecProvider']


class RussiaSpecProvider(BaseSpecProvider):
    """Class that provides special data for Russia (ru)."""

    def __init__(self, seed: Seed = None):
        """Initialize attributes."""
        super().__init__(locale='ru', seed=seed)
        self.pull(self._datafile)

    class Meta:
        """The name of the provider."""

        name = 'russia_provider'

    def generate_sentence(self) -> str:
        """Generate sentence from the parts.

        :return: Sentence.
github lk-geimfari / mimesis / mimesis / builtins / ja.py View on Github external
"""Specific data provider for Japan (ja)."""

from mimesis.builtins.base import BaseSpecProvider

__all__ = ['JapanSpecProvider']


class JapanSpecProvider(BaseSpecProvider):
    """Class that provides special data for ja."""

    class Meta:
        """The name of the provider."""

        name = 'japan_provider'

    @staticmethod
    def full_to_half(text: str, alnum: bool = True) -> str:
        """Convert all full width katakana to equivalent half width character.

        :param text: The text to be converted.
        :param alnum: Convert alphanumeric, default True.
        :return: Text with full width characters converted to half width.
        """
        fh_kana_special = {
github lk-geimfari / mimesis / mimesis / builtins / ja.py View on Github external
from mimesis.builtins.base import BaseSpecProvider


class JapanSpecProvider(BaseSpecProvider):
    """Class that provides special data for ja"""

    class Meta:
        name = 'japan_provider'

    @staticmethod
    def full_to_half(text: str, alnum: bool = True) -> str:
        """Convert all full width katakana, alphanumeric and few special
        characters like (, ), ・ to equivalent half width character.

        :param str text: The text to be converted.
        :param bool alnum: Convert alphanumeric, default True.
        :return: Text with full width characters converted to half width.
        :rtype: str

        :Example: