diff options
| author | Christian Clauss <cclauss@me.com> | 2023-03-10 05:59:28 +0100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-05-02 16:14:45 +1000 |
| commit | 79e57473b20707ca948920fbce473d64dbd8ce25 (patch) | |
| tree | 01425c0ea0c9ec929b0dd9d2fb7d87680be18a60 | |
| parent | 8f8bd981641e0988b9ed3276c8f2435645269b3f (diff) | |
all: Fix various Python coding inconsistencies found by ruff.
This fixes:
- type-comparison (E721): do not compare types, use isinstance().
- string-dot-format-missing-arguments (F524): .format call is missing
argument(s) for placeholder(s): {message}.
- f-string-missing-placeholders (F541).
- is-literal (F632): Use != to compare constant literals.
The last one is fixed by just comparing for truthfulness of `state`.
| -rw-r--r-- | extmod/uasyncio/funcs.py | 2 | ||||
| -rw-r--r-- | ports/cc3200/boards/make-pins.py | 2 | ||||
| -rw-r--r-- | ports/stm32/boards/NUCLEO_WB55/rfcore_firmware.py | 2 | ||||
| -rwxr-xr-x | shared/memzip/make-memzip.py | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/extmod/uasyncio/funcs.py b/extmod/uasyncio/funcs.py index 23a585aa9..dc52ad395 100644 --- a/extmod/uasyncio/funcs.py +++ b/extmod/uasyncio/funcs.py @@ -123,7 +123,7 @@ def gather(*aws, return_exceptions=False): # Either this gather was cancelled, or one of the sub-tasks raised an exception with # return_exceptions==False, so reraise the exception here. - if state is not 0: + if state: raise state # Return the list of return values of each sub-task. diff --git a/ports/cc3200/boards/make-pins.py b/ports/cc3200/boards/make-pins.py index 0cf0d5656..6608be438 100644 --- a/ports/cc3200/boards/make-pins.py +++ b/ports/cc3200/boards/make-pins.py @@ -124,7 +124,7 @@ class Pins: continue if not row[pin_col].isdigit(): raise ValueError( - "Invalid pin number {:s} in row {:s}".format(row[pin_col]), row + "Invalid pin number {:s} in row {:s}".format(row[pin_col], row) ) # Pin numbers must start from 0 when used with the TI API pin_num = int(row[pin_col]) - 1 diff --git a/ports/stm32/boards/NUCLEO_WB55/rfcore_firmware.py b/ports/stm32/boards/NUCLEO_WB55/rfcore_firmware.py index 7cc81b4c6..fe34ce122 100644 --- a/ports/stm32/boards/NUCLEO_WB55/rfcore_firmware.py +++ b/ports/stm32/boards/NUCLEO_WB55/rfcore_firmware.py @@ -704,7 +704,7 @@ def check_for_updates(force=False): if fus_uptodate and ws_uptodate and not force: log(f"Already up to date: fus: {current_version_fus}, ws: {current_version_ws}") else: - log(f"Starting firmware update") + log("Starting firmware update") log(f" - fus: {current_version_fus} -> {vers_fus}") log(f" - ws: {current_version_ws} -> {vers_ws}") _write_state(_STATE_WAITING_FOR_FUS) diff --git a/shared/memzip/make-memzip.py b/shared/memzip/make-memzip.py index 9730f5e00..cc0df8207 100755 --- a/shared/memzip/make-memzip.py +++ b/shared/memzip/make-memzip.py @@ -36,7 +36,7 @@ def create_c_from_file(c_filename, zip_filename): break print(' ', end='', file=c_file) for byte in buf: - if type(byte) is types.StringType: + if isinstance(byte, types.StringType): print(' 0x{:02x},'.format(ord(byte)), end='', file=c_file) else: print(' 0x{:02x},'.format(byte), end='', file=c_file) |
