11from enum import Enum
2+ from typing import List
23
34from nightfall .exceptions import NightfallUserError
45
@@ -21,10 +22,10 @@ def as_dict(self):
2122
2223class WordList :
2324 """A list of words that can be used to customize the behavior of a detector while Nightfall performs a scan."""
24- def __init__ (self , word_list : list [str ], is_case_sensitive : bool ):
25+ def __init__ (self , word_list : List [str ], is_case_sensitive : bool ):
2526 """Instantiate a WordList object
2627 :param word_list: The list of words to use.
27- :type word_list: list [str]
28+ :type word_list: List [str]
2829 :param is_case_sensitive: Whether to make matches have the same case as each word given
2930 :type is_case_sensitive: bool
3031 """
@@ -106,7 +107,7 @@ def as_dict(self):
106107class MaskConfig :
107108 """An object that specifies how findings should be masked when returned by the API."""
108109 def __init__ (self , masking_char : chr , num_chars_to_leave_unmasked : int = 0 ,
109- mask_right_to_left : bool = False , chars_to_ignore : list [chr ] = []):
110+ mask_right_to_left : bool = False , chars_to_ignore : List [chr ] = []):
110111 """Instantiate a MaskConfig object
111112 :param masking_char: character that will be repeated to replace the finding.
112113 This character may be a multi-byte character, but it must be exactly one codepoint.
@@ -118,7 +119,7 @@ def __init__(self, masking_char: chr, num_chars_to_leave_unmasked: int = 0,
118119 :type mask_right_to_left: bool
119120 :param chars_to_ignore: the set of characters to leave unmasked when the finding is returned. These characters
120121 may be multi-byte characters, but each entry in the array must be exactly one codepoint.
121- :type chars_to_ignore: list [chr]
122+ :type chars_to_ignore: List [chr]
122123 """
123124 self .masking_char = masking_char
124125 self .num_chars_to_leave_unmasked = num_chars_to_leave_unmasked
@@ -204,8 +205,8 @@ def __init__(
204205 word_list : WordList = None ,
205206 uuid : str = None ,
206207 display_name : str = None ,
207- context_rules : list [ContextRule ] = None ,
208- exclusion_rules : list [ExclusionRule ] = None ,
208+ context_rules : List [ContextRule ] = None ,
209+ exclusion_rules : List [ExclusionRule ] = None ,
209210 redaction_config : RedactionConfig = None
210211 ):
211212 """Instantiate a Detector object.
@@ -226,9 +227,9 @@ def __init__(
226227 :param display_name: A display name for this detector.
227228 :type display_name: str or None
228229 :param context_rules: The context rules to use to customize the behavior of this detector.
229- :type context_rules: list [ContextRule] or None
230+ :type context_rules: List [ContextRule] or None
230231 :param exclusion_rules: The exclusion rules to use to customize the behavior of this detector.
231- :type exclusion_rules: list [ExclusionRule] or None
232+ :type exclusion_rules: List [ExclusionRule] or None
232233 :param redaction_config: Sets the redaction configuration to-be-applied to this detector. This configuration is
233234 currently only supported for scanning plaintext, not for file scanning.
234235 :type redaction_config: RedactionConfig or None
@@ -284,10 +285,10 @@ class LogicalOp(Enum):
284285
285286class DetectionRule :
286287 """An object that contains a set of detectors to be used when scanning content."""
287- def __init__ (self , detectors : list [Detector ], logical_op : LogicalOp = LogicalOp .ANY ):
288+ def __init__ (self , detectors : List [Detector ], logical_op : LogicalOp = LogicalOp .ANY ):
288289 """Instantiate a DetectionRule
289290 :param detectors: A list of Detectors to scan content with.
290- :type detectors: list [Detector]
291+ :type detectors: List [Detector]
291292 :param logical_op: The method for combining the detectors. One of:
292293 - LogicalOp.ANY (logical or, i.e. a finding is emitted only if any of the provided detectors match)
293294 - LogicalOp.ALL (logical and, i.e. a finding is emitted only if all provided detectors match)
0 commit comments