Drop Python 2 compat

develop
lethosor 2022-07-27 00:48:22 -04:00
parent 0fae25fc8b
commit a8b40c5911
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
1 changed files with 1 additions and 6 deletions

@ -17,7 +17,6 @@ serve to show the default.
import contextlib import contextlib
import datetime import datetime
import io import io
from io import open
import os import os
import re import re
import shlex # pylint:disable=unused-import import shlex # pylint:disable=unused-import
@ -130,10 +129,6 @@ def get_tags():
return tags return tags
def get_open_mode():
return 'w' if sys.version_info.major > 2 else 'wb'
@contextlib.contextmanager @contextlib.contextmanager
def write_file_if_changed(path): def write_file_if_changed(path):
with io.StringIO() as buffer: with io.StringIO() as buffer:
@ -144,7 +139,7 @@ def write_file_if_changed(path):
old_contents = infile.read() old_contents = infile.read()
if old_contents != new_contents: if old_contents != new_contents:
with open(path, get_open_mode()) as outfile: with open(path, 'w') as outfile:
outfile.write(new_contents) outfile.write(new_contents)