Skip to content

Commit 6f76d23

Browse files
committed
Use functools.lru_cache with evaluate_exclude to save parsing identical comments twice.
1 parent 8b76d95 commit 6f76d23

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

coverage_pyver_pragma/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#
2828

2929
# stdlib
30+
import functools
3031
import re
3132
from contextlib import suppress
3233

@@ -57,6 +58,7 @@
5758
"""
5859

5960

61+
@functools.lru_cache
6062
def evaluate_exclude(expression: str) -> bool:
6163
"""
6264
Evaluate the given expression to determine whether the line should be excluded from coverage.

0 commit comments

Comments
 (0)