Drop logic for old python versions

Now minimum python version supported is 3.6, so any logic for older
python versions can be removed.

Change-Id: Ie26cc300c823c3e0615f54453dc9ca9366d7a2e0
This commit is contained in:
Takashi Kajinami 2024-09-03 16:13:57 +09:00 committed by Ian Wienand
parent 3e4062e35d
commit db2955b8b5
No known key found for this signature in database
2 changed files with 3 additions and 11 deletions

View File

@ -75,11 +75,7 @@ def main():
# non-buffered behaviour. on python3, sys.stdin was
# opened with the system encoding and made the line into
# utf-8, so write the logfile out in utf-8 bytes.
if sys.version_info < (3,):
outfile.write(ts_line)
else:
outfile.write(
ts_line.encode('utf-8', errors='surrogateescape'))
outfile.write(ts_line.encode('utf-8', errors='surrogateescape'))
outfile.flush()

View File

@ -26,7 +26,6 @@ import json
import logging
import logging.config
import os
import sys
# A simple formatter to more or less copy oslo.log's ContextFormatter
@ -43,11 +42,8 @@ class DibFormatter(logging.Formatter):
else:
fmt = self.fmt
if sys.version_info < (3, 2):
self._fmt = fmt
else:
self._style = logging.PercentStyle(fmt)
self._fmt = self._style._fmt
self._style = logging.PercentStyle(fmt)
self._fmt = self._style._fmt
return logging.Formatter.format(self, record)