From e6f93a117bd05aeeb1721eae8e05cbdd4b11c3d7 Mon Sep 17 00:00:00 2001 From: John Zheng Date: Sun, 10 Nov 2024 03:25:35 -0800 Subject: [PATCH 1/2] Fix DeprecationWarning for locale.getdefaultlocale() in diagnose.py --- python/taichi/tools/diagnose.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/taichi/tools/diagnose.py b/python/taichi/tools/diagnose.py index db1b263dc6612..5a55591c6ee9d 100644 --- a/python/taichi/tools/diagnose.py +++ b/python/taichi/tools/diagnose.py @@ -16,8 +16,9 @@ def main(): print(f"platform: {platform.platform()}") print(f'architecture: {" ".join(platform.architecture())}') print(f"uname: {platform.uname()}") - - print(f'locale: {".".join(locale.getdefaultlocale())}') + locale.setlocale(locale.LC_ALL, '') + loc, enc = locale.getlocale(), locale.getpreferredencoding() + print(f'locale: {loc[0]}.{enc if enc else loc[1]}') print(f'PATH: {os.environ.get("PATH")}') print(f"PYTHONPATH: {sys.path}") print("") From 8a5f320b350c3875e6540eecdc027ae2cbeaf5ac Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 11:28:33 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- python/taichi/tools/diagnose.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/taichi/tools/diagnose.py b/python/taichi/tools/diagnose.py index 5a55591c6ee9d..c68ff5fdbab72 100644 --- a/python/taichi/tools/diagnose.py +++ b/python/taichi/tools/diagnose.py @@ -16,9 +16,9 @@ def main(): print(f"platform: {platform.platform()}") print(f'architecture: {" ".join(platform.architecture())}') print(f"uname: {platform.uname()}") - locale.setlocale(locale.LC_ALL, '') + locale.setlocale(locale.LC_ALL, "") loc, enc = locale.getlocale(), locale.getpreferredencoding() - print(f'locale: {loc[0]}.{enc if enc else loc[1]}') + print(f"locale: {loc[0]}.{enc if enc else loc[1]}") print(f'PATH: {os.environ.get("PATH")}') print(f"PYTHONPATH: {sys.path}") print("")