-
Notifications
You must be signed in to change notification settings - Fork 27
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
Fix data modeling data type Enum dumping #2091
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
__version__ = "7.72.0" | ||
__version__ = "7.72.1" | ||
|
||
__api_subversion__ = "20230101" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
PropertyType, | ||
) | ||
from cognite.client.data_classes.data_modeling.ids import ContainerId | ||
from cognite.client.utils._text import convert_all_keys_to_camel_case_recursive | ||
from cognite.client.utils._text import convert_all_keys_to_camel_case_recursive, to_camel_case | ||
|
||
if TYPE_CHECKING: | ||
from cognite.client import CogniteClient | ||
|
@@ -276,8 +276,8 @@ def dump(self, camel_case: bool = True) -> dict[str, str | dict]: | |
output["immutable"] = self.immutable | ||
for key in ["nullable", "auto_increment", "name", "default_value", "description"]: | ||
if (value := getattr(self, key)) is not None: | ||
output[key] = value | ||
return convert_all_keys_to_camel_case_recursive(output) if camel_case else output | ||
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. This is a dangerous function. Should we have a task to remove it? Or do it have any good use cases? 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. Agreed, I had the same thought! |
||
output[to_camel_case(key) if camel_case else key] = value | ||
return output | ||
|
||
|
||
@dataclass(frozen=True) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
from cognite.client import _cognite_client, config, credentials | ||
from cognite.client._api import ( | ||
ai, | ||
assets, | ||
data_sets, | ||
datapoints, | ||
|
@@ -135,3 +136,8 @@ def test_hosted_extractors(self): | |
def test_postgres_gateway(self): | ||
run_docstring_tests(postgres_gateway_users) | ||
run_docstring_tests(postgres_gateway_tables) | ||
|
||
def test_ai(self): | ||
run_docstring_tests(ai) | ||
run_docstring_tests(ai.tools) | ||
run_docstring_tests(ai.tools.documents) | ||
Comment on lines
+140
to
+143
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. Have they forgotten to do it? 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. They did, and I missed it in review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes #42190b2