Coverage for foxplot / labeled_series.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-05-15 10:53 +0000

1#!/usr/bin/env python3 

2# -*- coding: utf-8 -*- 

3# 

4# SPDX-License-Identifier: Apache-2.0 

5 

6"""Series data unpacked from input dictionaries.""" 

7 

8import abc 

9from typing import List 

10 

11 

12class LabeledSeries(metaclass=abc.ABCMeta): 

13 """Base class for labeled time series.""" 

14 

15 _label: str 

16 

17 def __init__(self, label: str): 

18 """Initialize a new indexed series. 

19 

20 Args: 

21 label: Label of the series in the input data. 

22 """ 

23 self._label = label 

24 

25 @abc.abstractmethod 

26 def __len__(self): 

27 """Length of the indexed series.""" 

28 

29 @abc.abstractmethod 

30 def __repr__(self): 

31 """String representation of the series.""" 

32 

33 def _list_labels(self) -> List[str]: 

34 """List all labels reachable from this node. 

35 

36 Returns: 

37 List of labels. Since this node is a leaf, there is only one. 

38 """ 

39 return [self._label]