Unverified Commit 254fef67 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Fix backend regex (#14566)

parent c468a87a
...@@ -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"]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment