Coverage for src/mkdocs_spellcheck/backends/__init__.py: 0.00%

10 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-05-05 19:28 +0200

1"""This module contains the different spell checking backends.""" 

2 

3from __future__ import annotations 

4 

5from abc import ABC, abstractmethod 

6from typing import TYPE_CHECKING, Any 

7 

8if TYPE_CHECKING: 

9 from mkdocs.structure.pages import Page 

10 

11 

12class Backend(ABC): 

13 """Abstract class for spelling backends.""" 

14 

15 @abstractmethod 

16 def __init__(self, config: dict[str, Any], known_words: set[str] | None = None) -> None: 

17 """Initialize the backend. 

18 

19 Parameters: 

20 config: User configuration from `mkdocs.yml`. 

21 known_words: Globally known words. 

22 """ 

23 raise NotImplementedError 

24 

25 @abstractmethod 

26 def check(self, page: Page, word: str) -> None: 

27 """Check a word appearing in a page. 

28 

29 Parameters: 

30 page: The MkDocs page the word appears in. 

31 word: The word to check. 

32 """ 

33 raise NotImplementedError