mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-23 12:26:29 +01:00
Avoid re-parsing identical selectors for class names
This commit is contained in:
parent
0bdabbaeef
commit
304f682808
1 changed files with 2 additions and 0 deletions
|
|
@ -18,6 +18,7 @@
|
|||
from calibre.utils.icu import numeric_sort_key
|
||||
from css_selectors import Select, SelectorError
|
||||
from polyglot.builtins import iteritems, itervalues, unicode_type, filter
|
||||
from polyglot.functools import lru_cache
|
||||
|
||||
|
||||
def filter_used_rules(rules, log, select):
|
||||
|
|
@ -291,6 +292,7 @@ def _classes_in_selector(selector, classes):
|
|||
classes.add(cn)
|
||||
|
||||
|
||||
@lru_cache(maxsize=4096)
|
||||
def classes_in_selector(text):
|
||||
classes = set()
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue