11import shutil
22from io import StringIO
3- from typing import Dict , List , Optional , Tuple
3+ from typing import Dict , List , Optional , Set , Tuple
44
55from pygitguardian .client import VERSIONS
66from pygitguardian .models import DiffKind , PolicyBreak
3131class SecretTextOutputHandler (SecretOutputHandler ):
3232 def _process_scan_impl (self , scan : SecretScanCollection ) -> str :
3333 """Output Secret Scan Collection in text format"""
34- diff_kinds = [ DiffKind .ADDITION ]
34+ diff_kinds : Set [ DiffKind ] = { DiffKind .ADDITION }
3535 if self .verbose :
36- diff_kinds += [ DiffKind .DELETION , DiffKind .CONTEXT ]
36+ diff_kinds . update (( DiffKind .DELETION , DiffKind .CONTEXT ))
3737
3838 processed_scan_results = self .process_scan_results (scan , diff_kinds = diff_kinds )
3939 scan_buf = StringIO ()
@@ -77,7 +77,7 @@ def _process_scan_impl(self, scan: SecretScanCollection) -> str:
7777 def process_scan_results (
7878 self ,
7979 scan : SecretScanCollection ,
80- diff_kinds : List [DiffKind ],
80+ diff_kinds : Set [DiffKind ],
8181 show_only_known_secrets : bool = False ,
8282 ) -> str :
8383 """Iterate through the scans and sub-scan results to prepare the display."""
@@ -108,7 +108,7 @@ def process_scan_results(
108108 def process_result (
109109 self ,
110110 result : Result ,
111- diff_kinds : List [DiffKind ],
111+ diff_kinds : Set [DiffKind ],
112112 show_only_known_secrets : bool = False ,
113113 ) -> str :
114114 """
@@ -122,7 +122,7 @@ def process_result(
122122 result_buf = StringIO ()
123123
124124 sha_dict = group_policy_breaks_by_ignore_sha (
125- result .policy_breaks (diff_kinds = diff_kinds )
125+ result .get_policy_breaks (diff_kinds = diff_kinds )
126126 )
127127
128128 if not self .show_secrets :
0 commit comments