From 254fef67cf1f54f692871147e6b4fca1ff90347e Mon Sep 17 00:00:00 2001 From: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> Date: Tue, 30 Nov 2021 05:32:20 -0500 Subject: [PATCH] Fix backend regex (#14566) --- utils/check_inits.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/check_inits.py b/utils/check_inits.py index d336a6fd93..8cfbfc18a4 100644 --- a/utils/check_inits.py +++ b/utils/check_inits.py @@ -22,11 +22,11 @@ PATH_TO_TRANSFORMERS = "src/transformers" # 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"] _re_import_struct_key_value = re.compile(r'\s+"\S*":\s+\[([^\]]*)\]') # 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") _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"]