File: __init__.py

package info (click to toggle)
mkdocs-section-index 0.3.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 260 kB
  • sloc: python: 486; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 883 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from __future__ import annotations

from mkdocs.structure.nav import Section
from mkdocs.structure.pages import Page

__version__ = "0.3.11"
__all__ = ["SectionPage"]


class SectionPage(Section, Page):  # type: ignore[misc]
    def __init__(self, title: str, file, config, children):
        Page.__init__(self, title=title, file=file, config=config)
        Section.__init__(self, title=title, children=children)
        self.is_section = self.is_page = True

    active = Page.active  # type: ignore[assignment]

    def __repr__(self):
        result = Page.__repr__(self)
        if not result.startswith("Section"):
            result = "Section" + result
        return result

    def __eq__(self, other):
        return object.__eq__(self, other)

    def __ne__(self, other):
        return not (self == other)

    def __hash__(self):
        return object.__hash__(self)