Skip to content

Commit f917259

Browse files
committed
Minor performance optimization
1 parent b1b9199 commit f917259

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/graphql/language/block_string.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import re
2+
13
__all__ = [
24
"dedent_block_string_value",
35
"print_block_string",
@@ -36,9 +38,12 @@ def dedent_block_string_value(raw_string: str) -> str:
3638
return "\n".join(lines[start_line:end_line])
3739

3840

41+
_re_blank = re.compile("[ \\t]*")
42+
43+
3944
def is_blank(s: str) -> bool:
4045
"""Check whether string contains only space or tab characters."""
41-
return all(c == " " or c == "\t" for c in s)
46+
return _re_blank.fullmatch(s) is not None
4247

4348

4449
def get_block_string_indentation(value: str) -> int:

0 commit comments

Comments
 (0)