From f2ad1654a44edcf6ed81be8ec1dc6282ef6f55a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 17 Jan 2023 16:55:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20Fix=20tests=20on=20Python=203.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dictionaries are not reversible until 3.8. --- src/octoprint/settings/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/octoprint/settings/__init__.py b/src/octoprint/settings/__init__.py index 8d7e2c983..f87740f46 100644 --- a/src/octoprint/settings/__init__.py +++ b/src/octoprint/settings/__init__.py @@ -563,11 +563,14 @@ class Settings: map(lambda x: bool(self._deprecated_paths[tuple(prefix + [x])]), path[-1]) ) - if tuple(path) not in self._deprecated_paths: + if ( + tuple(path) not in self._deprecated_paths + or not self._deprecated_paths[tuple(path)] + ): return False try: - return next(iter(reversed(self._deprecated_paths[tuple(path)].values()))) + return list(self._deprecated_paths[tuple(path)].values())[-1] except StopIteration: return False