Fixes this issue:
$ python3 ./stm32_mem.py blackmagic.bin
File "./stm32_mem.py", line 199
if (os.path.getsize(args.progfile) > 0x1f800):
^
TabError: inconsistent use of tabs and spaces in indentation
and allows to run with python2 too.
Added braces for compatibility with python3, should still be valid python2 which interpretes these braces as a tuple with a single element and simplifies it to that element.
Replaced whitespaces with tabs as required by python3, since indentation must be uniform (either whitespaces or tabs).
Removed trailing whitespaces.
Tested by flashing various STM32 boards with blackmagic firmware using python3.7.
While scanning the USB bus for devices, stm32_scan() can find a device that it
doesn't have permissions to access it, dfu/usb class raises an exception and
stm32_scan() stops the scan completely.
This fix resolves the scan issue, by allowing the scan loop to continue.
While at it, there are cosmetic fixes related with tabs/spaces and readability.
Signed-off-by: Nikolay Dimitrov <nikolay.dimitrov@retrohub.org>