mirror of
https://github.com/enzet/map-machine.git
synced 2025-08-06 10:09:52 +02:00
Refactor figures; get use of Python 3.9 features.
This commit is contained in:
parent
053324451a
commit
3bcf026862
36 changed files with 698 additions and 750 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue