in generators/datagenerator/users.py [0:0]
def __init__(self, category_preference_personas, selectable_user, id_string=None):
if(id_string != None):
self.id = id_string
else:
self.id = str(random.randint(1000000000, 99999999999))
self.selectable_user = selectable_user
self.gender = random.choice(['M', 'F'])
if self.gender == 'F':
self.first_name = fake.first_name_female()
self.last_name = fake.last_name_female()
else:
self.first_name = fake.first_name_male()
self.last_name = fake.last_name_male()
address_state = fake.state_abbr(include_territories=True)
email_first = self.first_name.replace(' ', '').lower()
email_last = self.last_name.replace(' ', '').lower()
self.email = f'{email_first}.{email_last}@example.com'
self.age = int(age_dist.rvs())
self.name = f'{self.first_name} {self.last_name}'
self.username = f'user{self.id}'
# These are hard-coded from the AWS samples Retail Demo Store workshop
self.persona = random.choice(category_preference_personas)
self.discount_persona = random.choice(discount_personas)
self.traits = {}
ios_token = fake.ios_platform_token()
ios_identifiers = ios_token.split(' ')
android_token = fake.android_platform_token()
android_identifiers = android_token.split(' ')
self.platforms = {
"ios": {
"anonymous_id": str(fake.uuid4()),
"advertising_id": str(fake.uuid4()),
"user_agent": ios_token,
"model": ios_identifiers[0],
"version": ios_identifiers[4]
},
"android": {
"anonymous_id": str(fake.uuid4()),
"advertising_id": str(fake.uuid4()),
"user_agent": android_token,
"version": android_identifiers[1]
},
"web": {
"anonymous_id": str(fake.uuid4()),
"user_agent": fake.user_agent()
}
}
self.addresses = [
{
'first_name': self.first_name,
'last_name': self.last_name,
'address1': fake.street_address(),
'address2': '',
'country': 'US',
'city': fake.city(),
'state': address_state,
'zipcode': fake.postcode_in_state(state_abbr=address_state),
'default': True
}
]