Skip to content

Commit 80285ff

Browse files
fix
1 parent bfb8e73 commit 80285ff

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

pylint/testutils/_primer/comparator.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,19 @@ def from_json(
154154
main_data: PackageMessages
155155
pr_data: PackageMessages
156156
if batches is None:
157-
main_data = _load_json(base_file)
158-
pr_data = _load_json(new_file)
157+
main_data = Comparator._load_json(base_file)
158+
pr_data = Comparator._load_json(new_file)
159159
else:
160160
main_data = {}
161161
pr_data = {}
162162
for idx in range(batches):
163163
suffix = f"batch{idx}"
164-
main_data.update(_load_json(str(base_file).replace("BATCHIDX", suffix)))
165-
pr_data.update(_load_json(str(new_file).replace("BATCHIDX", suffix)))
164+
main_data.update(
165+
Comparator._load_json(str(base_file).replace("BATCHIDX", suffix))
166+
)
167+
pr_data.update(
168+
Comparator._load_json(str(new_file).replace("BATCHIDX", suffix))
169+
)
166170
return Comparator(main_data, pr_data)
167171

168172
def __iter__(self) -> Iterator[PackageDiff]:
@@ -189,8 +193,8 @@ def __iter__(self) -> Iterator[PackageDiff]:
189193
continue
190194
yield package, final_missing, final_new, paired
191195

192-
193-
def _load_json(file_path: Path | str) -> PackageMessages:
194-
with open(file_path, encoding="utf-8") as f:
195-
result: PackageMessages = json.load(f)
196-
return result
196+
@staticmethod
197+
def _load_json(file_path: Path | str) -> PackageMessages:
198+
with open(file_path, encoding="utf-8") as f:
199+
result: PackageMessages = json.load(f)
200+
return result

0 commit comments

Comments
 (0)