From 4d3be23bacf27629b1a89b69175de2bcb8c5533d Mon Sep 17 00:00:00 2001 From: Dunedan Date: Sat, 7 Sep 2024 06:38:45 +0200 Subject: [PATCH] Remove broken and unused ini-file extractor The ini-file extractor has been broken since the transition to Python 3 and nobody noticed, because it isn't used nowadays. Therefore, let's remove it. --- source/tools/i18n/extractors/extractors.py | 36 ---------------------- 1 file changed, 36 deletions(-) diff --git a/source/tools/i18n/extractors/extractors.py b/source/tools/i18n/extractors/extractors.py index fd9df2fcda..6ae2b97848 100644 --- a/source/tools/i18n/extractors/extractors.py +++ b/source/tools/i18n/extractors/extractors.py @@ -490,39 +490,3 @@ class XmlExtractor(Extractor): yield str(split_text), None, context, lineno, comments else: yield str(element.text), None, context, lineno, comments - - -# Hack from http://stackoverflow.com/a/2819788 -class FakeSectionHeader: - def __init__(self, fp): - self.fp = fp - self.sechead = "[root]\n" - - def readline(self): - if self.sechead: - try: - return self.sechead - finally: - self.sechead = None - else: - return self.fp.readline() - - -class IniExtractor(Extractor): - """Extract messages from INI files.""" - - def __init__(self, directory_path, filemasks, options): - super().__init__(directory_path, filemasks, options) - self.keywords = self.options.get("keywords", []) - - def extract_from_file(self, filepath): - import ConfigParser - - config = ConfigParser.RawConfigParser() - with open(filepath, encoding="utf-8") as fd: - config.read_file(FakeSectionHeader(fd)) - for keyword in self.keywords: - message = config.get("root", keyword).strip('"').strip("'") - context = None - comments = [] - yield message, None, context, None, comments