Skip to content

Commit e52af64

Browse files
committed
fix(Installomator): avoid call to DataManager.titles property directly
1 parent ee212a0 commit e52af64

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/patcher/utils/installomator.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from ..models.fragment import Fragment
1414
from ..models.label import Label
1515
from ..models.patch import PatchTitle
16-
from .data_manager import DataManager
1716
from .exceptions import APIResponseError, PatcherError, ShellCommandError
1817
from .logger import LogMe
1918

@@ -32,7 +31,6 @@ def __init__(self, concurrency: Optional[int] = 5):
3231
self.label_path = Path.home() / "Library/Application Support/Patcher/.labels"
3332
self.config = ConfigManager()
3433
self.api = ApiClient(config=self.config, concurrency=concurrency)
35-
self.data_manager = DataManager()
3634
self.threshold = 85
3735
self.review_file = Path.home() / "Library/Application Support/Patcher/unmatched_apps.json"
3836

@@ -196,7 +194,10 @@ def _match_fuzzy(self, app_names: List[str], label_lookup: Dict[str, Label]) ->
196194
return matched_labels
197195

198196
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],
200201
) -> int:
201202
"""Attempts to match previously unmatched apps by normalized ``PatchTitle.title`` and fuzzy search."""
202203
matched_count = 0
@@ -205,9 +206,7 @@ def _second_pass(
205206
for entry in unmatched_apps:
206207
patch_name = entry["Patch"]
207208
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)
211210

212211
if normalized_patch in label_lookup:
213212
if patch_title:
@@ -315,7 +314,7 @@ async def match(self, patch_titles: List[PatchTitle]) -> None:
315314
else:
316315
unmatched_apps.append({"Patch": patch_title.title, "App Names": app_names})
317316

318-
matched_count += self._second_pass(unmatched_apps, label_lookup)
317+
matched_count += self._second_pass(unmatched_apps, label_lookup, patch_titles)
319318

320319
self._save_unmatched_apps(unmatched_apps)
321320

0 commit comments

Comments
 (0)