Initial Python2 to Python3 Conversion
Initial Python2 to Python3 Conversion using automated 2to3 tool.
This commit is contained in:
parent
2f3f231cc7
commit
d50bca8c9e
|
@ -7,3 +7,5 @@ dist
|
|||
*.egg*
|
||||
.DS_Store
|
||||
*.zip
|
||||
|
||||
*.bak
|
|
@ -5,7 +5,7 @@
|
|||
#
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import octoprint.plugin
|
||||
|
@ -23,7 +23,7 @@ class KlipperPlugin(
|
|||
octoprint.plugin.AssetPlugin,
|
||||
octoprint.plugin.SimpleApiPlugin,
|
||||
octoprint.plugin.EventHandlerPlugin):
|
||||
|
||||
|
||||
_parsing_response = False
|
||||
_message = ""
|
||||
|
||||
|
@ -93,7 +93,7 @@ class KlipperPlugin(
|
|||
self._settings.get(["configuration", "path"])
|
||||
)
|
||||
# Check for Unicode config file and convert to String, if so.
|
||||
if type(data["config"]) == unicode:
|
||||
if type(data["config"]) == str:
|
||||
data["config"] = data["config"].encode('utf-8')
|
||||
|
||||
f = open(filepath, "w")
|
||||
|
@ -339,10 +339,12 @@ class KlipperPlugin(
|
|||
def logError(self, error):
|
||||
self.sendMessage("log", "error", error)
|
||||
|
||||
__plugin_name__ = "OctoKlipper"
|
||||
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||
|
||||
def __plugin_load__():
|
||||
global __plugin_implementation__
|
||||
global __plugin_hooks__
|
||||
|
||||
__plugin_implementation__ = KlipperPlugin()
|
||||
__plugin_hooks__ = {
|
||||
"octoprint.comm.protocol.gcode.received": __plugin_implementation__.on_parse_gcode,
|
||||
|
|
|
@ -83,7 +83,7 @@ class KlipperLogAnalyzer():
|
|||
if last_runoff_start:
|
||||
runoff_samples[last_runoff_start][0] = True
|
||||
last_print_stall = print_stall
|
||||
sample_resets = {sampletime: 1 for stall, samples in runoff_samples.values()
|
||||
sample_resets = {sampletime: 1 for stall, samples in list(runoff_samples.values())
|
||||
for sampletime in samples if not stall}
|
||||
return sample_resets
|
||||
|
||||
|
@ -143,7 +143,7 @@ class KlipperLogAnalyzer():
|
|||
basetime = lasttime = data[0]['#sampletime']
|
||||
for d in data:
|
||||
st = d['#sampletime']
|
||||
for key, (times, values) in graph_keys.items():
|
||||
for key, (times, values) in list(graph_keys.items()):
|
||||
val = d.get(key)
|
||||
if val not in (None, '0', '1'):
|
||||
times.append(st)
|
||||
|
|
Loading…
Reference in New Issue