@@ -71,7 +71,7 @@ def check_test_cases() -> None:
7171 for file in testcase_dir .rglob ("*.py" ):
7272 assert file .stem .startswith ("check_" ), bad_test_case_filename .format (file )
7373 if package_name != "stdlib" :
74- with open (file ) as f :
74+ with open (file , encoding = "UTF-8" ) as f :
7575 lines = {line .strip () for line in f }
7676 pyright_setting_not_enabled_msg = (
7777 f'Third-party test-case file "{ file } " must have '
@@ -93,7 +93,7 @@ def check_no_symlinks() -> None:
9393
9494def check_versions () -> None :
9595 versions = set ()
96- with open ("stdlib/VERSIONS" ) as f :
96+ with open ("stdlib/VERSIONS" , encoding = "UTF-8" ) as f :
9797 data = f .read ().splitlines ()
9898 for line in data :
9999 line = strip_comments (line )
@@ -128,7 +128,7 @@ def _find_stdlib_modules() -> set[str]:
128128
129129def check_metadata () -> None :
130130 for distribution in os .listdir ("stubs" ):
131- with open (os .path .join ("stubs" , distribution , "METADATA.toml" )) as f :
131+ with open (os .path .join ("stubs" , distribution , "METADATA.toml" ), encoding = "UTF-8" ) as f :
132132 data = tomli .loads (f .read ())
133133 assert "version" in data , f"Missing version for { distribution } "
134134 version = data ["version" ]
@@ -153,14 +153,14 @@ def check_metadata() -> None:
153153
154154
155155def get_txt_requirements () -> dict [str , SpecifierSet ]:
156- with open ("requirements-tests.txt" ) as requirements_file :
156+ with open ("requirements-tests.txt" , encoding = "UTF-8" ) as requirements_file :
157157 stripped_lines = map (strip_comments , requirements_file )
158158 requirements = map (Requirement , filter (None , stripped_lines ))
159159 return {requirement .name : requirement .specifier for requirement in requirements }
160160
161161
162162def get_precommit_requirements () -> dict [str , SpecifierSet ]:
163- with open (".pre-commit-config.yaml" ) as precommit_file :
163+ with open (".pre-commit-config.yaml" , encoding = "UTF-8" ) as precommit_file :
164164 precommit = precommit_file .read ()
165165 yam = yaml .load (precommit , Loader = yaml .Loader )
166166 precommit_requirements = {}
0 commit comments