From 56e928e5a53fdafb4562352538a3247dea94f947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Korneliusz=20Jarz=C4=99bski?= Date: Thu, 18 May 2023 02:07:45 +0200 Subject: [PATCH] fix lint formatting --- frigate/stats.py | 2 ++ frigate/util.py | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/frigate/stats.py b/frigate/stats.py index 832506ea9..55db809d3 100644 --- a/frigate/stats.py +++ b/frigate/stats.py @@ -118,6 +118,7 @@ async def set_cpu_stats(all_stats: dict[str, Any]) -> None: if cpu_stats: all_stats["cpu_usages"] = cpu_stats + async def set_bandwidth_stats(all_stats: dict[str, Any]) -> None: """Set bandwidth from nethogs.""" bandwidth_stats = get_bandwidth_stats() @@ -125,6 +126,7 @@ async def set_bandwidth_stats(all_stats: dict[str, Any]) -> None: if bandwidth_stats: all_stats["bandwidth_usages"] = bandwidth_stats + async def set_gpu_stats( config: FrigateConfig, all_stats: dict[str, Any], hwaccel_errors: list[str] ) -> None: diff --git a/frigate/util.py b/frigate/util.py index f0605335d..956643bf7 100755 --- a/frigate/util.py +++ b/frigate/util.py @@ -843,6 +843,7 @@ def get_cpu_stats() -> dict[str, dict]: return usages + def get_bandwidth_stats() -> dict[str, dict]: """Get bandwidth usages for each ffmpeg process id""" usages = {} @@ -860,15 +861,17 @@ def get_bandwidth_stats() -> dict[str, dict]: lines = p.stdout.split("\n") for line in lines: stats = list(filter(lambda a: a != "", line.strip().split("\t"))) - try: - if re.search('^ffmpeg/([0-9]+)/', stats[0]): + try: + if re.search("^ffmpeg/([0-9]+)/", stats[0]): process = stats[0].split("/") usages[process[1]] = { "bandwidth": round(float(stats[2]), 1), } except: continue - return usages + + return usages + def get_amd_gpu_stats() -> dict[str, str]: """Get stats using radeontop."""