From 3238fade0c3947310f43459fcdb7d2d92fcf4215 Mon Sep 17 00:00:00 2001 From: Luis Pedro Coelho Date: Wed, 6 Dec 2023 22:05:12 +1000 Subject: [PATCH] RFCT Remove compatibily with Python2 The rest of SemiBin requires Python >=3.7 anyway --- SemiBin/atomicwrite.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/SemiBin/atomicwrite.py b/SemiBin/atomicwrite.py index 5afdd8c..6aae830 100644 --- a/SemiBin/atomicwrite.py +++ b/SemiBin/atomicwrite.py @@ -8,23 +8,14 @@ import sys import tempfile import errno +from os import fspath try: import fcntl except ImportError: fcntl = None -# `fspath` was added in Python 3.6 -try: - from os import fspath -except ImportError: - fspath = None - - -PY2 = sys.version_info[0] == 2 - -text_type = unicode if PY2 else str # noqa - +DEFAULT_MODE = "wb" def _path_to_unicode(x): if not isinstance(x, text_type): @@ -32,9 +23,6 @@ def _path_to_unicode(x): return x -DEFAULT_MODE = "wb" if PY2 else "w" - - _proper_fsync = os.fsync