sample_data_utils/people.py
def title(languages=None, genders=None):
    """
    returns a random title

    .. code-block:: python

        >>> d.title()
        u'Mrs.'
        >>> d.title(['es'])
        u'El Sr.'
        >>> d.title(None, [GENDER_FEMALE])
        u'Mrs.'

    :param languages: list of allowed languages. ['en'] if None
    :param genders: list of allowed genders. (GENDER_FEMALE, GENDER_MALE) if None
    """
    languages = languages or ['en']
    genders = genders or (GENDER_FEMALE, GENDER_MALE)

    choices = _get_titles(languages)
    gender = {'m':0, 'f':1}[random.choice(genders)]

    return random.choice(choices)[gender]
def title(languages=None, genders=None):
    languages = languages or ['en']
    genders = genders or (GENDER_FEMALE, GENDER_MALE)

    choices = _get_titles(languages)
    gender = {'m':0, 'f':1}[random.choice(genders)]

    return random.choice(choices)[gender]
def title ( languages = None , genders = None ) : languages = languages or [ 'en' ] genders = genders or ( GENDER_FEMALE , GENDER_MALE ) choices = _get_titles ( languages ) gender = { 'm' : 0 , 'f' : 1 } [ random . choice ( genders ) ] return random . choice ( choices ) [ gender ]
returns a random title

    .. code-block:: python

        >>> d.title()
        u'Mrs.'
        >>> d.title(['es'])
        u'El Sr.'
        >>> d.title(None, [GENDER_FEMALE])
        u'Mrs.'

    :param languages: list of allowed languages. ['en'] if None
    :param genders: list of allowed genders. (GENDER_FEMALE, GENDER_MALE) if None
returns a random title