Skip to content

Commit 659b7b6

Browse files
committed
perf: rewrite any generator as a for loop
1 parent 3f843bb commit 659b7b6

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/djlint/helpers.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ def is_ignored_block_opening(config: Config, item: str) -> bool:
7272
# block open, even when a self-contained one follows it (<pre>a<!--b-->).
7373
# Probe the marker's last character: some alternatives start one
7474
# character early ("[^{]{#" matches the quote in class="{# x #}").
75-
return any(
76-
not _inside_non_overlapping_span(inline, match.end() - 1, match.end())
77-
for match in config.ignored_block_opening_pattern.finditer(item)
78-
)
75+
for match in config.ignored_block_opening_pattern.finditer(item):
76+
if not _inside_non_overlapping_span(
77+
inline, match.end() - 1, match.end()
78+
):
79+
return True
80+
return False
7981

8082

8183
@lru_cache(maxsize=_LINE_CACHE_SIZE)

0 commit comments

Comments
 (0)