Skip to content

Commit

Permalink
made dt Signal arg optional
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-steinke committed May 26, 2024
1 parent e5ba7c5 commit a25e52c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions vessim/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, name: Optional[str] = None) -> None:
self.name = name

@abstractmethod
def at(self, dt: DatetimeLike, **kwargs):
def at(self, dt: Optional[DatetimeLike] = None, **kwargs):
"""Retrieves actual data point at given time."""

def finalize(self) -> None:
Expand Down Expand Up @@ -161,7 +161,9 @@ def columns(self) -> list:
"""Returns a list of all columns where actual data is available."""
return list(self._actual.keys())

def at(self, dt: DatetimeLike, column: Optional[str] = None, **kwargs) -> float:
def at(
self, dt: Optional[DatetimeLike] = None, column: Optional[str] = None, **kwargs
) -> float:
"""Retrieves actual data point of zone at given time.
If queried timestamp is not available in the `actual` dataframe, the fill_method
Expand All @@ -177,6 +179,8 @@ def at(self, dt: DatetimeLike, column: Optional[str] = None, **kwargs) -> float:
Raises:
ValueError: If there is no available data at zone or time, or extra kwargs specified.
"""
if not dt:
raise ValueError("Argument dt cannot be None.")
if kwargs:
raise ValueError(f"Invalid arguments: {kwargs.keys()}")
if not column:
Expand Down Expand Up @@ -402,5 +406,5 @@ def set_power(self, value):
raise ValueError("p must not be less than 0")
self._p = value

def at(self, dt: DatetimeLike, **kwargs):
def at(self, dt: Optional[DatetimeLike] = None, **kwargs):
return self._p

0 comments on commit a25e52c

Please sign in to comment.