-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
70 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from collections.abc import Iterator | ||
|
||
from uhi.typing.plottable import PlottableAxisGeneric, PlottableTraits | ||
|
||
|
||
class UHITraits(PlottableTraits): | ||
@property | ||
def circular(self) -> bool: | ||
return False | ||
|
||
@property | ||
def discrete(self) -> bool: | ||
return False | ||
|
||
|
||
class UHIAxis(PlottableAxisGeneric[tuple[float, float]]): | ||
@property | ||
def traits(self) -> UHITraits: | ||
return UHITraits() | ||
|
||
def __init__(self, values: list[tuple[float, float]]): | ||
self.values = values | ||
|
||
# access axis[i] | ||
def __getitem__(self, i: int) -> tuple[float, float]: | ||
return self.values[i] | ||
|
||
def __len__(self) -> int: | ||
return len(self.values) | ||
|
||
def __eq__(self, other: object) -> bool: | ||
if isinstance(other, UHIAxis): | ||
return self.values == other.values # noqa: PD011 | ||
return False | ||
|
||
def __iter__(self) -> Iterator[tuple[float, float]]: | ||
return iter(self.values) | ||
|
||
def index(self, value: tuple[float, float]) -> int: | ||
return self.values.index(value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters