klippy: Remove some obscure python2 dependencies
Don't modify dictionaries while iterating them and be careful to use // when doing an integer divide. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
1bc3e0a678
commit
8419e152bb
|
@ -40,7 +40,7 @@ class GCodeParser:
|
|||
handlers = [h for h in handlers
|
||||
if getattr(self, 'cmd_'+h+'_when_not_ready', False)]
|
||||
gcode_handlers = { h: getattr(self, 'cmd_'+h) for h in handlers }
|
||||
for h, f in gcode_handlers.items():
|
||||
for h, f in list(gcode_handlers.items()):
|
||||
aliases = getattr(self, 'cmd_'+h+'_aliases', [])
|
||||
gcode_handlers.update({ a: f for a in aliases })
|
||||
return gcode_handlers
|
||||
|
|
|
@ -252,7 +252,7 @@ class MessageParser:
|
|||
def _parse_buffer(self, value):
|
||||
tval = int(value, 16)
|
||||
out = []
|
||||
for i in range(len(value)/2):
|
||||
for i in range(len(value) // 2):
|
||||
out.append(tval & 0xff)
|
||||
tval >>= 8
|
||||
out.reverse()
|
||||
|
|
|
@ -36,7 +36,7 @@ class PrinterStepper:
|
|||
else:
|
||||
self.homing_endstop_accuracy = int(math.ceil(
|
||||
endstop_accuracy * self.inv_step_dist))
|
||||
if self.homing_endstop_accuracy >= self.homing_stepper_phases/2:
|
||||
if self.homing_endstop_accuracy >= self.homing_stepper_phases // 2:
|
||||
logging.info("Endstop for %s is not accurate enough for stepper"
|
||||
" phase adjustment" % (name,))
|
||||
self.homing_stepper_phases = None
|
||||
|
|
Loading…
Reference in New Issue