From b60b20d78470f805fbdbb6908ac35159b5c32136 Mon Sep 17 00:00:00 2001 From: Matthias Urlichs Date: Mon, 28 Jan 2019 21:06:35 +0100 Subject: [PATCH] Clean up example code --- docs/plugins/hooks.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index a6c85e40d..b834b2fcf 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -28,6 +28,7 @@ or as ``postfix`` (after the existing lines). .. code-block:: python :linenos: + from past import basestring self._gcode_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.scripts") # ... @@ -44,10 +45,8 @@ or as ``postfix`` (after the existing lines). continue def to_list(data): - if isinstance(data, str): - data = map(str.strip, data.split("\n")) - elif isinstance(data, unicode): - data = map(unicode.strip, data.split("\n")) + if isinstance(data, basestring): + data = map(x.strip() for x in data.split("\n")) if isinstance(data, (list, tuple)): return list(data)