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
254fef67
Unverified
Commit
254fef67
authored
Nov 30, 2021
by
Sylvain Gugger
Committed by
GitHub
Nov 30, 2021
Browse files
Fix backend regex (#14566)
parent
c468a87a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
utils/check_inits.py
utils/check_inits.py
+2
-2
No files found.
utils/check_inits.py
View file @
254fef67
...
@@ -22,11 +22,11 @@ PATH_TO_TRANSFORMERS = "src/transformers"
...
@@ -22,11 +22,11 @@ PATH_TO_TRANSFORMERS = "src/transformers"
# Matches is_xxx_available()
# Matches is_xxx_available()
_re_backend
=
re
.
compile
(
r
"is\_([a-z]*)_available()"
)
_re_backend
=
re
.
compile
(
r
"is\_([a-z
_
]*)_available()"
)
# Catches a line with a key-values pattern: "bla": ["foo", "bar"]
# Catches a line with a key-values pattern: "bla": ["foo", "bar"]
_re_import_struct_key_value
=
re
.
compile
(
r
'\s+"\S*":\s+\[([^\]]*)\]'
)
_re_import_struct_key_value
=
re
.
compile
(
r
'\s+"\S*":\s+\[([^\]]*)\]'
)
# Catches a line if is_foo_available
# Catches a line if is_foo_available
_re_test_backend
=
re
.
compile
(
r
"^\s*if\s+is\_[a-z]*\_available\(\)"
)
_re_test_backend
=
re
.
compile
(
r
"^\s*if\s+is\_[a-z
_
]*\_available\(\)"
)
# Catches a line _import_struct["bla"].append("foo")
# Catches a line _import_struct["bla"].append("foo")
_re_import_struct_add_one
=
re
.
compile
(
r
'^\s*_import_structure\["\S*"\]\.append\("(\S*)"\)'
)
_re_import_struct_add_one
=
re
.
compile
(
r
'^\s*_import_structure\["\S*"\]\.append\("(\S*)"\)'
)
# Catches a line _import_struct["bla"].extend(["foo", "bar"]) or _import_struct["bla"] = ["foo", "bar"]
# Catches a line _import_struct["bla"].extend(["foo", "bar"]) or _import_struct["bla"] = ["foo", "bar"]
...
...
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