Anonymizor class reference

Anonymizers are used to anonymize data while outputting.

This module contains all classes for anonymizers:

Note

Also check the data_migrator.contrib module for some country specific anonymizers

SimpleStringAnonymizor

class data_migrator.anonymizors.strings.SimpleStringAnonymizor[source]

SimpleStringAnonymizor translates to random printable chars

TextAnonymizor

class data_migrator.anonymizors.strings.TextAnonymizor[source]

TextAnonymizor translates to random chars taking whitespace and and punctuation into account.

ChoiceAnonymizor

class data_migrator.anonymizors.lists.ChoiceAnonymizor(choices, weights=None)[source]

ChoiceAnonymizor returns some choices with optional probabilities

>>> ChoiceAnonymizor(['M', 'F', None], weights=[0.3, 0.3, 0.4])()
'M'
choices

list of choices to select from

Type:list
weights

optional list of weights

Type:list

BaseAnonymizor

class data_migrator.anonymizors.base.BaseAnonymizor[source]

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)[source]

output the anonymized object.

Parameters:v – object to anonymize
Returns:anonymized value