diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2025-08-06 17:58:10 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2025-08-06 18:42:41 +0100 |
commit | 8eab4299c93014613dbadfee6770535b99d48746 (patch) | |
tree | 25f2a82d41ec7f78724b4821040873a83c64f9ff /klippy/configfile.py | |
parent | 581208b2ffeeb2a2128aee0741fa3fd9e46358e2 (diff) | |
download | kutter-8eab4299c93014613dbadfee6770535b99d48746.tar.gz kutter-8eab4299c93014613dbadfee6770535b99d48746.tar.xz kutter-8eab4299c93014613dbadfee6770535b99d48746.zip |
Remove python2 support (first party)
Diffstat (limited to 'klippy/configfile.py')
-rw-r--r-- | klippy/configfile.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/klippy/configfile.py b/klippy/configfile.py index 3ddfe0d3..e8ede0c3 100644 --- a/klippy/configfile.py +++ b/klippy/configfile.py @@ -3,7 +3,7 @@ # Copyright (C) 2016-2024 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. -import sys, os, glob, re, time, logging, configparser, io +import os, glob, re, time, logging, configparser, io error = configparser.Error @@ -263,19 +263,12 @@ class ConfigFileReader: if pos >= 0: lines[i] = line[:pos] sbuffer = io.StringIO("\n".join(lines)) - if sys.version_info.major >= 3: - fileconfig.read_file(sbuffer, filename) - else: - fileconfig.readfp(sbuffer, filename) + fileconfig.read_file(sbuffer, filename) def _create_fileconfig(self): - if sys.version_info.major >= 3: - fileconfig = configparser.RawConfigParser( - strict=False, inline_comment_prefixes=(";", "#") - ) - else: - fileconfig = configparser.RawConfigParser() - return fileconfig + return configparser.RawConfigParser( + strict=False, inline_comment_prefixes=(";", "#") + ) def build_fileconfig(self, data, filename): fileconfig = self._create_fileconfig() |