Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
nardew committed Mar 31, 2024
1 parent d31614e commit aca8fb6
Showing 1 changed file with 48 additions and 12 deletions.
60 changes: 48 additions & 12 deletions src/talipp/indicators/Indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@


class Indicator(Sequence):
"""Base indicator class.
Args:
input_modifier: Input modifier.
output_value_type: Output value type.
input_sampling: Input sampling type.
"""

__metaclass__ = ABCMeta

def __init__(self,
Expand Down Expand Up @@ -67,16 +75,27 @@ def initialize(self, input_values: ListAny = None, input_indicator: 'Indicator'
input_indicator.add_output_listener(self)

def add_input_value(self, value: Any) -> None:
"""**Deprecated.** Use [add][talipp.indicators.Indicator.Indicator.add] method instead.
Add a new input value.
Args:
value: Value to be added.
"""

warn('This method is deprecated and will be removed in the next major version. '
'Please use add(...) method with the same signature instead.',
DeprecationWarning,
stacklevel=2)
return self.add(value)

def add(self, value: Any) -> None:
"""Add a new input value.
Args:
value: Value to be added.
"""
add
"""

if (self.input_sampler is not None
and has_valid_values(self.input_values)
and self.input_sampler.is_same_period(value, self.input_values[-1])):
Expand Down Expand Up @@ -107,30 +126,45 @@ def add(self, value: Any) -> None:
listener.add(new_value)

def update_input_value(self, value: Any) -> None:
"""**Deprecated.** Use [update][talipp.indicators.Indicator.Indicator.update] method instead.
Update the last input value.
Args:
value: Value to be used.
"""

warn('This method is deprecated and will be removed in the next major version. '
'Please use update(...) method with the same signature instead.',
DeprecationWarning,
stacklevel=2)
return self.update(value)

def update(self, value: Any) -> None:
"""Update the last input value.
Args:
value: Value to be used.
"""
update
"""

self.remove()
self.add(value)

def remove_input_value(self) -> None:
"""**Deprecated.** Use [remove][talipp.indicators.Indicator.Indicator.remove] method instead.
Remove the last input value.
"""

warn('This method is deprecated and will be removed in the next major version. '
'Please use remove(...) method with the same signature instead.',
DeprecationWarning,
stacklevel=2)
return self.remove()

def remove(self) -> None:
"""
remove
"""
"""Remove the last input value."""

for sub_indicator in self.sub_indicators:
sub_indicator.remove()

Expand Down Expand Up @@ -162,9 +196,8 @@ def _remove_custom(self) -> None:
pass

def remove_all(self) -> None:
"""
remova_all
"""
"""Remove all input values."""

for sub_indicator in self.sub_indicators:
sub_indicator.remove_all()

Expand All @@ -186,9 +219,12 @@ def _remove_all_custom(self) -> None:
pass

def purge_oldest(self, size: int) -> None:
"""Purge old input values.
Args:
size: number of oldest input values to be purged.
"""
purge_oldest
"""

for sub_indicator in self.sub_indicators:
sub_indicator.purge_oldest(size)

Expand Down

0 comments on commit aca8fb6

Please sign in to comment.