Category : faker

I want to generate fake data from my proto files with the faker library but I’m not sure how to link the proto file with the faker to select from the enums. An example: Here is what my proto file looks like: message Address{ string Home=1; State state=2; string Name=3; enum State{ STATE_UNKNOWN=0; STATE_ARCHIVED=1; } ..

Read more

Assume I have the following classes: @dataclass class Image: array: np.ndarray @dataclass class Label: array: np.ndarray @dataclass class Sample: image: Image label: Label with the following factory_boy factories: class ImageFactory(factory.Factory): class Meta: model = Image class Params: shape = (64, 64) array = factory.LazyAttribute(lambda o: np.random.random(o.shape)) class LabelFactory(factory.Factory): class Meta: model = Label class Params: ..

Read more

I have used the Faker library to generate synthetic credit card numbers. When I call Faker().credit_card_number() a random credit card number is generated (e.g. ‘2692551062396065’). Therefore calling Faker().credit_card_number() multiple times should generate multiple random credit card numbers. For example: [Faker().credit_card_number() for _ in range(4)] Generates: [‘434435436’, ‘3424242’, ‘2343432’, ‘743534’] However: x = Faker().credit_card_number() [x for ..

Read more

In the mimesis documentation/code, I see that the BaseProvider and thus all providers have a seed kwarg. The documentation on it is sparse (as far as I can find), but it looks like as with faker, it sets the randomizer seed, thus if I want to replicate a particular set of random data, I could ..

Read more

I have a factoryboy factory for sqlalchemy model which uses faker from faker import Faker from db_init import session fake = Faker() class ClientAppFactory(factory.alchemy.SQLAlchemyModelFactory): class Meta: model = ClientApp sqlalchemy_session = session sqlalchemy_session_persistence = ‘commit’ name = fake.word() display_name = fake.word() This factory creates rows in database. Field name of my model must be unique. ..

Read more