Esempio n. 1
0
def generate_actors():
    f = open("actors.csv", 'w')
    person = Person()
    id_PK = 1
    print("Generating...")
    for _ in range(2500):
        # generate male
        id_FK = randint(1, 1000)

        f.write(str(id_PK) + ',' + str(id_FK) + ','\
         + person.full_name(gender=Gender.MALE) + ','\
         + str(person.age(minimum=18, maximum=70)) + ','\
         + 'M' + ','\
         + person.nationality() + ','\
         + str(randint(1000, 1000000)) + ','\
         + str(randint(0, 5)) + '\n')

        id_PK += 1
        id_FK = randint(1, 1000)
        # generate female
        f.write(str(id_PK) + ','+ str(id_FK) + ','\
         + person.full_name(gender=Gender.FEMALE) + ','\
         + str(person.age(minimum=18, maximum=70)) + ','\
         + 'F' + ','\
         + person.nationality() + ','\
         + str(randint(1000, 1000000)) + ','\
         + str(randint(0, 5)) + '\n')

        id_PK += 1

    f.close()
    print("DONE")
Esempio n. 2
0
def create_human(n):  # function of creating new client
    if n == 1:
        person = Person('ru')
    else:
        person = Person('en')

    # Выводим исландские мужские имена.
    client_info = generate_id_passport()

    print('\nфамилия:\t', person.last_name())
    print('имя:\t\t', person.name())
    print('отчество:\t', person.surname(), '\n')

    passport = generate_number_passport()
    print('личный №:\t', client_info.get('idn'))
    print('документ:\t', passport)

    print('пол:\t\t', client_info.get('sex'))
    print('возраст:\t', person.age(13, 70), '\n')
    # print('аватар\t', person.avatar())
    print('гражд-во:\t', person.get_current_locale())
    print('Нац-сть:\t', person.nationality())
    print('телефон:\t', person.telephone('+37529#######'))
    print('email:\t\t', '*****@*****.**')
    # print('email:\t\t', person.email())
    print('проф-ия:\t', person.occupation(), '\n')
    print('обращение:\t', person.title())
    print('взгляды:\t', person.views_on())
    print('вера:\t\t', person.worldview(), '\n')
def create_human(n):
    """

    :param n: язык генерации данных
    :return: сгенерированные фейковые данные
    """
    log.info("Генерируем тестовые данные")
    if n == 1:
        person = Person('ru')
    else:
        person = Person('en')
    log.info("person: " + str(person))

    client_info = generate_id_passport()

    print('\nфамилия:\t', person.last_name())
    print('имя:\t\t', person.name())
    print('отчество:\t', person.surname(), '\n')

    passport = generate_number_passport()
    print('личный №:\t', client_info.get('idn'))
    print('документ:\t', passport)

    print('пол:\t\t', client_info.get('sex'))
    print('возраст:\t', person.age(13, 70), '\n')
    # print('аватар\t', person.avatar())
    print('гражд-во:\t', person.get_current_locale())
    print('Нац-сть:\t',person.nationality())
    print('телефон:\t', person.telephone('+37529#######'))
    print('email:\t\t', person.email())
    print('проф-ия:\t', person.occupation(), '\n')
    print('обращение:\t', person.title())
    print('взгляды:\t', person.views_on())
    print('вера:\t\t', person.worldview(), '\n')
Esempio n. 4
0
def generate_student() -> dict:
    """Generate a student record."""
    person = Person()

    student = {
        "academic_degree": person.academic_degree(),
        "age": person.age(),
        "full_name": person.full_name(),
        "gender": person.gender(),
        "nationality": person.nationality(),
        "university": person.university(),
    }

    return student
Esempio n. 5
0
def generate_random_data():
    p = Person()
    a = Address()

    return {
        "name": p.full_name(),
        "email": p.email(),
        "nationality": p.nationality(),
        "occupation": p.occupation(),
        "password": p.password(),
        "phone": p.telephone(),
        "address": a.address(),
        "city": a.city(),
        "street_no": a.street_number(),
        "created": Datetime().date().isoformat(),
    }
#!/usr/bin/env python3
# -*- conding:utf8 -*-

from mimesis import Person, Address, Business, Payment, Text, Food
from mimesis.enums import Gender

print('#' * 5 + '个人信息' + '#' * 5)
person = Person('zh')
# 可以传递性别给full_name()
print(person.full_name(Gender.MALE))
print(person.level_of_english())
print(person.nationality())
print(person.work_experience())
print(person.political_views())
print(person.worldview())

# 自定义名字pattern
templates = ['l-d', 'U-d']
for item in templates:
    print(person.username(template=item))

print('\n')

print('#' * 5 + '地址' + '#' * 5)
address = Address('zh')
print(address.coordinates())
print(address.city())
print('\n')

print('#' * 5 + '地址' + '#' * 5)
business = Business('zh')
Esempio n. 7
0
    def person(
        cls,
        *,
        locale=Locales.EN,
        qualification=None,
        age=None,
        blood_type=None,
        email=None,
        first_name=None,
        last_name=None,
        gender=None,
        height=None,
        id=None,
        language=None,
        nationality=None,
        occupation=None,
        phone=None,
        title=None,
        university=None,
        weight=None,
        work_experience=None,
    ):
        '''
            Create an Person Data Entity object.

            All individual fields are automatically randomly generated based on locale. If provided, the corresponding values are overriden.

            Note:
                All individual fields are randomly generated. Don't expect correct correlation e.g. correct postal code for the generated city.

            Keyword Arguments:
                locale: Approprite Random.locale.<local_name> object. Default is Random.locale.EN
                qualification: Educational Qualification
                age: Age
                blood_type: Blood type
                email: Email address
                first_name: First name
                last_name: Last name
                gender: Gender
                height: Height
                id: Identifier
                language: Language
                nationality: Nationality
                occupation: Occupation
                phone: Phone number
                title: Title
                university: University
                weight: Weight
                work_experience: Work Experience
        '''
        person = Person(locale=locale)
        from arjuna.engine.data.entity.person import Person as ArjPerson

        first_name = first_name is not None and first_name or person.first_name(
        )
        last_name = last_name is not None and last_name or person.last_name()
        return ArjPerson(
            qualification=qualification is not None and qualification
            or person.academic_degree(),
            age=age is not None and age or person.age(),
            blood_type=blood_type is not None and blood_type
            or person.blood_type(),
            email=email is not None and email or person.email(),
            first_name=first_name,
            last_name=last_name,
            name=first_name + " " + last_name,
            gender=gender is not None and gender or person.gender(),
            height=height is not None and height or person.height(),
            id=id is not None and id or person.identifier(),
            language=language is not None and language or person.language(),
            nationality=nationality is not None and nationality
            or person.nationality(),
            occupation=occupation is not None and occupation
            or person.occupation(),
            phone=phone is not None and phone or person.telephone(),
            title=title is not None and title or person.title(),
            university=university is not None and university
            or person.university(),
            weight=weight is not None and weight or person.weight(),
            work_experience=work_experience is not None and work_experience
            or person.work_experience(),
        )