Skip to content

Commit d01bfa2

Browse files
authored
fix: get L0_unit_tests passing without syntax warnings (#968)
1 parent 9567bbf commit d01bfa2

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

model_analyzer/perf_analyzer/perf_analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def _split_output_per_rank(self):
516516
outputs = ["" for mrc in self._config.model_run_configs()]
517517
for line in self._output.splitlines():
518518
# Example would find the '2': [1,2]<stdout>: fake output ***
519-
rank = re.search("^\[\d+,(\d+)\]", line)
519+
rank = re.search(r"^\[\d+,(\d+)\]", line)
520520

521521
if rank:
522522
index = int(rank.group(1))

model_analyzer/record/types/gpu_power_usage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ def __init__(self, value, device_uuid=None, timestamp=0):
3131
"""
3232
Parameters
3333
----------
34-
value : float
34+
value : float-compatible value
3535
The value of the GPU metrtic
3636
device_uuid : str
3737
The GPU device uuid this metric is associated
3838
with.
3939
timestamp : int
4040
The timestamp for the record in nanoseconds
4141
"""
42-
42+
value = float(value)
4343
super().__init__(value, device_uuid, timestamp)
4444

4545
@staticmethod

tests/test_logger.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ def test_info_verbose(self):
8383
setup_logging(verbose=True, quiet=False)
8484
logger.info("ABC")
8585
output = out.getvalue().strip()
86-
self.assertTrue(re.match("^\d\d:\d\d:\d\d \[Model Analyzer\] ABC$", output))
86+
self.assertTrue(
87+
re.match(r"^\d\d:\d\d:\d\d \[Model Analyzer\] ABC$", output)
88+
)
8789

8890
def test_debug_normal(self):
8991
"""
@@ -119,7 +121,7 @@ def test_debug_verbose(self):
119121
logger.debug("ABC")
120122
output = out.getvalue().strip()
121123
self.assertTrue(
122-
re.match("^\d\d:\d\d:\d\d \[Model Analyzer\] DEBUG: ABC$", output)
124+
re.match(r"^\d\d:\d\d:\d\d \[Model Analyzer\] DEBUG: ABC$", output)
123125
)
124126

125127
def test_error_normal(self):
@@ -155,7 +157,7 @@ def test_error_verbose(self):
155157
logger.error("ABC")
156158
output = out.getvalue().strip()
157159
self.assertTrue(
158-
re.match("^\d\d:\d\d:\d\d \[Model Analyzer\] ERROR: ABC$", output)
160+
re.match(r"^\d\d:\d\d:\d\d \[Model Analyzer\] ERROR: ABC$", output)
159161
)
160162

161163
def test_quiet_trumps_verbose(self):

0 commit comments

Comments
 (0)