From 36de0079096691f7251cccf07b1145925822b0ca Mon Sep 17 00:00:00 2001
From: s-hadinger <49731213+s-hadinger@users.noreply.github.com>
Date: Fri, 23 Jun 2023 18:33:31 +0200
Subject: [PATCH] Berry replace `string.format`with `format` (#18945)
* Berry replace `string.format`with `format`
* remove import.string
---
.../berry_matter/tools/vendor_to_c.be | 2 +-
lib/libesp32/berry_tasmota/solidify_all.be | 2 +-
.../src/embedded/autoconf_module.be | 43 +-
.../berry_tasmota/src/embedded/hue_bridge.be | 1 -
.../berry_tasmota/src/embedded/i2c_axp192.be | 6 +-
.../berry_tasmota/src/embedded/i2c_axp202.be | 6 +-
.../src/embedded/lv_tasmota_widgets.be | 3 +-
.../berry_tasmota/src/embedded/mqtt.be | 3 +-
.../src/embedded/partition_core.be | 29 +-
.../berry_tasmota/src/embedded/tapp.be | 2 +-
.../src/embedded/tasmota_class.be | 21 +-
.../src/embedded/trigger_class.be | 3 +-
.../berry_tasmota/src/embedded/uuid.be | 3 +-
.../berry_tasmota/src/embedded/zigbee.be | 3 +-
.../src/embedded/zigbee_zb_coord.be | 5 +-
.../src/embedded/zigbee_zcl_attribute.be | 32 +-
.../src/embedded/zigbee_zcl_frame.be | 3 +-
.../src/solidify/solidified_autoconf_module.h | 1053 ++++++++---------
.../src/solidify/solidified_hue_bridge.h | 102 +-
.../src/solidify/solidified_i2c_axp192.h | 134 +--
.../src/solidify/solidified_i2c_axp202.h | 2 +-
.../solidify/solidified_lv_tasmota_widgets.h | 77 +-
.../src/solidify/solidified_mqtt.h | 29 +-
.../src/solidify/solidified_partition_core.h | 541 ++++-----
.../src/solidify/solidified_tapp.h | 31 +-
.../src/solidify/solidified_tasmota_class.h | 478 ++++----
.../src/solidify/solidified_trigger_class.h | 53 +-
.../src/solidify/solidified_uuid.h | 71 +-
.../src/solidify/solidified_zigbee.h | 65 +-
.../src/solidify/solidified_zigbee_zb_coord.h | 157 ++-
.../solidified_zigbee_zcl_attribute.h | 632 +++++-----
.../solidify/solidified_zigbee_zcl_frame.h | 45 +-
.../lv_binding_berry/solidify_all.be | 2 +-
tasmota/berry/artnet/artnet.be | 3 +-
tasmota/berry/artnet/artnet_ui.be | 46 +-
tasmota/berry/drivers/CHSC6540.be | 3 +-
tasmota/berry/drivers/MPU6886_9250.be | 6 +-
tasmota/berry/drivers/Shift595.be | 1 -
tasmota/berry/drivers/tm1637.be | 2 +-
tasmota/berry/examples/web_button_demo.be | 3 +-
.../haspmota_src/haspmota_core/haspmota.be | 35 +-
tasmota/berry/lvgl_examples/widget_test.be | 31 +-
tasmota/berry/modules/bootloader.be | 3 +-
tasmota/berry/modules/partition.be | 70 +-
tasmota/berry/modules/partition_wizard.be | 71 +-
.../modules/ts_calibrate/ts_calibrate.be | 10 +-
tasmota/berry/zigbee/cc2652_flasher.be | 15 +-
tasmota/berry/zigbee/intelhex.be | 3 +-
tasmota/berry/zigbee/sonoff_zb_pro_flasher.be | 10 +-
tasmota/berry/zigbee/tubezb_cc2652_flasher.be | 10 +-
.../xdrv_52_3_berry_crypto.ino | 3 +-
51 files changed, 1888 insertions(+), 2076 deletions(-)
diff --git a/lib/libesp32/berry_matter/tools/vendor_to_c.be b/lib/libesp32/berry_matter/tools/vendor_to_c.be
index bff47fb42..924f7e9f9 100644
--- a/lib/libesp32/berry_matter/tools/vendor_to_c.be
+++ b/lib/libesp32/berry_matter/tools/vendor_to_c.be
@@ -8,7 +8,7 @@ f.close()
for elt: j["vendorInfo"]
- print(string.format(' { 0x%04X, "%s"},', elt['vendorID'], elt['vendorName']))
+ print(format(' { 0x%04X, "%s"},', elt['vendorID'], elt['vendorName']))
end
diff --git a/lib/libesp32/berry_tasmota/solidify_all.be b/lib/libesp32/berry_tasmota/solidify_all.be
index 8f2575595..bf2ebfc6a 100755
--- a/lib/libesp32/berry_tasmota/solidify_all.be
+++ b/lib/libesp32/berry_tasmota/solidify_all.be
@@ -46,7 +46,7 @@ def parse_file(fname, prefix_out)
# output solidified
var fname_h = string.split(fname, '.be')[0] + '.h' # take whatever is before the first '.be'
var fout = open(prefix_out + "solidified_" + fname_h, "w")
- fout.write(string.format("/* Solidification of %s */\n", fname_h))
+ fout.write(format("/* Solidification of %s */\n", fname_h))
fout.write("/********************************************************************\\\n")
fout.write("* Generated code, don't edit *\n")
fout.write("\\********************************************************************/\n")
diff --git a/lib/libesp32/berry_tasmota/src/embedded/autoconf_module.be b/lib/libesp32/berry_tasmota/src/embedded/autoconf_module.be
index 42d573306..9620d358a 100644
--- a/lib/libesp32/berry_tasmota/src/embedded/autoconf_module.be
+++ b/lib/libesp32/berry_tasmota/src/embedded/autoconf_module.be
@@ -23,7 +23,7 @@ autoconf_module.init = def (m)
if string.find(dir[i], ".autoconf") > 0 # does the file contain '*.autoconf', >0 to skip `.autoconf`
if entry != nil
# we have multiple configuration files, not allowed
- tasmota.log(string.format("CFG: multiple autoconf files found, aborting ('%s' + '%s')", entry, dir[i]), 2)
+ tasmota.log(format("CFG: multiple autoconf files found, aborting ('%s' + '%s')", entry, dir[i]), 2)
self._error = true
return nil
end
@@ -88,24 +88,23 @@ autoconf_module.init = def (m)
# Load templates from Github
#####################################################################################################
def load_templates()
- import string
import json
try
- var url = string.format("https://raw.githubusercontent.com/tasmota/autoconf/main/%s_manifest.json", tasmota.arch())
- tasmota.log(string.format("CFG: loading '%s'", url), 3)
+ var url = format("https://raw.githubusercontent.com/tasmota/autoconf/main/%s_manifest.json", tasmota.arch())
+ tasmota.log(format("CFG: loading '%s'", url), 3)
# load the template
var cl = webclient()
cl.begin(url)
var r = cl.GET()
if r != 200
- tasmota.log(string.format("CFG: return_code=%i", r), 2)
+ tasmota.log(format("CFG: return_code=%i", r), 2)
return nil
end
var s = cl.get_string()
cl.close()
# convert to json
var j = json.load(s)
- tasmota.log(string.format("CFG: loaded '%s'", str(j)), 3)
+ tasmota.log(format("CFG: loaded '%s'", str(j)), 3)
var t = j.find("files")
if isinstance(t, list)
@@ -114,7 +113,7 @@ autoconf_module.init = def (m)
return nil
except .. as e, m
- tasmota.log(string.format("CFG: exception '%s' - '%s'", e, m), 2)
+ tasmota.log(format("CFG: exception '%s' - '%s'", e, m), 2)
return nil
end
end
@@ -143,8 +142,8 @@ autoconf_module.init = def (m)
var cur_module_display = cur_module ? string.tr(self.get_current_module_name(), "_", " ") : self._error ? "<Error: apply new or remove>" : "<None>"
webserver.content_send("
")
webserver.content_send("