# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

from tblfaker import TableFaker

# +
# Basic usage: get outputs as tuples

faker = TableFaker()

print("[1]")
for row in faker.generate(["name", "address"], rows=4).as_tuple():
    print(row)

print("\n[2]")
for row in faker.generate(["name", "address"], rows=4).as_tuple():
    print(row)

# +
# Basic usage: using a seed to get stable outputs

seed = 1

print("[1]")
faker = TableFaker(seed=seed)
for row in faker.generate(["name", "address"], rows=4).as_tuple():
    print(row)

print("\n[2]")
faker = TableFaker(seed=seed)
for row in faker.generate(["name", "address"], rows=4).as_tuple():
    print(row)

# +
# Change locale

faker = TableFaker(locale="ja_JP")

for row in faker.generate(["name", "address"], rows=4).as_tuple():
    print(row)

# +
# Get outputs as JSON

import json

faker = TableFaker(seed=1)

print(json.dumps(faker.generate(["name", "address"], rows=2, table_name="dict").as_dict(), indent=4))

# +
# List providers

from tblfaker import get_providers

for provider in sorted(get_providers()):
    print(provider)

# +
providers = get_providers() - {"zip"}
limit = 32

for provider, row in zip(providers, faker.generate(providers, rows=2).transpose().rows):
    print("{}: {}".format(
        provider,
        [value[:limit] if isinstance(value, (str, list)) else str(value)[:limit] for value in row]
    ))

# -



StarcoderdataJupyterScriptsDedupFiltered