Skip to content

ConflictResolutionStrategy docstring documents a NONE member that the enum does not define #2241

Description

@hfyeomans

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions