* settings: reimplement storage chainmap
This implementation is mostly compatible with the previous one, but in
my opinion is much easier to read and much easier to reason about.
The areas of incompatiblity are, in my opinion, bugs that have been
fixed.
* 💚 Fix a failing test
Slight behaviour change means there's no emtpy
dict left in the top layer but the whole key
is gone.
* 🎨 Let pre-commit do its thing after merge
Co-authored-by: Gina Häußge <gina@octoprint.org>
* pyupgrade
* various new codemods
* manual removal of Py2/3 compat imports
* manual adjustment of docs, examples, tests
* to_str is now the new to_unicode, deprecated
redirection to to_bytes has been removed
* to_native_str has been redirected to point to
to_str
* to_unicode has been redirected to point to
to_str
* atomic_write refactored to use
NamedTemporaryDirectory
* various other fixes/refactorings all over the
place
where required. At some places it's not.
Also, "if foo in some_dict.keys()" is unnecessarily slow.
Replaced with "if foo in some_dict".
I left "for key in some_dict.keys()" alone;
"for key in some_dict" is equivalent but not always obvious.
Should no longer match lines like
FIRMWARE_NAME:Marlin 1.1.7-C2 (Github) SOURCE_CODE_URL:https://github.com/Robo3D/Marlin-C2 PROTOCOL_VERSION:C2 MACHINE_TYPE:RoboC2 EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff EMERGENCY_CODES:M108,M112,M410
but should pass unit tests.
Fixes#2945
These are never what we want, as they swallow KeyboardInterrupt.
TODO: many of these handlers really should be more specific and/or
log that they replaced an unparseable value with a default.
We now initialize the folders when initializing the settings, so the
test that the folder didn't yet exist before retrieving its path
naturally failed.