Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
73083581
Unverified
Commit
73083581
authored
Jun 13, 2022
by
Bram Vanroy
Committed by
GitHub
Jun 13, 2022
Browse files
explicitly set utf8 for Windows (#17664)
parent
c1daf724
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
utils/check_repo.py
utils/check_repo.py
+1
-1
utils/custom_init_isort.py
utils/custom_init_isort.py
+2
-2
utils/notification_service_doc_tests.py
utils/notification_service_doc_tests.py
+1
-1
No files found.
utils/check_repo.py
View file @
73083581
...
...
@@ -725,7 +725,7 @@ def check_docstrings_are_in_md():
"""Check all docstrings are in md"""
files_with_rst
=
[]
for
file
in
Path
(
PATH_TO_TRANSFORMERS
).
glob
(
"**/*.py"
):
with
open
(
file
,
"r
"
)
as
f
:
with
open
(
file
,
encoding
=
"utf-8
"
)
as
f
:
code
=
f
.
read
()
docstrings
=
code
.
split
(
'"""'
)
...
...
utils/custom_init_isort.py
View file @
73083581
...
...
@@ -167,7 +167,7 @@ def sort_imports(file, check_only=True):
"""
Sort `_import_structure` imports in `file`, `check_only` determines if we only check or overwrite.
"""
with
open
(
file
,
"r
"
)
as
f
:
with
open
(
file
,
encoding
=
"utf-8
"
)
as
f
:
code
=
f
.
read
()
if
"_import_structure"
not
in
code
:
...
...
@@ -227,7 +227,7 @@ def sort_imports(file, check_only=True):
return
True
else
:
print
(
f
"Overwriting
{
file
}
."
)
with
open
(
file
,
"w"
)
as
f
:
with
open
(
file
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
"
\n
"
.
join
(
main_blocks
))
...
...
utils/notification_service_doc_tests.py
View file @
73083581
...
...
@@ -289,7 +289,7 @@ def retrieve_artifact(name: str):
files
=
os
.
listdir
(
name
)
for
file
in
files
:
try
:
with
open
(
os
.
path
.
join
(
name
,
file
))
as
f
:
with
open
(
os
.
path
.
join
(
name
,
file
)
,
encoding
=
"utf-8"
)
as
f
:
_artifact
[
file
.
split
(
"."
)[
0
]]
=
f
.
read
()
except
UnicodeDecodeError
as
e
:
raise
ValueError
(
f
"Could not open
{
os
.
path
.
join
(
name
,
file
)
}
."
)
from
e
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment