Skip to content

Commit

Permalink
Improve hd_monitor code quality
Browse files Browse the repository at this point in the history
Remove useless print, parameter and format strings according to review of ros#334
  • Loading branch information
limaanto committed May 28, 2024
1 parent 8eba67b commit a7e68ac
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def callback_config(self, params: List[rclpy.Parameter]):
def check_disk_usage(self, diag: DiagnosticStatus) -> DiagnosticStatus:
diag.level = DiagnosticStatus.OK

total, used, free = disk_usage(self._path)
total, _, free = disk_usage(self._path)
percent = free / total

if percent > self._free_percent_low:
Expand All @@ -102,14 +102,13 @@ def check_disk_usage(self, diag: DiagnosticStatus) -> DiagnosticStatus:

total_Go = total // (1024*1024)
diag.values.extend([
KeyValue(key=f'Name', value=self._path),
KeyValue(key=f'Status', value=DICT_STATUS[diag.level]),
KeyValue(key=f'Total (Go)', value=str(total_Go)),
KeyValue(key=f'Available (%)', value=str(round(percent, 2))),
KeyValue(key='Name', value=self._path),
KeyValue(key='Status', value=DICT_STATUS[diag.level]),
KeyValue(key='Total (Go)', value=str(total_Go)),
KeyValue(key='Available (%)', value=str(round(percent, 2))),
])

diag.message = DICT_USAGE[diag.level]
print(diag)
return diag


Expand Down

0 comments on commit a7e68ac

Please sign in to comment.