Ejemplo n.º 1
0
def next_book(authors: typing.List[Author],
              data_locale: str) -> typing.Iterator[Book]:
    code = mimesis.Code(data_locale)
    date = mimesis.Datetime(data_locale)
    text = mimesis.Text(data_locale)

    book_id = 0

    while True:
        book_id += 1

        book = Book(book_id)
        book.title = text.title()
        book.author = random.choice(authors)
        book.isbn = code.isbn()
        book.release_at = date.date(start=1800, end=2018)

        yield book
Ejemplo n.º 2
0
def code(request):
    return mimesis.Code(request.param)
Ejemplo n.º 3
0
def code():
    return mimesis.Code()
outsize = config["products"]["total"]

# config suppliers
n_suppliers = config["suppliers"]["total"]
supplier_id_range = list(range(1, n_suppliers + 1))

# data processing config
amounts_cpu = config["data_processing"]["amount_in_cpu"]
auto_batch = True if config["data_processing"][
    "auto_batch_based_in_cpu"] == "True" else False

# loading mocking data type
food = mimesis.Food(language)
person = mimesis.Person(language)
dates = mimesis.Datetime(language)
code = mimesis.Code(language)

# 5 categories
categories_prob = common_functions.random_probabilities(1, 5)
suppliers_prob = common_functions.random_probabilities(1, n_suppliers)

products = []


def generate_products(amount, index_start):
    # generates products' info
    # amount: number of products to generate
    # index_start: from what index starts

    results = set()