Skip to content
Commit c531e4c2 authored by Torsten Rasmussen's avatar Torsten Rasmussen Committed by Carles Cufí
Browse files

scripts: test for imported ELFFile instead of setting it to None



mypy fails with:
Incompatible types in assignment
        (expression has type "None", variable has type "Type[ELFFile]")

this happens because of the code:
    try:
        from elftools.elf.elffile import ELFFile
    except ImportError:
        ELFFile = None

ELFFile is set to None to allow later code to check if ELFFile was
imported by checking against None. Instead of setting ELFFile to None,
then update testing code to check if the class has been loaded, as:
    if globals().get('ELFFile') is None:

Update the try-catch to `pass`.

Removed ELFFile cargo cult from intel_cyclonev.py and fix pylint
warnings.

Disable duplicate code check. The intel_cyclonev.py is already based
upon openocd.py, so although the duplication detection is correct then
this should not prevent other code changes / fixes to those files from
being applied.

Signed-off-by: default avatarTorsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
parent c82b38c7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment