zabgrab.services.listing¶
Listing data points, filtered, sorted and sliced (zabgrab show).
A listing is made of sections. Sorted by time, there’s one section holding every item’s points, interleaved. Sorted by value, there’s one section per item, since values of different items (often in different units) can’t be ranked together.
Module Attributes
The hourly trend statistics, in the order they're shown. |
|
What |
Functions
|
List the points of some series, filtered, sorted and sliced. |
|
Find the positions of a series' points that pass the filters. |
|
Name the column holding a series' values, for sorting and filtering. |
Classes
|
How to filter, sort and slice a listing. |
|
One point of a series. |
|
A part of a listing. |
- zabgrab.services.listing.STATISTICS = ('min', 'avg', 'max', 'count')¶
The hourly trend statistics, in the order they’re shown.
- zabgrab.services.listing.SORT_KEYS = ('time', 'value', 'min', 'avg', 'max', 'count')¶
What
--sortaccepts.
- class zabgrab.services.listing.ListingOptions(sort='time', descending=False, limit=None, offset=0, grep=None, above=None, below=None)[source]¶
Bases:
objectHow to filter, sort and slice a listing.
- Parameters:
- grep¶
Only points whose value, as text, contains a match.
- Type:
re.Pattern or None
- above, below
Only numeric points whose value is greater than
aboveand less thanbelow.- Type:
float or None
- class zabgrab.services.listing.Section(series, rows, matched)[source]¶
Bases:
objectA part of a listing.
- zabgrab.services.listing.value_column(series, sort='value')[source]¶
Name the column holding a series’ values, for sorting and filtering.
Raw data has a
valuecolumn. Hourly trends have statistics instead: the one named bysort, else the average (or the first one fetched).- Parameters:
- Returns:
str – The column’s name.
- Raises:
ZabgrabError – If
sortnames a statistic the series doesn’t have.- Return type:
- zabgrab.services.listing.listing(series, options)[source]¶
List the points of some series, filtered, sorted and sliced.
- Parameters:
series (sequence of Series) – The items’ data.
options (ListingOptions) – How to filter, sort and slice.
- Returns:
list of Section – One section sorted by time, or one per item sorted by value or a statistic. Sections with no matching points are left out.
- Raises:
ZabgrabError – If the sort key doesn’t apply to a series (see
value_column()).- Return type:
- zabgrab.services.listing.matching(series, options)[source]¶
Find the positions of a series’ points that pass the filters.
- Parameters:
series (Series) – The series.
options (ListingOptions) – The filters (
grep,aboveandbelow), and the sort key, which picks the value compared for hourly trends (seevalue_column()).
- Returns:
list of int – The positions, in time order.
- Return type: