Skip to content

Commit

Permalink
docs: fix import statements in cognite/client/_api/assets.py (#1749)
Browse files Browse the repository at this point in the history
Co-authored-by: Håkon V. Treider <[email protected]>
Co-authored-by: cognite-bulldozer[bot] <51074376+cognite-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 9, 2024
1 parent 29edadc commit 4ad16ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions cognite/client/_api/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,12 +481,12 @@ def aggregate_unique_values(
Get the different labels with count used for assets created after 2020-01-01 in your CDF project:
>>> from cognite.client import CogniteClient
>>> from cognite.client.data_classes import filters as flt
>>> from cognite.client.data_classes import filters
>>> from cognite.client.data_classes.assets import AssetProperty
>>> from cognite.client.utils import timestamp_to_ms
>>> from datetime import datetime
>>> client = CogniteClient()
>>> created_after_2020 = flt.Range(AssetProperty.created_time, gte=timestamp_to_ms(datetime(2020, 1, 1)))
>>> created_after_2020 = filters.Range(AssetProperty.created_time, gte=timestamp_to_ms(datetime(2020, 1, 1)))
>>> result = client.assets.aggregate_unique_values(AssetProperty.labels, advanced_filter=created_after_2020)
>>> print(result.unique)
Expand All @@ -495,11 +495,11 @@ def aggregate_unique_values(
>>> from cognite.client import CogniteClient
>>> from cognite.client.data_classes.assets import AssetProperty
>>> from cognite.client.data_classes import aggregations as aggs
>>> from cognite.client.data_classes import filters as flt
>>> from cognite.client.data_classes import aggregations
>>> from cognite.client.data_classes import filters
>>> client = CogniteClient()
>>> not_test = aggs.Not(aggs.Prefix("test"))
>>> created_after_2020 = flt.Range(AssetProperty.last_updated_time, gte=timestamp_to_ms(datetime(2020, 1, 1)))
>>> not_test = aggregations.Not(aggregations.Prefix("test"))
>>> created_after_2020 = filters.Range(AssetProperty.last_updated_time, gte=timestamp_to_ms(datetime(2020, 1, 1)))
>>> result = client.assets.aggregate_unique_values(AssetProperty.labels, advanced_filter=created_after_2020, aggregate_filter=not_test)
>>> print(result.unique)
Expand Down Expand Up @@ -584,7 +584,7 @@ def create(self, asset: Asset | AssetWrite | Sequence[Asset] | Sequence[AssetWri
Create asset with label::
>>> from cognite.client import CogniteClient
>>> from cognite.client.data_classes import Asset, Label
>>> from cognite.client.data_classes import AssetWrite, Label
>>> client = CogniteClient()
>>> asset = AssetWrite(name="my_pump", labels=[Label(external_id="PUMP")])
>>> res = client.assets.create(asset)
Expand Down
3 changes: 2 additions & 1 deletion cognite/client/_api/extractionpipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def update(
Update an extraction pipeline that you have fetched. This will perform a full update of the extraction pipeline::
>>> from cognite.client import CogniteClient
>>> from cognite.client.data_classes import ExtractionPipelineUpdate
>>> client = CogniteClient()
>>> update = ExtractionPipelineUpdate(id=1)
>>> update.description.set("Another new extpipe")
Expand Down Expand Up @@ -313,7 +314,7 @@ def list(
>>> from cognite.client import CogniteClient
>>> client = CogniteClient()
>>> runsList = client.extraction_pipelines.runs.list(external_id="test ext id", statuses=["seen"], statuslimit=5)
>>> runs_list = client.extraction_pipelines.runs.list(external_id="test ext id", statuses=["seen"], limit=5)
Get all failed pipeline runs in the last 24 hours for pipeline 'extId':
Expand Down

0 comments on commit 4ad16ef

Please sign in to comment.