From 24722aa608bb923110878cd05f98aae78c785b5a Mon Sep 17 00:00:00 2001 From: Herbert Wolverson Date: Fri, 3 Mar 2023 14:25:36 +0000 Subject: [PATCH] Force types to be integers in Python Replace: min(data[node]['downloadBandwidthMbps'],parentMaxDL) With: min(int(data[node]['downloadBandwidthMbps']),int(parentMaxDL)) Python thought my current configuration contained a string for one of the numbers. It was a string representing an int. Force strong typing (a non-numeric will fail, but it would fail anyway). --- src/LibreQoS.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LibreQoS.py b/src/LibreQoS.py index 63ccdd4f..055beb4c 100755 --- a/src/LibreQoS.py +++ b/src/LibreQoS.py @@ -545,8 +545,8 @@ def refreshShapers(): if isinstance(node, str): if (isinstance(data[node], dict)) and (node != 'children'): # Cap based on this node's max bandwidth, or parent node's max bandwidth, whichever is lower - data[node]['downloadBandwidthMbps'] = min(data[node]['downloadBandwidthMbps'],parentMaxDL) - data[node]['uploadBandwidthMbps'] = min(data[node]['uploadBandwidthMbps'],parentMaxUL) + data[node]['downloadBandwidthMbps'] = min(int(data[node]['downloadBandwidthMbps']),int(parentMaxDL)) + data[node]['uploadBandwidthMbps'] = min(int(data[node]['uploadBandwidthMbps']),int(parentMaxUL)) # Recursive call this function for children nodes attached to this node if 'children' in data[node]: # We need to keep tabs on the minor counter, because we can't have repeating class IDs. Here, we bring back the minor counter from the recursive function