Skip to content

Commit 99dc3e7

Browse files
author
aviau
committed
Added warning on ResultSet's __getitem__ and documented its replacement
1 parent 7d629cc commit 99dc3e7

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

influxdb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
]
1414

1515

16-
__version__ = '2.5.0'
16+
__version__ = '2.5.1'

influxdb/resultset.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# -*- coding: utf-8 -*-
22

3+
import warnings
4+
35
from influxdb.exceptions import InfluxDBClientError
46

57
_sentinel = object()
@@ -37,6 +39,13 @@ def __getitem__(self, key):
3739
The order in which the points are yielded is actually undefined but
3840
it might change..
3941
"""
42+
43+
warnings.warn(
44+
("ResultSet's ``__getitem__`` method will be deprecated. Use"
45+
"``get_points`` instead."),
46+
DeprecationWarning
47+
)
48+
4049
if isinstance(key, tuple):
4150
if 2 != len(key):
4251
raise TypeError('only 2-tuples allowed')
@@ -54,6 +63,17 @@ def __getitem__(self, key):
5463
return self.get_points(name, tags)
5564

5665
def get_points(self, measurement=None, tags=None):
66+
"""
67+
Returns a generator for all the points that match the given filters.
68+
69+
:param measurement: The measurement name
70+
:type measurement: str
71+
72+
:param tags: Tags to look for
73+
:type tags: dict
74+
75+
:return: Points generator
76+
"""
5777

5878
# Raise error if measurement is not str or bytes
5979
if not isinstance(measurement,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy