Skip to content

Commit 04a5314

Browse files
committed
Add comment to speciy why we are setting an attribute to fakers instance.
1 parent 861c5bf commit 04a5314

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rdt/transformers/pii/anonymizer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ def reset_randomization(self):
197197
def _function(self):
198198
"""Return the result of calling the ``faker`` function."""
199199
if not hasattr(self.faker.unique, '_excluded_types'):
200-
setattr(self.faker.unique, '_excluded_types', ()) # The default is an empty tuple
200+
# Faker v40.1.0 changed its uniqueness logic to rely on _excluded_types.
201+
# Instances created before v40.1.0 don’t initialize this attribute,
202+
# so accessing it can raise runtime errors.
203+
setattr(self.faker.unique, '_excluded_types', ())
201204

202205
try:
203206
if self.cardinality_rule in {'unique', 'match', 'scale'}:

0 commit comments

Comments
 (0)