Skip to content

Commit b483d1e

Browse files
committed
formatting
1 parent f9cf54d commit b483d1e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Diff for: jtop/core/power.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def find_all_i2c_power_monitor(i2c_path):
105105
logger.info("Found I2C power monitor")
106106
return power_sensor
107107

108+
108109
def find_all_oc_event_counters():
109110
"""Find all the overcurrent event counters on the system"""
110111
event_cnt_files = glob.glob('/sys/class/hwmon/hwmon*/oc*_event_cnt')
@@ -118,6 +119,7 @@ def find_all_oc_event_counters():
118119

119120
return event_counts
120121

122+
121123
def update_oc_event_counts(event_counts):
122124
"""
123125
Function to update overcurrent event counts.
@@ -139,10 +141,11 @@ def update_oc_event_counts(event_counts):
139141
event_counts[filename] = count
140142
throttling = True
141143
except Exception as e:
142-
logger.error(f"Error reading OC event counter from {filename}: {e}".format(filename=filename, e=e))
144+
logger.error("Error reading OC event counter from {filename}: {e}".format(filename=filename, e=e))
143145
return throttling
144146
return throttling
145147

148+
146149
def read_power_status(data):
147150
values = {}
148151
power_type = data['type']

Diff for: jtop/gui/pcontrol.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def compact_power(stdscr, pos_y, pos_x, width, height, jetson):
118118
oc_event_cnt = jetson.power['oc_events']['count']
119119
is_throttling = jetson.power['oc_events']['is_throttling']
120120
# Plot OC_EVENT_CNT with color based on throttling status
121-
color = NColors.red() if is_throttling else (NColors.yellow() if oc_event_cnt > 0 else NColors.green())
121+
color = NColors.red() if is_throttling else (NColors.yellow() if oc_event_cnt > 0 else NColors.green())
122122
stdscr.addstr(pos_y + len_power + 3, center_x - column_power - 5, "OC EVENT COUNT: ", curses.A_BOLD)
123123
stdscr.addstr(pos_y + len_power + 3, center_x + 2, str(oc_event_cnt), curses.A_BOLD | color)
124124
return len(power) + 3
@@ -398,11 +398,9 @@ def control_power(self, pos_y, pos_x, key, mouse):
398398
oc_event_cnt = self.jetson.power['oc_events']['count']
399399
is_throttling = self.jetson.power['oc_events']['is_throttling']
400400
# Plot OC_EVENT_CNT with color based on throttling status
401-
color = NColors.red() if is_throttling else (NColors.yellow() if oc_event_cnt > 0 else NColors.green())
401+
color = NColors.red() if is_throttling else (NColors.yellow() if oc_event_cnt > 0 else NColors.green())
402402
self.stdscr.addstr(pos_y_table + len_power + 2, pos_x, "OC EVENT COUNT: ", curses.A_BOLD)
403-
self.stdscr.addstr(pos_y_table + len_power+ 2, pos_x + 16, str(oc_event_cnt), curses.A_BOLD | color)
404-
405-
403+
self.stdscr.addstr(pos_y_table + len_power + 2, pos_x + 16, str(oc_event_cnt), curses.A_BOLD | color)
406404

407405
def draw(self, key, mouse):
408406
# Screen size

0 commit comments

Comments
 (0)