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:
parent
72e71d6000
commit
6fd7c69999
1 changed files with 2 additions and 4 deletions
|
@ -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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue