Configuration#
Configuration types for anonymization.
- class icalendar_anonymizer._config.AnonymizeMode(*values)[source]#
Bases:
StrEnumAnonymization mode for a configurable field.
- KEEP = 'keep'#
- RANDOMIZE = 'randomize'#
- REMOVE = 'remove'#
- REPLACE = 'replace'#
- icalendar_anonymizer._config.CONFIGURABLE_FIELDS = frozenset({'ATTENDEE', 'CATEGORIES', 'COMMENT', 'CONTACT', 'DESCRIPTION', 'LOCATION', 'ORGANIZER', 'RESOURCES', 'SUMMARY', 'UID'})#
Set of field names that can be configured with field_modes parameter.
Contains 10 fields: SUMMARY, DESCRIPTION, LOCATION, COMMENT, CONTACT, RESOURCES, CATEGORIES, ATTENDEE, ORGANIZER, and UID.
- icalendar_anonymizer._config.DEFAULT_PLACEHOLDERS = {'ATTENDEE': 'mailto:redacted@example.local', 'CATEGORIES': 'REDACTED', 'COMMENT': '[Comment removed]', 'CONTACT': '[Contact removed]', 'DESCRIPTION': '[Content removed]', 'LOCATION': '[Location removed]', 'ORGANIZER': 'mailto:redacted@example.local', 'RESOURCES': '[Resources removed]', 'SUMMARY': '[Redacted]'}#
Default placeholder values used in REPLACE mode.
Maps field names to their placeholder strings. UID uses a counter for uniqueness: redacted-1@anonymous.local, redacted-2@anonymous.local, etc.
- icalendar_anonymizer._config.validate_field_modes(field_modes: dict[str, str] | None) dict[str, AnonymizeMode] | None[source]#
Validate and normalize field_modes dict.
- Parameters:
field_modes – Dict mapping field name to mode string
- Returns:
Normalized dict with uppercase keys and AnonymizeMode values
- Raises:
ValueError – If invalid field name, invalid mode, or UID set to remove
TypeError – If field_modes is not a dict or None