From 07a3305104da33a9666f09e8516769776b4b17f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 18 Feb 2022 11:18:20 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Do=20the=20merged=3DFa?= =?UTF-8?q?lse=20handling=20only=20after=20a=20miss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That's only interesting for dicts anyhow, so let the chainmap itself take care of fetching the top-most individual values and only spend more cycles on picking the right layer for unmerged access if we can't find the value. --- src/octoprint/settings.py | 46 +++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index d441fa67a..90f10042d 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -630,36 +630,30 @@ class HierarchicalChainMap: key = self._path_to_key(path) - # we do something a bit odd here: if merged is not true, we don't include the - # full contents of the key. Instead, we only include the contents of the key on - # the first level where we find the value. - # - # TODO 2.0.0 remove this weird & historic behaviour and make 'merged' the default - if not merged and not only_local: - # first check if we can find the exact key & if so use that layer + if key in current: + # found it, return + return current[key] + + # if we arrived here we might be trying to grab a dict, look for children + + key = key + _CHAINMAP_SEP + + # TODO 2.0.0 remove this & make 'merged' the default + if not merged and hasattr(current, "maps"): + # we do something a bit odd here: if merged is not true, we don't include the + # full contents of the key. Instead, we only include the contents of the key + # on the first level where we find the value. for layer in current.maps: - if key in layer: + if any(k.startswith(key) for k in layer): current = layer break - else: - # next, check if we can find the key as a prefix for a subtree & if so - # use that layer - for layer in current.maps: - if any(k.startswith(key) for k in layer): - current = layer - break - if key not in current: - # we might be trying to grab a dict, look for children - key = key + _CHAINMAP_SEP - result = self._unflatten( - {k: v for k, v in current.items() if k.startswith(key)}, prefix=key - ) - if not result: - raise KeyError("Could not find entry for " + str(path)) - return result - - return current[key] + result = self._unflatten( + {k: v for k, v in current.items() if k.startswith(key)}, prefix=key + ) + if not result: + raise KeyError("Could not find entry for " + str(path)) + return result def set_by_path(self, path, value): current = self._chainmap From 002b92d7b75ede56e162abe431627fe3ef3ecb8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 18 Feb 2022 11:20:41 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20Default=20to=201=20process?= =?UTF-8?q?=20for=20thumbnail=20generation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/cli/timelapse.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/octoprint/cli/timelapse.py b/src/octoprint/cli/timelapse.py index 50f6bee3c..a64756af9 100644 --- a/src/octoprint/cli/timelapse.py +++ b/src/octoprint/cli/timelapse.py @@ -51,6 +51,7 @@ def cli(ctx): "--processes", type=int, help="Number of processes to use for creating thumbnails", + default=1, ) @click.argument("paths", nargs=-1, type=click.Path()) @click.pass_context From 357afa0ae479d2f77137205b3e2c6337c1f8e7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 18 Feb 2022 11:21:11 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=92=84=20Recompiled=20all=20less=20fi?= =?UTF-8?q?les?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/announcements/static/css/announcements.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/plugins/announcements/static/css/announcements.css b/src/octoprint/plugins/announcements/static/css/announcements.css index 4df82b396..69dfccbd2 100644 --- a/src/octoprint/plugins/announcements/static/css/announcements.css +++ b/src/octoprint/plugins/announcements/static/css/announcements.css @@ -1 +1 @@ -table td.settings_plugin_announcements_channels_name,table th.settings_plugin_announcements_channels_name{text-overflow:ellipsis;text-align:left}table td.settings_plugin_announcements_channels_actions,table th.settings_plugin_announcements_channels_actions{text-align:center;width:80px}table td.settings_plugin_announcements_channels_actions a,table th.settings_plugin_announcements_channels_actions a{text-decoration:none;color:#000}table td.settings_plugin_announcements_channels_actions a.disabled,table th.settings_plugin_announcements_channels_actions a.disabled{color:#ccc;cursor:default}#plugin_announcements_dialog .unread{font-weight:700}#plugin_announcements_dialog article{padding-right:20px}#plugin_announcements_dialog article.read{opacity:.5}#plugin_announcements_dialog article.read:hover{opacity:1}#plugin_announcements_dialog article .actions{background-color:#f5f5f5;border-radius:2px;padding:2px 5px;margin-top:5px}#plugin_announcements_dialog article .actions .markread{float:right}#plugin_announcements_dialog article .actions a{color:#000}#plugin_announcements_dialog .modal-footer .configurelink{float:left} \ No newline at end of file +table th.settings_plugin_announcements_channels_name,table td.settings_plugin_announcements_channels_name{text-overflow:ellipsis;text-align:left}table th.settings_plugin_announcements_channels_actions,table td.settings_plugin_announcements_channels_actions{text-align:center;width:80px}table th.settings_plugin_announcements_channels_actions a,table td.settings_plugin_announcements_channels_actions a{text-decoration:none;color:#000}table th.settings_plugin_announcements_channels_actions a.disabled,table td.settings_plugin_announcements_channels_actions a.disabled{color:#ccc;cursor:default}#plugin_announcements_dialog .unread{font-weight:bold}#plugin_announcements_dialog article{padding-right:20px}#plugin_announcements_dialog article.read{opacity:.5}#plugin_announcements_dialog article.read:hover{opacity:1}#plugin_announcements_dialog article .actions{background-color:#f5f5f5;border-radius:2px;padding:2px 5px;margin-top:5px}#plugin_announcements_dialog article .actions .markread{float:right}#plugin_announcements_dialog article .actions a{color:black}#plugin_announcements_dialog .modal-footer .configurelink{float:left} \ No newline at end of file