Anonymizor class reference¶
Anonymizers are used to anonymize data while outputting.
This module contains all classes for anonymizers:
data_migrator.anonymizors.base.BaseAnonymizer
SimpleStringAnonymizor
TextAnonymizor
ChoiceAnonymizor
Note
Also check the data_migrator.contrib
module for some country
specific anonymizers
SimpleStringAnonymizor¶
-
class
data_migrator.anonymizors.strings.
SimpleStringAnonymizor
¶ SimpleStringAnonymizor translates to random printable chars
TextAnonymizor¶
-
class
data_migrator.anonymizors.strings.
TextAnonymizor
¶ TextAnonymizor translates to random chars taking whitespace and and punctuation into account.
ChoiceAnonymizor¶
-
class
data_migrator.anonymizors.lists.
ChoiceAnonymizor
(choices, weights=None)¶ ChoiceAnonymizor returns some choices with optional probabilities
>>> ChoiceAnonymizor(['M', 'F', None], weights=[0.3, 0.3, 0.4])() 'M'
-
choices
¶ list – list of choices to select from
-
weights
¶ list – optional list of weights
-
BaseAnonymizor¶
-
class
data_migrator.anonymizors.base.
BaseAnonymizor
¶ BaseType for anonymizers of the data-migrator.
Instantiate the anonymizer and definition and call the instantiation at translation time.
Implement the
__call__()
method to implement your specific anonymizor.-
__call__
(v)¶ output the anonymized object.
Parameters: v – object to anonymize Returns: anonymized value
-