Refactor figures; get use of Python 3.9 features.

This commit is contained in:
Sergey Vartanov 2021-08-18 08:38:33 +03:00
parent 053324451a
commit 3bcf026862
36 changed files with 698 additions and 750 deletions

View file

@ -18,28 +18,20 @@ class MinMax:
max_: Any = None
def update(self, value: Any) -> None:
"""
Update minimum and maximum with new value.
"""
"""Update minimum and maximum with new value."""
self.min_ = value if not self.min_ or value < self.min_ else self.min_
self.max_ = value if not self.max_ or value > self.max_ else self.max_
def delta(self) -> Any:
"""
Difference between maximum and minimum.
"""
"""Difference between maximum and minimum."""
return self.max_ - self.min_
def center(self) -> Any:
"""
Get middle point between minimum and maximum.
"""
"""Get middle point between minimum and maximum."""
return (self.min_ + self.max_) / 2
def is_empty(self) -> bool:
"""
Check if interval is empty.
"""
"""Check if interval is empty."""
return self.min_ == self.max_
def __repr__(self) -> str: