pre-commit fixes

This commit is contained in:
Dan Halbert 2023-08-14 00:47:22 -04:00
parent 2171e67c1b
commit d582407b06
141 changed files with 800 additions and 805 deletions

View File

@ -20,3 +20,7 @@ deques
extint
shs
pass-thru
numer
arithmetics
ftbfs
straightaway

View File

@ -228,4 +228,3 @@ CFLAGS_MOD += -DMICROPY_PY_BTREE=1
$(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter $(BTREE_DEFS)
$(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS)
endif

View File

@ -29,7 +29,7 @@
#include "py/misc.h" // For MP_STRINGIFY.
#include "py/mpconfig.h"
// Preprocessor directives indentifying the platform.
// Preprocessor directives identifying the platform.
// The (u)platform module itself is guarded by MICROPY_PY_UPLATFORM, see the
// .c file, but these are made available because they're generally usable.
// TODO: Add more architectures, compilers and libraries.

View File

@ -139,6 +139,10 @@ msgstr ""
msgid "%q index out of range"
msgstr ""
#: py/obj.c
msgid "%q indices must be integers, not %s"
msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "%q init failed"
msgstr ""
@ -214,7 +218,7 @@ msgstr ""
msgid "%q must be of type %q or %q, not %q"
msgstr ""
#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c
#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c
msgid "%q must be of type %q, not %q"
msgstr ""
@ -417,6 +421,10 @@ msgstr ""
msgid "'yield' outside function"
msgstr ""
#: py/compile.c
msgid "* arg after **"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr ""
@ -840,10 +848,6 @@ msgstr ""
msgid "Coordinate arrays types have different sizes"
msgstr ""
#: py/persistentcode.c
msgid "Corrupt .mpy file"
msgstr ""
#: ports/espressif/common-hal/neopixel_write/__init__.c
msgid "Could not retrieve clock"
msgstr ""
@ -1138,12 +1142,6 @@ msgstr ""
msgid "In-buffer elements must be <= 4 bytes long"
msgstr ""
#: py/persistentcode.c
msgid ""
"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/"
"mpy-update for more info."
msgstr ""
#: shared-bindings/_pew/PewPew.c
msgid "Incorrect buffer size"
msgstr ""
@ -1490,7 +1488,7 @@ msgstr ""
msgid "No in or out in program"
msgstr ""
#: shared-bindings/time/__init__.c
#: py/objint.c shared-bindings/time/__init__.c
msgid "No long integer support"
msgstr ""
@ -2498,6 +2496,10 @@ msgstr ""
msgid "array/bytes required on right side"
msgstr ""
#: py/asmxtensa.c
msgid "asm overflow"
msgstr ""
#: extmod/ulab/code/numpy/numerical.c
msgid "attempt to get (arg)min/(arg)max of empty sequence"
msgstr ""
@ -2587,6 +2589,10 @@ msgstr ""
msgid "buffer too small for requested bytes"
msgstr ""
#: py/emitbc.c
msgid "bytecode overflow"
msgstr ""
#: py/objarray.c
msgid "bytes length not a multiple of item size"
msgstr ""
@ -2632,7 +2638,7 @@ msgstr ""
msgid "can't cancel self"
msgstr ""
#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c
#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c
msgid "can't convert %q to %q"
msgstr ""
@ -2641,6 +2647,11 @@ msgstr ""
msgid "can't convert %s to complex"
msgstr ""
#: py/obj.c
#, c-format
msgid "can't convert %s to float"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr ""
@ -2650,11 +2661,11 @@ msgid "can't convert complex to float"
msgstr ""
#: py/obj.c
msgid "can't convert to %q"
msgid "can't convert to complex"
msgstr ""
#: py/obj.c
msgid "can't convert to complex"
msgid "can't convert to float"
msgstr ""
#: py/runtime.c
@ -2681,14 +2692,6 @@ msgstr ""
msgid "can't do truncated division of a complex number"
msgstr ""
#: py/compile.c
msgid "can't have multiple **x"
msgstr ""
#: py/compile.c
msgid "can't have multiple *x"
msgstr ""
#: py/emitnative.c
msgid "can't implicitly convert '%q' to 'bool'"
msgstr ""
@ -2743,6 +2746,10 @@ msgid ""
"can't switch from manual field specification to automatic field numbering"
msgstr ""
#: extmod/moduasyncio.c
msgid "can't wait"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "cannot assign new shape"
msgstr ""
@ -2839,10 +2846,6 @@ msgstr ""
msgid "compression header"
msgstr ""
#: py/parse.c
msgid "constant must be an integer"
msgstr ""
#: py/emitnative.c
msgid "conversion to object"
msgstr ""
@ -3179,7 +3182,11 @@ msgid "import * not at module level"
msgstr ""
#: py/persistentcode.c
msgid "incompatible native .mpy architecture"
msgid "incompatible .mpy arch"
msgstr ""
#: py/persistentcode.c
msgid "incompatible .mpy file"
msgstr ""
#: py/objstr.c
@ -3208,6 +3215,10 @@ msgstr ""
msgid "index out of range"
msgstr ""
#: py/obj.c
msgid "indices must be integers"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "indices must be integers, slices, or Boolean lists"
msgstr ""
@ -3341,10 +3352,6 @@ msgstr ""
msgid "invalid exception"
msgstr ""
#: extmod/modframebuf.c
msgid "invalid format"
msgstr ""
#: py/objstr.c
msgid "invalid format specifier"
msgstr ""
@ -3406,10 +3413,6 @@ msgstr ""
msgid "keyword argument(s) not yet implemented - use normal args instead"
msgstr ""
#: py/bc.c
msgid "keywords must be strings"
msgstr ""
#: py/emitinlinethumb.c py/emitinlinextensa.c
msgid "label '%q' not defined"
msgstr ""
@ -3634,14 +3637,6 @@ msgstr ""
msgid "non-hex digit found"
msgstr ""
#: py/compile.c
msgid "non-keyword arg after */**"
msgstr ""
#: py/compile.c
msgid "non-keyword arg after keyword arg"
msgstr ""
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "non-zero timeout must be > 0.01"
msgstr ""
@ -3654,6 +3649,10 @@ msgstr ""
msgid "not a 128-bit UUID"
msgstr ""
#: py/parse.c
msgid "not a constant"
msgstr ""
#: py/objstr.c
msgid "not all arguments converted during string formatting"
msgstr ""
@ -3892,6 +3891,14 @@ msgstr ""
msgid "port must be >= 0"
msgstr ""
#: py/compile.c
msgid "positional arg after **"
msgstr ""
#: py/compile.c
msgid "positional arg after keyword arg"
msgstr ""
#: py/objint_mpz.c
msgid "pow() 3rd argument cannot be 0"
msgstr ""
@ -3920,6 +3927,11 @@ msgstr ""
msgid "relative import"
msgstr ""
#: py/obj.c
#, c-format
msgid "requested length %d but object has length %d"
msgstr ""
#: extmod/ulab/code/ndarray_operators.c
msgid "results cannot be cast to specified type"
msgstr ""
@ -4114,6 +4126,10 @@ msgstr ""
msgid "tobytes can be invoked for dense arrays only"
msgstr ""
#: py/compile.c
msgid "too many args"
msgstr ""
#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c
msgid "too many dimensions"
msgstr ""
@ -4139,6 +4155,10 @@ msgstr ""
msgid "trapz is defined for 1D iterables"
msgstr ""
#: py/obj.c
msgid "tuple/list has wrong length"
msgstr ""
#: ports/espressif/common-hal/canio/CAN.c
#, c-format
msgid "twai_driver_install returned esp-idf error #%d"

0
ports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c Executable file → Normal file
View File

0
ports/espressif/boards/m5stack_core_fire/board.c Executable file → Normal file
View File

0
ports/espressif/boards/m5stack_stick_c/board.c Executable file → Normal file
View File

0
ports/espressif/boards/m5stack_stick_c_plus/board.c Executable file → Normal file
View File

View File

@ -25,15 +25,8 @@
* THE SOFTWARE.
*/
<<<<<<<< HEAD:ports/mimxrt10xx/boards/teensy40/board.c
#include "supervisor/board.h"
#include "shared-bindings/microcontroller/Pin.h"
========
#include <stdbool.h>
#include "py/mpconfig.h"
#include "fsl_edma.h"
#include "dma_manager.h"
>>>>>>>> v1.19.1:ports/raspberrypi/dma_manager.c
// These pins should never ever be reset; doing so could interfere with basic operation.
// Used in common-hal/microcontroller/Pin.c
@ -61,35 +54,4 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = {
NULL, // Must end in NULL.
};
<<<<<<<< HEAD:ports/mimxrt10xx/boards/teensy40/board.c
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
========
STATIC bool dma_initialized = false;
// allocate_channel(): retrieve an available channel. Return the number or -1
int allocate_dma_channel(void) {
for (int i = 0; i < ARRAY_SIZE(channel_list); i++) {
if (channel_list[i] == false) { // Channel available
channel_list[i] = true;
return i;
}
}
return -1;
}
// free_channel(n): Declare channel as free
void free_dma_channel(int n) {
if (n >= 0 && n <= ARRAY_SIZE(channel_list)) {
channel_list[n] = false;
}
}
void dma_init(void) {
if (!dma_initialized) {
edma_config_t dmaConfig;
EDMA_GetDefaultConfig(&dmaConfig);
EDMA_Init(DMA0, &dmaConfig);
dma_initialized = true;
}
}
>>>>>>>> v1.19.1:ports/raspberrypi/dma_manager.c

View File

@ -410,7 +410,7 @@ STATIC void pre_process_options(int argc, char **argv) {
#if MICROPY_PY_THREAD
mp_thread_is_realtime_enabled = true;
#endif
// main thread was already intialized before the option
// main thread was already initialized before the option
// was parsed, so we have to enable realtime here.
mp_thread_set_realtime();
#endif

View File

@ -165,11 +165,11 @@ void gc_init(void *start, void *end) {
assert(MP_STATE_MEM(gc_pool_start) >= MP_STATE_MEM(gc_finaliser_table_start) + gc_finaliser_table_byte_len);
#endif
// clear ATBs
// clear ATB's
memset(MP_STATE_MEM(gc_alloc_table_start), 0, MP_STATE_MEM(gc_alloc_table_byte_len));
#if MICROPY_ENABLE_FINALISER
// clear FTBs
// clear FTB's
memset(MP_STATE_MEM(gc_finaliser_table_start), 0, gc_finaliser_table_byte_len);
#endif

View File

@ -249,6 +249,7 @@ static_qstr_list = [
"zip",
]
# this must match the equivalent function in qstr.c
def compute_hash(qstr, bytes_hash):
hash = 5381
@ -349,11 +350,13 @@ def parse_input_headers_with_translations(infiles):
return qcfgs, qstrs, translations
# Used externally by mpy-tool.py. Don't pass back translations.
def parse_input_headers(infiles):
qcfgs, qstrs, translations = parse_input_headers_with_translations(infiles)
return (qcfgs, qstrs)
def escape_bytes(qstr, qbytes):
if all(32 <= ord(c) <= 126 and c != "\\" and c != '"' for c in qstr):
# qstr is all printable ASCII so render it as-is (for easier debugging)
@ -404,11 +407,11 @@ def print_qstr_data(qcfgs, qstrs, translations):
print("// {} bytes worth of qstr".format(total_qstr_size))
def do_work(infiles):
qcfgs, qstrs, translations = parse_input_headers_with_translations(infiles)
print_qstr_data(qcfgs, qstrs, translations)
if __name__ == "__main__":
import argparse

View File

@ -121,6 +121,7 @@ def write_out(fname, output):
with open(args.output_dir + "/" + fname + "." + args.mode, "w") as f:
f.write("\n".join(output) + "\n")
def qstr_unescape(qstr):
for name in name2codepoint:
if "__" + name + "__" in qstr:

View File

@ -551,7 +551,7 @@ STATIC mp_parse_node_t make_node_const_object(parser_t *parser, size_t src_line,
return (mp_parse_node_t)pn;
}
// Create a parse node represeting a constant object, possibly optimising the case of
// Create a parse node representing a constant object, possibly optimising the case of
// an integer, by putting the (small) integer value directly in the parse node itself.
STATIC mp_parse_node_t make_node_const_object_optimised(parser_t *parser, size_t src_line, mp_obj_t obj) {
if (mp_obj_is_small_int(obj)) {

View File

@ -35,7 +35,7 @@ function ci_code_formatting_run {
function ci_commit_formatting_run {
git remote add upstream https://github.com/micropython/micropython.git
git fetch --depth=100 upstream master
# For a PR, upstream/master..HEAD ends with a merge commit into master, exlude that one.
# For a PR, upstream/master..HEAD ends with a merge commit into master, exclude that one.
tools/verifygitlog.py -v upstream/master..HEAD --no-merges
}

View File

@ -197,7 +197,8 @@ def main():
cmd_parser.add_argument("-c", action="store_true", help="Format C code only")
cmd_parser.add_argument("-p", action="store_true", help="Format Python code only")
cmd_parser.add_argument("-v", action="store_true", help="Enable verbose output")
cmd_parser.add_argument("files", nargs="*", help="Run on specific globs")
cmd_parser.add_argument("--dry-run", action="store_true", help="Print, don't act")
cmd_parser.add_argument("files", nargs="+", help="Run on specific globs")
args = cmd_parser.parse_args()
if args.dry_run:
@ -216,6 +217,11 @@ def main():
if os.path.splitext(file)[1].lower() in exts:
yield file
def bindings_files():
for file in lang_files(C_EXTS):
if file.startswith("shared-bindings/") or "/bindings/" in file:
yield file
# Run tool on N files at a time (to avoid making the command line too long).
def batch(cmd, files, N=200, check=False):
while True: