else: value = getattr(obj, key, None) return recursive_get(value, parts) if parts else value def unique_string(length=UUID_LENGTH): '''Generate a unique string''' # We need a string at least as long as length string = str(uuid4()) * int(math.ceil(length / float(UUID_LENGTH))) return string[:length] if length else string # This is the default providers list # We remove the lorum one to replace it # with a unicode enabled one below PROVIDERS.remove('faker.providers.lorem') faker = Faker('fr_FR') # Use a unicode/utf-8 based locale def faker_provider(provider): faker.add_provider(provider) factory.Faker.add_provider(provider) return provider @faker_provider class UDataProvider(BaseProvider): ''' A Faker provider for UData missing requirements.