Skip to content

Commit

Permalink
RFCT Remove compatibily with Python2
Browse files Browse the repository at this point in the history
The rest of SemiBin requires Python >=3.7 anyway
  • Loading branch information
luispedro committed Dec 6, 2023
1 parent 29aeda1 commit 3238fad
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions SemiBin/atomicwrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,21 @@
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):
return x.decode(sys.getfilesystemencoding())
return x


DEFAULT_MODE = "wb" if PY2 else "w"


_proper_fsync = os.fsync


Expand Down

0 comments on commit 3238fad

Please sign in to comment.