Abstract base class for implementing trolling interface.
Parameters
x
: float
The parameter x
is a float, which means it can hold decimal values. It is used to store a numerical value.
n
: int
The parameter n
is an integer that represents the number of iterations or steps in a process.
Source code in src/mkdocs_demo/config/interfaces.py
| def __init__(self, x: float, n: int) -> None:
"""
The above function is an initializer method for a class that takes in
two parameters, `x` and `n`, and does not return anything.
Parameters
----------
`x` : `float`
The parameter `x` is a float, which means it can hold decimal
values. It is used to store a numerical value.
`n` : `int`
The parameter `n` is an integer that represents the number of
iterations or steps in a process.
"""
self.x = x
self.n = n
|
__repr__
Source code in src/mkdocs_demo/config/interfaces.py
| def __repr__(self) -> str:
return f"""{self.x} * {self.n} = {self.multiple}"""
|
__str__
Source code in src/mkdocs_demo/config/interfaces.py
| def __str__(self) -> str:
return f"""x={self.x}, n={self.n}, hence the multiple={self.multiple}"""
|
from_dict abstractmethod
Source code in src/mkdocs_demo/config/interfaces.py
| @abstractmethod
def from_dict(cls, d: dict[str, int]) -> Self:
pass
|
multiple abstractmethod
Source code in src/mkdocs_demo/config/interfaces.py
| @abstractproperty
@abstractmethod
def multiple(self) -> float:
pass
|