mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
cache on 3.9 only
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from functools import cache
|
||||
from functools import lru_cache
|
||||
from inspect import getfile
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
ClassVar,
|
||||
Iterable,
|
||||
Iterator,
|
||||
Sequence,
|
||||
Type,
|
||||
TypeVar,
|
||||
@@ -231,7 +230,7 @@ class DOMNode(MessagePump):
|
||||
return self._css_bases(self.__class__)
|
||||
|
||||
@classmethod
|
||||
@cache
|
||||
@lru_cache(maxsize=None)
|
||||
def _css_bases(cls, base: Type[DOMNode]) -> Iterable[Type[DOMNode]]:
|
||||
"""Get the DOMNode base classes, which inherit CSS.
|
||||
|
||||
@@ -320,7 +319,7 @@ class DOMNode(MessagePump):
|
||||
return css_stack
|
||||
|
||||
@classmethod
|
||||
@cache
|
||||
@lru_cache(maxsize=None)
|
||||
def _get_component_classes(cls) -> frozenset[str]:
|
||||
"""Gets the component classes for this class and inherited from bases.
|
||||
|
||||
|
||||
@@ -235,3 +235,7 @@ def test_screen_switch(snap_compare):
|
||||
|
||||
def test_disabled_widgets(snap_compare):
|
||||
assert snap_compare(SNAPSHOT_APPS_DIR / "disable_widgets.py")
|
||||
|
||||
|
||||
def test_focus_component_class(snap_compare):
|
||||
assert snap_compare(SNAPSHOT_APPS_DIR / "focus_component_class.py", press=["tab"])
|
||||
|
||||
Reference in New Issue
Block a user