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
032d63b9
Unverified
Commit
032d63b9
authored
May 17, 2022
by
Sylvain Gugger
Committed by
GitHub
May 17, 2022
Browse files
Fix dummy creation script (#17304)
parent
986dd5c5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
utils/check_dummies.py
utils/check_dummies.py
+3
-1
No files found.
utils/check_dummies.py
View file @
032d63b9
...
@@ -26,7 +26,7 @@ PATH_TO_TRANSFORMERS = "src/transformers"
...
@@ -26,7 +26,7 @@ PATH_TO_TRANSFORMERS = "src/transformers"
_re_backend
=
re
.
compile
(
r
"is\_([a-z_]*)_available()"
)
_re_backend
=
re
.
compile
(
r
"is\_([a-z_]*)_available()"
)
# Matches from xxx import bla
# Matches from xxx import bla
_re_single_line_import
=
re
.
compile
(
r
"\s+from\s+\S*\s+import\s+([^\(\s].*)\n"
)
_re_single_line_import
=
re
.
compile
(
r
"\s+from\s+\S*\s+import\s+([^\(\s].*)\n"
)
_re_test_backend
=
re
.
compile
(
r
"^\s+if\s+is\_[a-z]*\_available\(\)"
)
_re_test_backend
=
re
.
compile
(
r
"^\s+if\s+
not\s+
is\_[a-z]*\_available\(\)"
)
DUMMY_CONSTANT
=
"""
DUMMY_CONSTANT
=
"""
...
@@ -73,6 +73,8 @@ def read_init():
...
@@ -73,6 +73,8 @@ def read_init():
# If the line is an if is_backend_available, we grab all objects associated.
# If the line is an if is_backend_available, we grab all objects associated.
backend
=
find_backend
(
lines
[
line_index
])
backend
=
find_backend
(
lines
[
line_index
])
if
backend
is
not
None
:
if
backend
is
not
None
:
while
not
lines
[
line_index
].
startswith
(
" else:"
):
line_index
+=
1
line_index
+=
1
line_index
+=
1
objects
=
[]
objects
=
[]
...
...
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