Skip to content

Commit d8ee3c3

Browse files
committed
Fix style issues
1 parent 61a4e8e commit d8ee3c3

File tree

4 files changed

+16
-21
lines changed

4 files changed

+16
-21
lines changed

lib/pavilion/commands/cat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def run(self, pav_cfg, args):
4444
output.fprint(self.errfile, "No last test found.", color=output.RED)
4545
return 1
4646
elif TestID.is_valid_id(args.test_id):
47-
test_id = TestID(args.test_id)
47+
test_id = TestID(args.test_id)
4848
else:
4949
output.fprint(self.errfile, f"{args.test_id} is not a valid test ID.")
5050
return errno.EEXIST

lib/pavilion/commands/log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def run(self, pav_cfg, args):
149149
if cmd_name == 'states':
150150
if args.id is None:
151151
args.id = cmd_utils.get_last_test_id(pav_cfg, self.errfile)
152-
152+
153153
if args.id is None:
154154
output.fprint(self.errfile, "No last test found.", color=output.RED)
155155
return 1

lib/pavilion/commands/set_status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run(self, pav_cfg, args):
4747
return 0
4848

4949
if TestID.is_valid_id(args.test):
50-
test_id = TestID(args.test)
50+
test_id = TestID(args.test)
5151
else:
5252
output.fprint(self.errfile, f"{args.test} is not a valid test ID.")
5353
return errno.EEXIST

lib/pavilion/test_ids.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,12 @@ class ID(ABC):
1010

1111
def __init__(self, id_str: str):
1212
self.id_str = id_str
13+
self.range_type = None
1314

1415
@staticmethod
1516
@abstractmethod
1617
def is_valid_id(id_str: str) -> bool:
1718
"""Determine whether the given string constitutes a valid ID."""
18-
19-
raise NotImplementedError
20-
21-
@property
22-
@abstractmethod
23-
def range_type() -> type:
24-
"""Return the range ID type associated with the ID."""
2519

2620
raise NotImplementedError
2721

@@ -41,6 +35,10 @@ def __hash__(self) -> int:
4135
class TestID(ID):
4236
"""Represents a single test ID."""
4337

38+
def __init__(self):
39+
super().__init__()
40+
self.range_type = TestRange
41+
4442
@classmethod
4543
def is_valid_id(cls, id_str: str) -> bool:
4644
"""Determine whether the given string constitutes a valid test ID."""
@@ -92,14 +90,14 @@ def test_num(self) -> Optional[int]:
9290
elif len(self.parts) > 1:
9391
return int(self.parts[-1])
9492

95-
@property
96-
def range_type() -> type:
97-
return TestRange
98-
9993

10094
class SeriesID(ID):
10195
"""Represents a single series ID."""
10296

97+
def __init__(self):
98+
super().__init__()
99+
self.range_type = SeriesRange
100+
103101
@classmethod
104102
def is_valid_id(cls, id_str: str) -> bool:
105103
"""Determine whether the given string constitutes a valid series ID."""
@@ -144,14 +142,10 @@ def as_int(self) -> int:
144142

145143
return int(self.id_str[1:])
146144

147-
@property
148-
def range_type() -> type:
149-
return SeriesRange
150-
151145

152146
class GroupID:
153147
"""Represents a single group ID."""
154-
148+
155149
def __init__(self, id_str: str):
156150
self.id_str = id_str
157151

@@ -303,7 +297,7 @@ def resolve_ids(id_strs: List[str], id_type: ID, auto_last: bool = True) -> List
303297
return [id_type("last")]
304298

305299
return ids
306-
300+
307301
if "all" in id_strs:
308302
return [id_type("all")]
309303

@@ -339,7 +333,8 @@ def multi_convert(id_str: str) -> Union[List[TestID], List[SeriesID], List[Group
339333
return [GroupID(id_str)]
340334

341335

342-
def resolve_mixed_ids(ids: Iterable[str], auto_last: bool = True) -> List[Union[TestID, SeriesID, GroupID]]:
336+
def resolve_mixed_ids(ids: Iterable[str],
337+
auto_last: bool = True) -> List[Union[TestID, SeriesID, GroupID]]:
343338
"""Fully resolve all IDs in the given list into either test IDs, series IDs, or group IDs."""
344339

345340
ids = list(ids)

0 commit comments

Comments
 (0)