From 7e9dcfe50dd4bfa4f1a56812dd7b9c2ab221d252 Mon Sep 17 00:00:00 2001 From: Russell Bunch Date: Tue, 12 Nov 2024 10:48:21 -0600 Subject: [PATCH] B910 Use Counter() instead of defaultdict(int) to avoid excessive memory use https://github.com/PyCQA/flake8-bugbear/issues/323 --- canu/report/network/firmware/firmware.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/canu/report/network/firmware/firmware.py b/canu/report/network/firmware/firmware.py index 7dcf1d65c..bdf5c8f23 100644 --- a/canu/report/network/firmware/firmware.py +++ b/canu/report/network/firmware/firmware.py @@ -1,6 +1,6 @@ # MIT License # -# (C) Copyright 2022-2023 Hewlett Packard Enterprise Development LP +# (C) Copyright 2022-2024 Hewlett Packard Enterprise Development LP # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -21,6 +21,7 @@ # OTHER DEALINGS IN THE SOFTWARE. """CANU commands that report the firmware of the entire Shasta network.""" from collections import defaultdict +from collections import Counter import datetime import ipaddress import json @@ -353,8 +354,8 @@ def summary_table(data, out="-"): click.echo("\nSummary", file=out) click.echo(dash, file=out) - firmware_versions = defaultdict(int) - network_summary = defaultdict(int) + firmware_versions = Counter() + network_summary = Counter() for firmware in data: network_summary[firmware[1]] += 1