Skip to content

Commit

Permalink
Add static and class methods to demo module for autodoc
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg committed Nov 17, 2021
1 parent 940ac49 commit 3dff135
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions docs/kitchen-sink/demo_py/furo_demo_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
autodoc, and other related functionality.
"""

from typing import Optional, TextIO, Type, Union
from typing import NewType, Optional, TextIO, Type, Union

MagicNumber = NewType("MagicNumber", int)


def show_warning(
Expand Down Expand Up @@ -38,6 +40,16 @@ class RandomNumberGenerator:
This is hopefully useful to somebody.
"""

@staticmethod
def magic_number(cls) -> int:
"""Returns a magical number."""
return 0

@classmethod
def get_seed(cls) -> MagicNumber:
"""Returns a random seed."""
return cls().seed

@property
def seed(self):
"""The seed for random number generation.
Expand All @@ -47,9 +59,9 @@ def seed(self):
return 4

def get_random_integer(self) -> int:
"""Return a random integer."""
"""Returns a random integer."""
return self.seed

def get_random_float(self) -> float:
"""Return a random float."""
"""Returns a random float."""
return float(self.seed)

0 comments on commit 3dff135

Please sign in to comment.