Ejemplo n.º 1
0
    def make_full_name(self, loc, value):
        global sex
        per = Person(loc)
        rsp = RussiaSpecProvider()

        if value == 'male':
            sex = Gender.MALE
        elif value == 'famale':
            sex = Gender.FEMALE
        name = per.name(sex)
        surname = per.surname(sex)
        patron = rsp.patronymic(sex)
        age = per.age(16, 66)
        occup = per.occupation()
        return name, surname, patron, age, occup
Ejemplo n.º 2
0
def _generate_questionnaire_data(locale='ru') -> dict:
    person = Person(locale)
    rus_spec = RussiaSpecProvider()
    datetime = Datetime(locale)
    g = get_random_item(Gender)
    created = datetime.datetime(start=2015, end=2018)
    return {
        'id': uuid.uuid4(),
        'created': created.replace(tzinfo=utc),
        'updated': created.replace(tzinfo=utc),
        'surname': person.surname(gender=g),
        'first_name': person.name(gender=g),
        'patronymic': rus_spec.patronymic(gender=g),
        'birth_date': datetime.datetime(start=1960, end=1998).date(),
        'phone_num': person.telephone(),
        'pass_ser': rus_spec.passport_series(),
        'pass_num': rus_spec.passport_number(),
        'score': randint(0, 2000),
    }
Ejemplo n.º 3
0
def russia():
    return RussiaSpecProvider()
Ejemplo n.º 4
0
def id_factory():
    num = 0
    while True:
        yield num
        num += 1


gen_id_m = id_factory()
gen_id_p = id_factory()

p = open("people.csv", 'w')
m = open("marrige.csv", 'w')

#Objects for mimesis
person = Person(locales.RU)
ru = RussiaSpecProvider()
g = Generic('ru')
a = Address('ru')


def makeManName():
    return str(
        person.full_name(gender=Gender.MALE) + " " +
        ru.patronymic(gender=Gender.MALE))


def makeWomanName():
    return str(
        person.full_name(gender=Gender.FEMALE) + " " +
        ru.patronymic(gender=Gender.FEMALE))
Ejemplo n.º 5
0
from tkinter.ttk import *
import image as image_l
import mimesis
from mimesis.builtins import RussiaSpecProvider as Rsp
from mimesis.enums import Gender
import base
import sqlite3
from PIL import ImageTk, Image
import io
import time
import datetime

#заполнение бд

person = mimesis.Person("ru")
rus_person = Rsp()
date = mimesis.Datetime()
adress = mimesis.Address("ru")

for i in range(5):
    gender = person.gender()
    gender_opt = Gender.MALE
    if gender == "Жен.":
        gender_opt = Gender.FEMALE
    person_id = base.get_last_id()
    surname = person.surname(gender=gender_opt)
    name = person.first_name(gender=gender_opt)
    patronymic = rus_person.patronymic(gender=gender_opt)
    birthday = date.date(start=1960, end=2021)
    adr = adress.city() + " " + adress.address()
    phone = person.telephone()
Ejemplo n.º 6
0
    def __init__(self, list_len):
        self.organization = Organization()
        self.employees = Employees()

        generic = Generic('ru')
        ru = RussiaSpecProvider()
        generic.add_provider(RussiaSpecProvider)

        hazards = HazardsListsHelper()
        hazard_types = list(hazards.get_hazard_types().keys())
        hazard_factors = list(hazards.get_hazard_factors().keys())

        for _ in range(0, list_len):
            # Создаем нового сотрудника и выбираем ему случайный пол
            employee = Employee()
            gender = random.choice([Gender.FEMALE, Gender.MALE])

            # Заполняем объект сотрудника данными
            employee['family_name'] = generic.person.last_name(gender=gender)
            employee['first_name'] = generic.person.name(gender=gender)
            employee['patronymic'] = ru.patronymic(gender=gender)

            employee['sex'] = "Мужской" if gender == Gender.MALE else "Женский"
            birth_date = generic.datetime.date(start=1950, end=2000)
            employee['birth_date'] = birth_date.strftime("%Y-%m-%d")
            employee[
                'address_free_form'] = "{}, г {}, {} {}, д {}, кв {}".format(
                    generic.address.region(), generic.address.city(),
                    generic.address.street_suffix(),
                    generic.address.street_name(), random.randint(1, 400),
                    random.randint(1, 400))

            age = date.today().year - birth_date.year
            employee['experience'] = str(random.randint(0, age - 18))
            employee['specialty'] = generic.person.occupation()

            hazard_types_copy = hazard_types.copy()
            hazard_factors_copy = hazard_factors.copy()
            employee_hazard_types = list()
            employee_hazard_factors = list()
            for i in range(0, random.randint(0, 5)):
                employee_hazard_types.append(
                    hazard_types_copy.pop(
                        random.randint(0,
                                       len(hazard_types_copy) - 1)))
            for i in range(0, random.randint(0, 10)):
                employee_hazard_factors.append(
                    hazard_factors_copy.pop(
                        random.randint(0,
                                       len(hazard_factors_copy) - 1)))

            employee['hazard_types'] = employee_hazard_types
            employee['hazard_factors'] = employee_hazard_factors

            # Добавляем острудника в список
            self.employees.add(employee)

        self.organization['org_name'] = '{} "{}"'.format(
            generic.business.company_type(abbr=True),
            generic.business.company())
        self.organization['inn'] = str(random.randint(1000000000, 9999999999))
        self.organization['ogrn'] = str(
            random.randint(1000000000000, 9999999999999))
        self.organization[
            'org_address'] = "{}, {}, город {}, {} {}, дом {}".format(
                generic.address.zip_code(), generic.address.region(),
                generic.address.city(), generic.address.street_suffix(),
                generic.address.street_name(), random.randint(1, 400))

        gender = random.choice([Gender.FEMALE, Gender.MALE])
        self.organization['head_full_name'] = "{} {} {}".format(
            generic.person.last_name(gender=gender),
            generic.person.name(gender=gender), ru.patronymic(gender=gender))

        gender = random.choice([Gender.FEMALE, Gender.MALE])
        self.organization['representative_full_name'] = "{} {} {}".format(
            generic.person.last_name(gender=gender),
            generic.person.name(gender=gender), ru.patronymic(gender=gender))
        self.organization[
            'representative_position'] = generic.person.occupation()
Ejemplo n.º 7
0
import sqlite3

from mimesis import Generic
from mimesis import Person
from mimesis import Datetime
from mimesis import Address
from mimesis.enums import Gender
from mimesis.builtins import RussiaSpecProvider

import random
g = Generic('ru')
p = Person('ru')
dt = Datetime('ru')
rus = RussiaSpecProvider('ru')
adr = Address('ru')

conn = sqlite3.connect('people_base.db')
cur = conn.cursor()

gen = ['Женский', 'Мужской']
n = 1

cur.execute("""CREATE TABLE IF NOT EXISTS people(
   id INT PRIMARY KEY,
   gender TEXT,
   first_name TEXT,
   last_name TEXT,
   age TEXT,
   month_ob TEXT,
   day_ob TEXT,
   year_ob TEXT,