From bf4bd5cfc14bc7b108038580789e2e1e3a21ce72 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 25 Apr 2020 00:35:03 -0400 Subject: [PATCH] gcode: Remove parsing helpers from main gcode class Remove the parsing helpers from the main gcode class now that all callers have been converted to use the parsing helpers in the GCodeCommand class. Signed-off-by: Kevin O'Connor --- klippy/gcode.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/klippy/gcode.py b/klippy/gcode.py index faa5d29f..c6d85126 100644 --- a/klippy/gcode.py +++ b/klippy/gcode.py @@ -15,8 +15,6 @@ class GCodeCommand: # Method wrappers self.respond_info = gcode.respond_info self.respond_raw = gcode.respond_raw - self.__contains__ = self._params.__contains__ - self.__getitem__ = self._params.__getitem__ def get_command(self): return self._command def get_commandline(self): @@ -277,8 +275,6 @@ class GCodeParser: # Build gcode "params" dictionary params = { parts[i]: parts[i+1].strip() for i in range(1, numparts, 2) } - params['#original'] = origline - params['#command'] = cmd gcmd = GCodeCommand(self, cmd, origline, params) # Invoke handler for command self.need_ack = need_ack @@ -396,16 +392,6 @@ class GCodeParser: def _respond_state(self, state): self.respond_info("Klipper state: %s" % (state,), log=False) # Parameter parsing helpers - def get_str(self, name, gcmd, default=GCodeCommand.sentinel, parser=str, - minval=None, maxval=None, above=None, below=None): - return gcmd.get(name, default, parser, minval, maxval, above, below) - def get_int(self, name, gcmd, default=GCodeCommand.sentinel, - minval=None, maxval=None): - return gcmd.get_int(name, default, minval=minval, maxval=maxval) - def get_float(self, name, gcmd, default=GCodeCommand.sentinel, - minval=None, maxval=None, above=None, below=None): - return gcmd.get_float(name, default, minval=minval, maxval=maxval, - above=above, below=below) extended_r = re.compile( r'^\s*(?:N[0-9]+\s*)?' r'(?P[a-zA-Z_][a-zA-Z0-9_]+)(?:\s+|$)' @@ -420,8 +406,6 @@ class GCodeParser: try: eparams = [earg.split('=', 1) for earg in shlex.split(eargs)] eparams = { k.upper(): v for k, v in eparams } - eparams['#original'] = gcmd._params['#original'] - eparams['#command'] = gcmd._params['#command'] gcmd._params.clear() gcmd._params.update(eparams) return gcmd