From 51f865b774a6f00e7776fae97886c59c394b796a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Thu, 19 Sep 2024 17:05:23 -0400 Subject: [PATCH] style: Bump Black's target Python versions for Python 3.9 minimum (#4347) * style: Bump Black's target Python versions * style: Format with new Black settings --- pyproject.toml | 2 +- scripts/g.extension/g.extension.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 992e48391ad..6689d6375eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires-python = ">=3.9" [tool.black] required-version = '24' line-length = 88 -target-version = ['py38', 'py39', 'py310', 'py311', 'py312'] +target-version = ['py39', 'py310', 'py311', 'py312', 'py313'] # 'extend-exclude' excludes files or directories in addition to the defaults extend-exclude = ''' ( diff --git a/scripts/g.extension/g.extension.py b/scripts/g.extension/g.extension.py index bf8cd183135..ed0544ee2c4 100644 --- a/scripts/g.extension/g.extension.py +++ b/scripts/g.extension/g.extension.py @@ -470,9 +470,10 @@ def replace_shebang_win(python_file): cur_dir = os.path.dirname(python_file) tmp_name = os.path.join(cur_dir, gs.tempname(12)) - with codecs.open(python_file, "r", encoding="utf8") as in_file, codecs.open( - tmp_name, "w", encoding="utf8" - ) as out_file: + with ( + codecs.open(python_file, "r", encoding="utf8") as in_file, + codecs.open(tmp_name, "w", encoding="utf8") as out_file, + ): for line in in_file: new_line = line.replace( "#!/usr/bin/env python\n", "#!/usr/bin/env python3\n"