express: drop Python 2 fallbacks

This commit is contained in:
Andrej730
2026-07-14 13:00:32 +05:00
parent d183961280
commit 9c91727402
3 changed files with 3 additions and 22 deletions
@@ -18,6 +18,7 @@
import itertools
import functools
from pathlib import Path
def indent(n, s):
@@ -36,15 +37,4 @@ class Base:
"""
def emit(self):
import platform
if tuple(map(int, platform.python_version_tuple())) < (2, 8):
from io import open as unicode_open
unicode_type = unicode
else:
unicode_open = open
unicode_type = lambda x, *args, **kwargs: x
f = unicode_open(self.file_name, "w", encoding="utf-8")
f.write(unicode_type(repr(self), encoding="utf-8", errors="ignore"))
f.close()
Path(self.file_name).write_text(repr(self), encoding="utf-8")