Coverage for presidio_analyzer / dict_analyzer_result.py: 100%
5 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-03-29 09:03 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-03-29 09:03 +0000
1from dataclasses import dataclass
2from typing import Iterator, List, Union
4from presidio_analyzer import RecognizerResult
7@dataclass
8class DictAnalyzerResult:
9 """
10 Data class for holding the output of the Presidio Analyzer on dictionaries.
12 :param key: key in dictionary
13 :param value: value to run analysis on (either string or list of strings)
14 :param recognizer_results: Analyzer output for one value.
15 Could be either:
16 - A list of recognizer results if the input is one string
17 - A list of lists of recognizer results, if the input is a list of strings.
18 - An iterator of a DictAnalyzerResult, if the input is a dictionary.
19 In this case the recognizer_results would be the iterator
20 of the DictAnalyzerResults next level in the dictionary.
21 """
23 key: str
24 value: Union[str, List[str], dict]
25 recognizer_results: Union[
26 List[RecognizerResult],
27 List[List[RecognizerResult]],
28 Iterator["DictAnalyzerResult"],
29 ]