11
11
12
12
from . import scan
13
13
from .potential_secret import PotentialSecret
14
+ from detect_secrets .settings import configure_settings_from_baseline
15
+ from detect_secrets .settings import get_settings
14
16
15
17
16
18
class PatchedFile :
@@ -55,7 +57,13 @@ def scan_files(self, *filenames: str, num_processors: Optional[int] = None) -> N
55
57
if not num_processors :
56
58
num_processors = mp .cpu_count ()
57
59
58
- with mp .Pool (processes = num_processors ) as p :
60
+ child_process_settings = get_settings ().json ()
61
+
62
+ with mp .Pool (
63
+ processes = num_processors ,
64
+ initializer = configure_settings_from_baseline ,
65
+ initargs = (child_process_settings ,),
66
+ ) as p :
59
67
for secrets in p .imap_unordered (
60
68
_scan_file_and_serialize ,
61
69
[os .path .join (self .root , filename ) for filename in filenames ],
@@ -241,8 +249,12 @@ def __eq__(self, other: Any, strict: bool = False) -> bool:
241
249
return False
242
250
243
251
for filename in self .files :
244
- self_mapping = {secret .secret_hash : secret for secret in self [filename ]}
245
- other_mapping = {secret .secret_hash : secret for secret in other [filename ]}
252
+ self_mapping = {
253
+ (secret .secret_hash , secret .type ): secret for secret in self [filename ]
254
+ }
255
+ other_mapping = {
256
+ (secret .secret_hash , secret .type ): secret for secret in other [filename ]
257
+ }
246
258
247
259
# Since PotentialSecret is hashable, we compare their identities through this.
248
260
if set (self_mapping .values ()) != set (other_mapping .values ()):
@@ -252,7 +264,7 @@ def __eq__(self, other: Any, strict: bool = False) -> bool:
252
264
continue
253
265
254
266
for secretA in self_mapping .values ():
255
- secretB = other_mapping [secretA .secret_hash ]
267
+ secretB = other_mapping [( secretA .secret_hash , secretA . type ) ]
256
268
257
269
valuesA = vars (secretA )
258
270
valuesA .pop ('secret_value' )
0 commit comments