13
13
from ..models .fragment import Fragment
14
14
from ..models .label import Label
15
15
from ..models .patch import PatchTitle
16
- from .data_manager import DataManager
17
16
from .exceptions import APIResponseError , PatcherError , ShellCommandError
18
17
from .logger import LogMe
19
18
@@ -32,7 +31,6 @@ def __init__(self, concurrency: Optional[int] = 5):
32
31
self .label_path = Path .home () / "Library/Application Support/Patcher/.labels"
33
32
self .config = ConfigManager ()
34
33
self .api = ApiClient (config = self .config , concurrency = concurrency )
35
- self .data_manager = DataManager ()
36
34
self .threshold = 85
37
35
self .review_file = Path .home () / "Library/Application Support/Patcher/unmatched_apps.json"
38
36
@@ -196,7 +194,10 @@ def _match_fuzzy(self, app_names: List[str], label_lookup: Dict[str, Label]) ->
196
194
return matched_labels
197
195
198
196
def _second_pass (
199
- self , unmatched_apps : List [Dict [str , Any ]], label_lookup : Dict [str , Label ]
197
+ self ,
198
+ unmatched_apps : List [Dict [str , Any ]],
199
+ label_lookup : Dict [str , Label ],
200
+ patch_titles : List [PatchTitle ],
200
201
) -> int :
201
202
"""Attempts to match previously unmatched apps by normalized ``PatchTitle.title`` and fuzzy search."""
202
203
matched_count = 0
@@ -205,9 +206,7 @@ def _second_pass(
205
206
for entry in unmatched_apps :
206
207
patch_name = entry ["Patch" ]
207
208
normalized_patch = self ._normalize (patch_name )
208
- patch_title = next (
209
- (pt for pt in self .data_manager .titles if pt .title == patch_name ), None
210
- )
209
+ patch_title = next ((pt for pt in patch_titles if pt .title == patch_name ), None )
211
210
212
211
if normalized_patch in label_lookup :
213
212
if patch_title :
@@ -315,7 +314,7 @@ async def match(self, patch_titles: List[PatchTitle]) -> None:
315
314
else :
316
315
unmatched_apps .append ({"Patch" : patch_title .title , "App Names" : app_names })
317
316
318
- matched_count += self ._second_pass (unmatched_apps , label_lookup )
317
+ matched_count += self ._second_pass (unmatched_apps , label_lookup , patch_titles )
319
318
320
319
self ._save_unmatched_apps (unmatched_apps )
321
320
0 commit comments