From fd1016695f834294886496a889c92982cf7b1395 Mon Sep 17 00:00:00 2001 From: Florian Heilmann Date: Sat, 22 Oct 2016 12:39:16 +0200 Subject: [PATCH 1/2] Adjust output of values() classmethod The way it was before, the function would also return itself. This isn't really a problem here, but if someone takes this function as a guide (like me) they can run into problems when iterating over the returned array, as it contains an element representing "values()" itself. Another approach would be make use of the inspect package and replace name="values" with inspect.ismethod(name) --- src/octoprint/printer/profile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/printer/profile.py b/src/octoprint/printer/profile.py index c64f6f23..24483ac3 100644 --- a/src/octoprint/printer/profile.py +++ b/src/octoprint/printer/profile.py @@ -34,7 +34,7 @@ class BedTypes(object): @classmethod def values(cls): - return [getattr(cls, name) for name in cls.__dict__ if not name.startswith("__")] + return [getattr(cls, name) for name in cls.__dict__ if not (name.startswith("__") or name="values")] class BedOrigin(object): LOWERLEFT = "lowerleft" @@ -42,7 +42,7 @@ class BedOrigin(object): @classmethod def values(cls): - return [getattr(cls, name) for name in cls.__dict__ if not name.startswith("__")] + return [getattr(cls, name) for name in cls.__dict__ if not (name.startswith("__") or name="values")] class PrinterProfileManager(object): """ From 5ac934bcc48fcb562c5bd813bcaa3347794ab1ce Mon Sep 17 00:00:00 2001 From: Florian Heilmann Date: Sat, 22 Oct 2016 12:53:32 +0200 Subject: [PATCH 2/2] Fix Typos Note to self: double and triple check more! turn "=" into "==" --- src/octoprint/printer/profile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/printer/profile.py b/src/octoprint/printer/profile.py index 24483ac3..e2c16a76 100644 --- a/src/octoprint/printer/profile.py +++ b/src/octoprint/printer/profile.py @@ -34,7 +34,7 @@ class BedTypes(object): @classmethod def values(cls): - return [getattr(cls, name) for name in cls.__dict__ if not (name.startswith("__") or name="values")] + return [getattr(cls, name) for name in cls.__dict__ if not (name.startswith("__") or name == "values")] class BedOrigin(object): LOWERLEFT = "lowerleft" @@ -42,7 +42,7 @@ class BedOrigin(object): @classmethod def values(cls): - return [getattr(cls, name) for name in cls.__dict__ if not (name.startswith("__") or name="values")] + return [getattr(cls, name) for name in cls.__dict__ if not (name.startswith("__") or name == "values")] class PrinterProfileManager(object): """