From 9748885d5b282686413d794436094201cec11520 Mon Sep 17 00:00:00 2001 From: dmitrishastin Date: Sun, 22 Oct 2023 15:04:37 +0100 Subject: [PATCH] Update check_style.py --- util/check_style.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/check_style.py b/util/check_style.py index 97b7c1ba58c..be4d60c6f62 100644 --- a/util/check_style.py +++ b/util/check_style.py @@ -78,7 +78,7 @@ def _check_style(file_path, clang_format_bin): """ Returns (true, true) if (style, header) is valid. """ - with open(file_path, 'r') as f: + with open(file_path, 'r', encoding='utf-8') as f: is_valid_header = f.read().startswith(CppFormatter.standard_header) cmd = [ @@ -156,7 +156,7 @@ def _check_style(file_path, style_config): Returns (true, true) if (style, header) is valid. """ - with open(file_path, 'r') as f: + with open(file_path, 'r', encoding='utf-8') as f: content = f.read() is_valid_header = (len(content) == 0 or content.startswith( PythonFormatter.standard_header)) @@ -218,7 +218,7 @@ def _check_or_apply_style(file_path, style_config, apply): are merged into one. """ # Ref: https://gist.github.com/oskopek/496c0d96c79fb6a13692657b39d7c709 - with open(file_path, "r") as f: + with open(file_path, "r", encoding='utf-8') as f: notebook = nbformat.read(f, as_version=nbformat.NO_CONVERT) nbformat.validate(notebook) @@ -241,7 +241,7 @@ def _check_or_apply_style(file_path, style_config, apply): changed = True if apply: - with open(file_path, "w") as f: + with open(file_path, "w", encoding='utf-8') as f: nbformat.write(notebook, f, version=nbformat.NO_CONVERT) return not changed