Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-03 17:23:01 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-23 10:59:55 +0300
commit05eb3c6054fbf8777abf07f711fb82da9b35be4e (patch)
treec528a6af549852c080edb70b0b0133860ce353d4 /sphinx/domains
parent5ce72f465be76ee3aa3179380fc925ba816b6c5f (diff)
refactor: Index class becomes subclasses of abc.ABC
The `Index` class becomes subclasses of `abc.ABC` to indicate methods that must be overrided in the concrete classes.
Diffstat (limited to 'sphinx/domains')
-rw-r--r--sphinx/domains/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sphinx/domains/__init__.py b/sphinx/domains/__init__.py
index 3439ea93c..d241b1523 100644
--- a/sphinx/domains/__init__.py
+++ b/sphinx/domains/__init__.py
@@ -10,6 +10,7 @@
"""
import copy
+from abc import ABC, abstractmethod
from typing import (TYPE_CHECKING, Any, Callable, Dict, Iterable, List, NamedTuple, Tuple,
Type, Union, cast)
@@ -64,7 +65,7 @@ class IndexEntry(NamedTuple):
descr: str
-class Index:
+class Index(ABC):
"""
An Index is the description for a domain-specific index. To add an index to
a domain, subclass Index, overriding the three name attributes:
@@ -97,6 +98,7 @@ class Index:
% self.__class__.__name__)
self.domain = domain
+ @abstractmethod
def generate(self, docnames: Iterable[str] = None
) -> Tuple[List[Tuple[str, List[IndexEntry]]], bool]:
"""Get entries for the index.