From a1fc1ac214a6178b59229b0c87179a8444697e02 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 12 Jun 2020 10:03:28 -0400 Subject: [PATCH] configfile: Use "import ConfigParser as configparser" This minor change makes it easier to port the code to Python3. Signed-off-by: Kevin O'Connor --- klippy/configfile.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/klippy/configfile.py b/klippy/configfile.py index 8cff4a5b..6530331c 100644 --- a/klippy/configfile.py +++ b/klippy/configfile.py @@ -3,15 +3,15 @@ # Copyright (C) 2016-2018 Kevin O'Connor # # This file may be distributed under the terms of the GNU GPLv3 license. -import os, glob, re, time, logging, ConfigParser, StringIO +import os, glob, re, time, logging, ConfigParser as configparser, StringIO -error = ConfigParser.Error +error = configparser.Error class sentinel: pass class ConfigWrapper: - error = ConfigParser.Error + error = configparser.Error def __init__(self, printer, fileconfig, access_tracking, section): self.printer = printer self.fileconfig = fileconfig @@ -194,7 +194,7 @@ class PrinterConfig: if pos >= 0: line = line[:pos] # Process include or buffer line - mo = ConfigParser.RawConfigParser.SECTCRE.match(line) + mo = configparser.RawConfigParser.SECTCRE.match(line) header = mo and mo.group('header') if header and header.startswith('include '): self._parse_config_buffer(buffer, filename, fileconfig) @@ -206,7 +206,7 @@ class PrinterConfig: self._parse_config_buffer(buffer, filename, fileconfig) visited.remove(path) def _build_config_wrapper(self, data, filename): - fileconfig = ConfigParser.RawConfigParser() + fileconfig = configparser.RawConfigParser() self._parse_config(data, filename, fileconfig, set()) return ConfigWrapper(self.printer, fileconfig, {}, 'printer') def _build_config_string(self, config):