# HG changeset patch # User Joseph Pizzi # Date Sat Aug 21 14:08:57 2021 -0500 # Node ID eb73b516ea6431dcf82edb09743aeb0f869002db # Parent 68534f20c1418ae8e4cc09f3ff468d0375ba843a [Py3] Not perform unnecessry conversions of range to list This patch will keep bitwise from unnecessarily converting ranges to lists when it is not needed. related to #9297 diff --git a/chirp/bitwise.py b/chirp/bitwise.py --- a/chirp/bitwise.py +++ b/chirp/bitwise.py @@ -174,7 +174,7 @@ def int_to_bcd(bcd_array, value): """Convert an int like 1234 into bcdDataElements like "\x12\x34" """ - for i in reversed(list(range(0, len(bcd_array)))): + for i in reversed(range(0, len(bcd_array))): bcd_array[i].set_value(value % 100) value /= 100 @@ -732,7 +732,7 @@ self._generators = {} self._keys = [] self._count = 1 - if "name" in list(kwargs.keys()): + if "name" in kwargs.keys(): self._name = kwargs["name"] del kwargs["name"] else: @@ -742,7 +742,7 @@ def _value(self, data, generators): result = {} - for name, gen in list(generators.items()): + for name, gen in generators.items(): result[name] = gen.get_value(data) return result @@ -780,7 +780,7 @@ def size(self): size = 0 - for name, gen in list(self._generators.items()): + for name, gen in self._generators.items(): if not isinstance(gen, list): gen = [gen] @@ -806,7 +806,7 @@ self._data[self._offset] = buffer def __iter__(self): - for item in list(self._generators.values()): + for item in self._generators.values(): yield item def items(self):