scripts: elf_helper.py: Simplify tests with chained comparisons

'a < b and b < c' can be simplified to 'a < b < c' in Python.

Fixes this pylint warning:

    R1716: Simplify chained comparison between the operands
    (chained-comparison)

Fixing pylint warnings for a CI check.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit is contained in:
Ulf Magnusson 2019-09-03 14:59:04 +02:00 committed by Carles Cufí
commit 6fd7c69999

View file

@ -355,7 +355,7 @@ def addr_deref(elf, addr):
start = section['sh_addr']
end = start + section['sh_size']
if addr >= start and addr < end:
if start <= addr < end:
data = section.data()
offset = addr - start
return struct.unpack("<I" if elf.little_endian else ">I",
@ -513,9 +513,7 @@ class ElfHelper:
continue
_, user_ram_allowed = kobjects[ko.type_obj.name]
if (not user_ram_allowed and
(addr >= app_smem_start and addr < app_smem_end)):
if not user_ram_allowed and app_smem_start <= addr < app_smem_end:
self.debug_die(die,
"object '%s' found in invalid location %s"
% (name, hex(addr)))