Skip to content

Commit b95fccc

Browse files
committed
lint
1 parent 478b3bd commit b95fccc

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

arthur_bench/client/fs/abc_fs_client.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ def get_test_suite_by_name(self, test_suite_name: str) -> PaginatedTestSuite:
8989

9090
@staticmethod
9191
@abstractmethod
92-
def load_suite_with_optional_id(filepath: Union[str, os.PathLike]) -> Optional[PaginatedTestSuite]:
92+
def load_suite_with_optional_id(
93+
filepath: Union[str, os.PathLike]
94+
) -> Optional[PaginatedTestSuite]:
9395
raise NotImplementedError(
9496
"Calling an abstract method. Please use a concrete base class"
9597
)
@@ -113,7 +115,9 @@ def parse_paginated_test_suite(self, id: str) -> PaginatedTestSuite:
113115
)
114116

115117
@abstractmethod
116-
def parse_paginated_test_run(self, test_suite_id: str, test_run_id: str) -> PaginatedRun:
118+
def parse_paginated_test_run(
119+
self, test_suite_id: str, test_run_id: str
120+
) -> PaginatedRun:
117121
raise NotImplementedError(
118122
"Calling an abstract method. Please use a concrete base class"
119123
)

arthur_bench/client/fs/local_client.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class LocalBenchClient(BenchClient):
155155
Client for managing local file system test suites and runs
156156
"""
157157

158-
def __init__(self, config, use_s3 = False):
158+
def __init__(self, config, use_s3=False):
159159
if not use_s3:
160160
self.fs_client = LocalFSClient(config)
161161
else:
@@ -193,7 +193,9 @@ def get_test_suites(
193193
if name is not None:
194194
test_suite_dir = self.fs_client.get_test_suite_dir(name)
195195
if test_suite_dir.is_dir():
196-
suite = self.fs_client.load_suite_with_optional_id(test_suite_dir / "suite.json")
196+
suite = self.fs_client.load_suite_with_optional_id(
197+
test_suite_dir / "suite.json"
198+
)
197199
if suite is None:
198200
suite = self.fs_client.get_test_suite_by_name(name)
199201
return PaginatedTestSuites(
@@ -311,7 +313,9 @@ def get_runs_for_test_suite(
311313

312314
runs = []
313315
for f in self.fs_client.get_run_files(test_suite_name):
314-
run_obj = self.fs_client.parse_paginated_test_run(test_suite_id, _get_run_name_from_file_path(f))
316+
run_obj = self.fs_client.parse_paginated_test_run(
317+
test_suite_id, _get_run_name_from_file_path(f)
318+
)
315319
avg_score = np.mean([o.score for o in run_obj.test_cases])
316320
run_resp = TestRunMetadata(**run_obj.dict(), avg_score=float(avg_score))
317321
runs.append(run_resp)
@@ -345,9 +349,12 @@ def get_summary_statistics(
345349
run_files = self.fs_client.get_run_files(test_suite_name)
346350

347351
if run_ids:
348-
run_name_to_file_dict = {_get_run_name_from_file_path(file): file for file in run_files}
352+
run_name_to_file_dict = {
353+
_get_run_name_from_file_path(file): file for file in run_files
354+
}
349355
run_names = [
350-
self.fs_client.get_run_name_from_id(test_suite_name, id) for id in run_ids
356+
self.fs_client.get_run_name_from_id(test_suite_name, id)
357+
for id in run_ids
351358
]
352359
filtered_run_files = {
353360
k: run_name_to_file_dict[k]
@@ -357,7 +364,9 @@ def get_summary_statistics(
357364
run_files = list(filtered_run_files.values())
358365

359366
for f in run_files:
360-
run_obj = self.fs_client.parse_paginated_test_run(test_suite_id, _get_run_name_from_file_path(f))
367+
run_obj = self.fs_client.parse_paginated_test_run(
368+
test_suite_id, _get_run_name_from_file_path(f)
369+
)
361370
runs.append(
362371
_summarize_run(run=run_obj, scoring_method=suite.scoring_method)
363372
)

arthur_bench/client/fs/local_fs_client.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ def get_test_suite_by_name(self, test_suite_name: str) -> PaginatedTestSuite:
119119
return resp
120120

121121
@staticmethod
122-
def load_suite_with_optional_id(filepath: Union[str, os.PathLike]) -> Optional[PaginatedTestSuite]:
122+
def load_suite_with_optional_id(
123+
filepath: Union[str, os.PathLike]
124+
) -> Optional[PaginatedTestSuite]:
123125
if get_file_extension(filepath) != ".json":
124126
raise UserValueError("filepath must be json file")
125127
suite = json.load(open(filepath))
@@ -141,7 +143,9 @@ def parse_paginated_test_suite(self, id: str) -> PaginatedTestSuite:
141143
suite_file = self.root_dir / suite_name / "suite.json"
142144
return PaginatedTestSuite.parse_file(suite_file)
143145

144-
def parse_paginated_test_run(self, test_suite_id: str, run_name: str) -> PaginatedRun:
146+
def parse_paginated_test_run(
147+
self, test_suite_id: str, run_name: str
148+
) -> PaginatedRun:
145149
suite_name = self.get_suite_name_from_id(test_suite_id)
146150
if not suite_name:
147151
raise NotFoundError(f"no test suite with id: {test_suite_id}")
@@ -157,4 +161,3 @@ def write_suite_file(self, suite_dir: Path, test_suite: PaginatedTestSuite) -> N
157161
def write_run_file(self, run_dir: Path, test_run: PaginatedRun) -> None:
158162
run_file = run_dir / "run.json"
159163
run_file.write_text(test_run.json())
160-

0 commit comments

Comments
 (0)