Describe the bug
The ConflictResolutionStrategy docstring documents a NONE member that the enum does not define.
At commit 5e2fcea990aa3b99660d2aea9121d0ba74a8940b, presidio-anonymizer/presidio_anonymizer/entities/conflict_resolution_strategy.py:
- line 15 (in the class docstring):
NONE: No conflict resolution will be performed.
- lines 18-19 (the members):
MERGE_SIMILAR_OR_CONTAINED and REMOVE_INTERSECTIONS only.
There is also no code path that performs no conflict resolution: in anonymizer_engine.py, the merge and conflict passes in _remove_conflicts_and_get_text_manipulation_data run unconditionally, and only REMOVE_INTERSECTIONS is gated (line 196).
To Reproduce
from presidio_anonymizer.entities import ConflictResolutionStrategy
ConflictResolutionStrategy.NONE # AttributeError: NONE
Why it matters
A caller who follows the docstring and passes ConflictResolutionStrategy.NONE to AnonymizerEngine.anonymize gets an AttributeError, and the docstring implies an opt-out from conflict resolution that the engine does not offer.
Suggested fix
Delete line 15 from the docstring. If a no-op strategy is actually intended, the alternative is to add the member and return early from _remove_conflicts_and_get_text_manipulation_data when it is selected, but that is a behaviour change rather than a docs fix.
Additional context
Found while evaluating Presidio as a reference detector for a browser DLP extension.
Describe the bug
The
ConflictResolutionStrategydocstring documents aNONEmember that the enum does not define.At commit
5e2fcea990aa3b99660d2aea9121d0ba74a8940b,presidio-anonymizer/presidio_anonymizer/entities/conflict_resolution_strategy.py:NONE: No conflict resolution will be performed.MERGE_SIMILAR_OR_CONTAINEDandREMOVE_INTERSECTIONSonly.There is also no code path that performs no conflict resolution: in
anonymizer_engine.py, the merge and conflict passes in_remove_conflicts_and_get_text_manipulation_datarun unconditionally, and onlyREMOVE_INTERSECTIONSis gated (line 196).To Reproduce
Why it matters
A caller who follows the docstring and passes
ConflictResolutionStrategy.NONEtoAnonymizerEngine.anonymizegets anAttributeError, and the docstring implies an opt-out from conflict resolution that the engine does not offer.Suggested fix
Delete line 15 from the docstring. If a no-op strategy is actually intended, the alternative is to add the member and return early from
_remove_conflicts_and_get_text_manipulation_datawhen it is selected, but that is a behaviour change rather than a docs fix.Additional context
Found while evaluating Presidio as a reference detector for a browser DLP extension.