def next_vehicle(owners: typing.List[Owner], data_locale: str) -> typing.Iterator[Vehicle]: vehicle_id = 0 transport = mimesis.Transport(data_locale) vehicle_date = mimesis.Datetime(data_locale) numbers = mimesis.Numbers(data_locale) while True: vehicle_id += 1 vehicle = Vehicle(vehicle_id) vehicle.name = transport.car().title() vehicle.code = transport.vehicle_registration_code(data_locale) vehicle.owner = random.choice(owners) vehicle.vehicle_date = vehicle_date.date(start=1800, end=2018).isoformat() vehicle.temparature = numbers.integer_number(start=-30, end=50) yield vehicle
def transport(): return mimesis.Transport()
def transport(request): return mimesis.Transport(request.param)