-
Notifications
You must be signed in to change notification settings - Fork 37
feat: Allow iterable of ids in retrieve methods for datapoints #2583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -782,7 +782,7 @@ async def retrieve( | |
| async def retrieve( | ||
| self, | ||
| *, | ||
| id: Sequence[int | DatapointsQuery], | ||
| id: Iterable[int | DatapointsQuery], | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -799,7 +799,7 @@ async def retrieve( | |
| ) -> DatapointsList: ... | ||
|
|
||
| @overload | ||
| async def retrieve( | ||
| async def retrieve( # type: ignore[overload-overlap] | ||
| self, | ||
| *, | ||
| external_id: str | DatapointsQuery, | ||
|
|
@@ -822,7 +822,7 @@ async def retrieve( | |
| async def retrieve( | ||
| self, | ||
| *, | ||
| external_id: SequenceNotStr[str | DatapointsQuery], | ||
| external_id: Iterable[str | DatapointsQuery], | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -862,7 +862,7 @@ async def retrieve( | |
| async def retrieve( | ||
| self, | ||
| *, | ||
| instance_id: Sequence[NodeId | DatapointsQuery], | ||
| instance_id: Iterable[NodeId | DatapointsQuery], | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -882,8 +882,8 @@ async def retrieve( | |
| async def retrieve( | ||
| self, | ||
| *, | ||
| id: None | int | DatapointsQuery | Sequence[int | DatapointsQuery], | ||
| external_id: None | str | DatapointsQuery | SequenceNotStr[str | DatapointsQuery], | ||
| id: None | int | DatapointsQuery | Iterable[int | DatapointsQuery], | ||
| external_id: None | str | DatapointsQuery | Iterable[str | DatapointsQuery], | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -903,8 +903,8 @@ async def retrieve( | |
| async def retrieve( | ||
| self, | ||
| *, | ||
| id: None | int | DatapointsQuery | Sequence[int | DatapointsQuery], | ||
| instance_id: None | NodeId | DatapointsQuery | Sequence[NodeId | DatapointsQuery], | ||
| id: None | int | DatapointsQuery | Iterable[int | DatapointsQuery], | ||
| instance_id: None | NodeId | DatapointsQuery | Iterable[NodeId | DatapointsQuery], | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -924,8 +924,8 @@ async def retrieve( | |
| async def retrieve( | ||
| self, | ||
| *, | ||
| external_id: None | str | DatapointsQuery | SequenceNotStr[str | DatapointsQuery], | ||
| instance_id: None | NodeId | DatapointsQuery | Sequence[NodeId | DatapointsQuery], | ||
| external_id: None | str | DatapointsQuery | Iterable[str | DatapointsQuery], | ||
| instance_id: None | NodeId | DatapointsQuery | Iterable[NodeId | DatapointsQuery], | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -945,9 +945,9 @@ async def retrieve( | |
| async def retrieve( | ||
| self, | ||
| *, | ||
| id: None | int | DatapointsQuery | Sequence[int | DatapointsQuery], | ||
| external_id: None | str | DatapointsQuery | SequenceNotStr[str | DatapointsQuery], | ||
| instance_id: None | NodeId | DatapointsQuery | Sequence[NodeId | DatapointsQuery], | ||
| id: None | int | DatapointsQuery | Iterable[int | DatapointsQuery], | ||
| external_id: None | str | DatapointsQuery | Iterable[str | DatapointsQuery], | ||
| instance_id: None | NodeId | DatapointsQuery | Iterable[NodeId | DatapointsQuery], | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -966,9 +966,9 @@ async def retrieve( | |
| async def retrieve( | ||
| self, | ||
| *, | ||
| id: None | int | DatapointsQuery | Sequence[int | DatapointsQuery] = None, | ||
| external_id: None | str | DatapointsQuery | SequenceNotStr[str | DatapointsQuery] = None, | ||
| instance_id: None | NodeId | DatapointsQuery | Sequence[NodeId | DatapointsQuery] = None, | ||
| id: None | int | DatapointsQuery | Iterable[int | DatapointsQuery] = None, | ||
| external_id: None | str | DatapointsQuery | Iterable[str | DatapointsQuery] = None, | ||
| instance_id: None | NodeId | DatapointsQuery | Iterable[NodeId | DatapointsQuery] = None, | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -1007,9 +1007,9 @@ async def retrieve( | |
| `status codes. <https://docs.cognite.com/dev/concepts/reference/status_codes/>`_ | ||
|
|
||
| Args: | ||
| id (None | int | DatapointsQuery | Sequence[int | DatapointsQuery]): Id, dict (with id) or (mixed) sequence of these. See examples below. | ||
| external_id (None | str | DatapointsQuery | SequenceNotStr[str | DatapointsQuery]): External id, dict (with external id) or (mixed) sequence of these. See examples below. | ||
| instance_id (None | NodeId | DatapointsQuery | Sequence[NodeId | DatapointsQuery]): Instance id or sequence of instance ids. | ||
| id (None | int | DatapointsQuery | Iterable[int | DatapointsQuery]): Id, DatapointsQuery or (mixed) iterable of these. If a dict is passed, its keys will be used as ids. See examples below. | ||
| external_id (None | str | DatapointsQuery | Iterable[str | DatapointsQuery]): External id, DatapointsQuery or (mixed) iterable of these. If a dict is passed, its keys will be used as external_ids. See examples below. | ||
| instance_id (None | NodeId | DatapointsQuery | Iterable[NodeId | DatapointsQuery]): Instance id, DatapointsQuery or (mixed) iterable of these. If a dict is passed, its keys will be used as instance_ids. | ||
|
Comment on lines
+1010
to
+1012
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The overloads for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think what Gemini asks for here is consistency across the retrieve datapoints methods. I personally am ok with incrementally chaning the methods to accept |
||
| start (int | str | datetime.datetime | None): Inclusive start. Default: 1970-01-01 UTC. | ||
| end (int | str | datetime.datetime | None): Exclusive end. Default: "now" | ||
| aggregates (Aggregate | str | list[Aggregate | str] | None): Single aggregate or list of aggregates to retrieve. Available options: ``average``, ``continuous_variance``, ``count``, ``count_bad``, ``count_good``, ``count_uncertain``, ``discrete_variance``, ``duration_bad``, ``duration_good``, ``duration_uncertain``, ``interpolation``, ``max``, ``max_datapoint``, ``min``, ``min_datapoint``, ``step_interpolation``, ``sum`` and ``total_variation``. Default: None (raw datapoints returned) | ||
|
|
@@ -1242,7 +1242,7 @@ async def retrieve_arrays( | |
| async def retrieve_arrays( | ||
| self, | ||
| *, | ||
| id: Sequence[int | DatapointsQuery], | ||
| id: Iterable[int | DatapointsQuery], | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -1259,7 +1259,7 @@ async def retrieve_arrays( | |
| ) -> DatapointsArrayList: ... | ||
|
|
||
| @overload | ||
| async def retrieve_arrays( | ||
| async def retrieve_arrays( # type: ignore[overload-overlap] | ||
| self, | ||
| *, | ||
| external_id: str | DatapointsQuery, | ||
|
|
@@ -1282,7 +1282,7 @@ async def retrieve_arrays( | |
| async def retrieve_arrays( | ||
| self, | ||
| *, | ||
| external_id: SequenceNotStr[str | DatapointsQuery], | ||
| external_id: Iterable[str | DatapointsQuery], | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -1322,7 +1322,7 @@ async def retrieve_arrays( | |
| async def retrieve_arrays( | ||
| self, | ||
| *, | ||
| instance_id: Sequence[NodeId | DatapointsQuery], | ||
| instance_id: Iterable[NodeId | DatapointsQuery], | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -1341,9 +1341,9 @@ async def retrieve_arrays( | |
| async def retrieve_arrays( | ||
| self, | ||
| *, | ||
| id: None | int | DatapointsQuery | Sequence[int | DatapointsQuery] = None, | ||
| external_id: None | str | DatapointsQuery | SequenceNotStr[str | DatapointsQuery] = None, | ||
| instance_id: None | NodeId | DatapointsQuery | Sequence[NodeId | DatapointsQuery] = None, | ||
| id: None | int | DatapointsQuery | Iterable[int | DatapointsQuery] = None, | ||
| external_id: None | str | DatapointsQuery | Iterable[str | DatapointsQuery] = None, | ||
| instance_id: None | NodeId | DatapointsQuery | Iterable[NodeId | DatapointsQuery] = None, | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -1367,9 +1367,9 @@ async def retrieve_arrays( | |
| `status codes. <https://docs.cognite.com/dev/concepts/reference/status_codes/>`_ | ||
|
|
||
| Args: | ||
| id (None | int | DatapointsQuery | Sequence[int | DatapointsQuery]): Id, dict (with id) or (mixed) sequence of these. See examples below. | ||
| external_id (None | str | DatapointsQuery | SequenceNotStr[str | DatapointsQuery]): External id, dict (with external id) or (mixed) sequence of these. See examples below. | ||
| instance_id (None | NodeId | DatapointsQuery | Sequence[NodeId | DatapointsQuery]): Instance id or sequence of instance ids. | ||
| id (None | int | DatapointsQuery | Iterable[int | DatapointsQuery]): Id, DatapointsQuery or (mixed) iterable of these. If a dict is passed, its keys will be used as ids. See examples below. | ||
| external_id (None | str | DatapointsQuery | Iterable[str | DatapointsQuery]): External id, DatapointsQuery or (mixed) iterable of these. If a dict is passed, its keys will be used as external_ids. See examples below. | ||
| instance_id (None | NodeId | DatapointsQuery | Iterable[NodeId | DatapointsQuery]): Instance id, DatapointsQuery or (mixed) iterable of these. If a dict is passed, its keys will be used as instance_ids. | ||
| start (int | str | datetime.datetime | None): Inclusive start. Default: 1970-01-01 UTC. | ||
| end (int | str | datetime.datetime | None): Exclusive end. Default: "now" | ||
| aggregates (Aggregate | str | list[Aggregate | str] | None): Single aggregate or list of aggregates to retrieve. Available options: ``average``, ``continuous_variance``, ``count``, ``count_bad``, ``count_good``, ``count_uncertain``, ``discrete_variance``, ``duration_bad``, ``duration_good``, ``duration_uncertain``, ``interpolation``, ``max``, ``max_datapoint``, ``min``, ``min_datapoint``, ``step_interpolation``, ``sum`` and ``total_variation``. Default: None (raw datapoints returned) | ||
|
|
@@ -1470,9 +1470,9 @@ async def retrieve_arrays( | |
| async def retrieve_dataframe( | ||
| self, | ||
| *, | ||
| id: None | int | DatapointsQuery | Sequence[int | DatapointsQuery] = None, | ||
| external_id: None | str | DatapointsQuery | SequenceNotStr[str | DatapointsQuery] = None, | ||
| instance_id: None | NodeId | DatapointsQuery | Sequence[NodeId | DatapointsQuery] = None, | ||
| id: None | int | DatapointsQuery | Iterable[int | DatapointsQuery] = None, | ||
| external_id: None | str | DatapointsQuery | Iterable[str | DatapointsQuery] = None, | ||
| instance_id: None | NodeId | DatapointsQuery | Iterable[NodeId | DatapointsQuery] = None, | ||
| start: int | str | datetime.datetime | None = None, | ||
| end: int | str | datetime.datetime | None = None, | ||
| aggregates: Aggregate | str | list[Aggregate | str] | None = None, | ||
|
|
@@ -1500,9 +1500,9 @@ async def retrieve_dataframe( | |
| For many more usage examples, check out the :py:meth:`~DatapointsAPI.retrieve` method which accepts exactly the same arguments. | ||
|
|
||
| Args: | ||
| id (None | int | DatapointsQuery | Sequence[int | DatapointsQuery]): Id, DatapointsQuery or (mixed) sequence of these. See examples. | ||
| external_id (None | str | DatapointsQuery | SequenceNotStr[str | DatapointsQuery]): External id, DatapointsQuery or (mixed) sequence of these. See examples. | ||
| instance_id (None | NodeId | DatapointsQuery | Sequence[NodeId | DatapointsQuery]): Instance id, DatapointsQuery or (mixed) sequence of these. See examples. | ||
| id (None | int | DatapointsQuery | Iterable[int | DatapointsQuery]): Id, DatapointsQuery or (mixed) iterable of these. If a dict is passed, its keys will be used as ids. See examples. | ||
| external_id (None | str | DatapointsQuery | Iterable[str | DatapointsQuery]): External id, DatapointsQuery or (mixed) iterable of these. If a dict is passed, its keys will be used as external_ids. See examples. | ||
| instance_id (None | NodeId | DatapointsQuery | Iterable[NodeId | DatapointsQuery]): Instance id, DatapointsQuery or (mixed) iterable of these. If a dict is passed, its keys will be used as instance_ids. See examples. | ||
| start (int | str | datetime.datetime | None): Inclusive start. Default: 1970-01-01 UTC. | ||
| end (int | str | datetime.datetime | None): Exclusive end. Default: "now" | ||
| aggregates (Aggregate | str | list[Aggregate | str] | None): Single aggregate or list of aggregates to retrieve. Available options: ``average``, ``continuous_variance``, ``count``, ``count_bad``, ``count_good``, ``count_uncertain``, ``discrete_variance``, ``duration_bad``, ``duration_good``, ``duration_uncertain``, ``interpolation``, ``max``, ``max_datapoint``, ``min``, ``min_datapoint``, ``step_interpolation``, ``sum`` and ``total_variation``. Default: None (raw datapoints returned) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.