Merge commit '64de883b3f40322c5048745af0a5eef5be570616' into feat/obico-for-v6

This commit is contained in:
dw-0
2024-06-21 15:52:08 +02:00
4 changed files with 13 additions and 1 deletions

View File

@@ -85,7 +85,7 @@ class DuplicateOptionError(Exception):
class SimpleConfigParser: class SimpleConfigParser:
"""A customized config parser targeted at handling Klipper style config files""" """A customized config parser targeted at handling Klipper style config files"""
_SECTION_RE = re.compile(r"\s*\[(\w+\s?[\w\-]+)]\s*([#;].*)?$") _SECTION_RE = re.compile(r"\s*\[(\w+\s?.+)]\s*([#;].*)?$")
_OPTION_RE = re.compile(r"^\s*(\w+)\s*[:=]\s*([^=:].*)\s*([#;].*)?$") _OPTION_RE = re.compile(r"^\s*(\w+)\s*[:=]\s*([^=:].*)\s*([#;].*)?$")
_MLOPTION_RE = re.compile(r"^\s*(\w+)\s*[:=]\s*([#;].*)?$") _MLOPTION_RE = re.compile(r"^\s*(\w+)\s*[:=]\s*([#;].*)?$")
_COMMENT_RE = re.compile(r"^\s*([#;].*)?$") _COMMENT_RE = re.compile(r"^\s*([#;].*)?$")

View File

@@ -8,6 +8,11 @@ testcases = [
("option: value\n", "option", "value"), ("option: value\n", "option", "value"),
("option: value # inline comment", "option", "value"), ("option: value # inline comment", "option", "value"),
("option: value # inline comment\n", "option", "value"), ("option: value # inline comment\n", "option", "value"),
(
"description: Helper: park toolhead used in PAUSE and CANCEL_PRINT",
"description",
"Helper: park toolhead used in PAUSE and CANCEL_PRINT",
),
("description: homing!", "description", "homing!"), ("description: homing!", "description", "homing!"),
("description: inline macro :-)", "description", "inline macro :-)"), ("description: inline macro :-)", "description", "inline macro :-)"),
("path: %GCODES_DIR%", "path", "%GCODES_DIR%"), ("path: %GCODES_DIR%", "path", "%GCODES_DIR%"),

View File

@@ -3,4 +3,6 @@ testcases = [
("[test_section two]", "test_section two"), ("[test_section two]", "test_section two"),
("[section1] # inline comment", "section1"), ("[section1] # inline comment", "section1"),
("[section2] ; second comment", "section2"), ("[section2] ; second comment", "section2"),
("[include moonraker-obico-update.cfg]", "include moonraker-obico-update.cfg"),
("[include moonraker_obico_macros.cfg]", "include moonraker_obico_macros.cfg"),
] ]

View File

@@ -1,6 +1,11 @@
testcases = [ testcases = [
("[example_section]", True), ("[example_section]", True),
("[gcode_macro CANCEL_PRINT]", True),
("[gcode_macro SET_PAUSE_NEXT_LAYER]", True),
("[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]", True),
("[update_manager moonraker-obico]", True), ("[update_manager moonraker-obico]", True),
("[include moonraker_obico_macros.cfg]", True),
("[include moonraker-obico-update.cfg]", True),
("[example_section two]", True), ("[example_section two]", True),
("not_a_valid_section", False), ("not_a_valid_section", False),
("section: invalid", False), ("section: invalid", False),