Skip to content

Commit

Permalink
deprecate Query.load_yaml in favour of Query.load (#1860)
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonvt authored Jul 23, 2024
1 parent 5658824 commit c05587f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cognite/client/data_classes/data_modeling/query.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import warnings
from abc import ABC, abstractmethod
from collections import UserDict
from dataclasses import dataclass, field
Expand All @@ -21,7 +22,6 @@
)
from cognite.client.data_classes.data_modeling.views import View
from cognite.client.data_classes.filters import Filter
from cognite.client.utils._importing import local_import

if TYPE_CHECKING:
from cognite.client import CogniteClient
Expand Down Expand Up @@ -152,8 +152,11 @@ def dump(self, camel_case: bool = True) -> dict[str, Any]:

@classmethod
def load_yaml(cls, data: str) -> Query:
yaml = local_import("yaml")
return cls.load(yaml.safe_load(data))
warnings.warn(
"Query.load_yaml is deprecated and will be removed after Oct 2024, please use Query.load",
UserWarning,
)
return cls.load(data)

@classmethod
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self:
Expand Down

0 comments on commit c05587f

Please sign in to comment.