mermaid_demo

A small pdoc example using Mermaid diagrams.

The relationship for Pet and Dog follows the UML diagram:

classDiagram class Dog~Pet~{ -__init__(str name) None +bark(bool loud) None } Dog <|-- Pet Pet : +str name Pet : +List[Pet] friends
 1"""
 2A small `pdoc` example using Mermaid diagrams.
 3
 4The relationship for Pet and Dog follows the UML diagram:
 5
 6```mermaid
 7classDiagram
 8    class Dog~Pet~{
 9        -__init__(str name) None
10        +bark(bool loud) None
11    }
12    Dog <|-- Pet
13    Pet : +str name
14    Pet : +List[Pet] friends
15```
16"""
17
18
19class Pet:
20    name: str
21    """The name of our pet."""
22    friends: list["Pet"]
23    """The friends of our pet."""
24
25    def __init__(self, name: str):
26        """Make a Pet without any friends (yet)."""
27        self.name = name
28        self.friends = []
29
30
31class Dog(Pet):
32    """🐕"""
33
34    def bark(self, loud: bool = True):
35        """*woof*"""
class Pet:
20class Pet:
21    name: str
22    """The name of our pet."""
23    friends: list["Pet"]
24    """The friends of our pet."""
25
26    def __init__(self, name: str):
27        """Make a Pet without any friends (yet)."""
28        self.name = name
29        self.friends = []
Pet(name: str)
26    def __init__(self, name: str):
27        """Make a Pet without any friends (yet)."""
28        self.name = name
29        self.friends = []

Make a Pet without any friends (yet).

name: str

The name of our pet.

friends: list[Pet]

The friends of our pet.

class Dog(Pet):
32class Dog(Pet):
33    """🐕"""
34
35    def bark(self, loud: bool = True):
36        """*woof*"""

🐕

def bark(self, loud: bool = True):
35    def bark(self, loud: bool = True):
36        """*woof*"""

woof

Inherited Members
Pet
Pet
name
friends