Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated logger.warn with logger.warning #6385

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions klippy/configfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,16 @@ def _find_autosave_data(self, data):
autosave_data = data[pos + len(AUTOSAVE_HEADER):].strip()
# Check for errors and strip line prefixes
if "\n#*# " in regular_data:
logging.warn("Can't read autosave from config file"
" - autosave state corrupted")
logging.warning("Can't read autosave from config file"
" - autosave state corrupted")
return data, ""
out = [""]
for line in autosave_data.split('\n'):
if ((not line.startswith("#*#")
or (len(line) >= 4 and not line.startswith("#*# ")))
and autosave_data):
logging.warn("Can't read autosave from config file"
" - modifications after header")
logging.warning("Can't read autosave from config file"
" - modifications after header")
return data, ""
out.append(line[4:])
out.append("")
Expand Down
4 changes: 2 additions & 2 deletions klippy/extras/adc_temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def __init__(self, config, params):
for temp, volt in params:
adc = (volt - voltage_offset) / adc_voltage
if adc < 0. or adc > 1.:
logging.warn("Ignoring adc sample %.3f/%.3f in heater %s",
temp, volt, config.get_name())
logging.warning("Ignoring adc sample %.3f/%.3f in heater %s",
temp, volt, config.get_name())
continue
samples.append((adc, temp))
try:
Expand Down
14 changes: 8 additions & 6 deletions klippy/extras/htu21d.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _init_htu21d(self):
rdevId |= response[1]
checksum = response[2]
if self._chekCRC8(rdevId) != checksum:
logging.warn("htu21d: Reading deviceId !Checksum error!")
logging.warning("htu21d: Reading deviceId !Checksum error!")
rdevId = rdevId >> 8
deviceId_list = list(
filter(
Expand All @@ -135,10 +135,10 @@ def _init_htu21d(self):
if len(deviceId_list) != 0:
logging.info("htu21d: Found Device Type %s" % deviceId_list[0])
else:
logging.warn("htu21d: Unknown Device ID %#x " % rdevId)
logging.warning("htu21d: Unknown Device ID %#x " % rdevId)

if(self.deviceId != deviceId_list[0]):
logging.warn(
if self.deviceId != deviceId_list[0]:
logging.warning(
"htu21d: Found device %s. Forcing to type %s as config.",
deviceId_list[0],self.deviceId)

Expand Down Expand Up @@ -169,7 +169,9 @@ def _sample_htu21d(self, eventtime):
rtemp = response[0] << 8
rtemp |= response[1]
if self._chekCRC8(rtemp) != response[2]:
logging.warn("htu21d: Checksum error on Temperature reading!")
logging.warning(
"htu21d: Checksum error on Temperature reading!"
)
else:
self.temp = (0.002681 * float(rtemp) - 46.85)
logging.debug("htu21d: Temperature %.2f " % self.temp)
Expand All @@ -190,7 +192,7 @@ def _sample_htu21d(self, eventtime):
rhumid = response[0] << 8
rhumid|= response[1]
if self._chekCRC8(rhumid) != response[2]:
logging.warn("htu21d: Checksum error on Humidity reading!")
logging.warning("htu21d: Checksum error on Humidity reading!")
else:
#clear status bits,
# humidity always returns xxxxxx10 in the LSB field
Expand Down
2 changes: 1 addition & 1 deletion klippy/extras/spi_temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _handle_spi_response(self, params):
last_read_time = self.mcu.clock_to_print_time(last_read_clock)
self._callback(last_read_time, temp)
def report_fault(self, msg):
logging.warn(msg)
logging.warning(msg)


######################################################################
Expand Down
3 changes: 2 additions & 1 deletion klippy/extras/thermistor.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def setup_coefficients(self, t1, r1, t2, r2, t3, r3, name=""):
/ (ln3_r12 - ln3_r13 * ln_r12 / ln_r13))
if self.c3 <= 0.:
beta = ln_r13 / inv_t13
logging.warn("Using thermistor beta %.3f in heater %s", beta, name)
logging.warning("Using thermistor beta %.3f in heater %s",
beta, name)
self.setup_coefficients_beta(t1, r1, beta)
return
self.c2 = (inv_t12 - self.c3 * ln3_r12) / ln_r12
Expand Down
4 changes: 2 additions & 2 deletions klippy/serialhdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ def connect_canbus(self, canbus_uuid, canbus_nodeid, canbus_iface="can0"):
bustype='socketcan')
bus.send(set_id_msg)
except (can.CanError, os.error) as e:
logging.warn("%sUnable to open CAN port: %s",
self.warn_prefix, e)
logging.warning("%sUnable to open CAN port: %s",
self.warn_prefix, e)
self.reactor.pause(self.reactor.monotonic() + 5.)
continue
bus.close = bus.shutdown # XXX
Expand Down