-
Notifications
You must be signed in to change notification settings - Fork 5
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
[NEAT-745] 🫵 feat; Support setting reference model directly #982
Conversation
doctrino
commented
Feb 7, 2025
•
edited
Loading
edited
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
if include_reference is not False: | ||
if include_reference is True and self._state.last_reference is not None: | ||
ref_rules: InformationRules | DMSRules | None = self._state.last_reference | ||
elif include_reference is True: | ||
ref_rules = None | ||
else: | ||
if not self._state.client: | ||
raise NeatSessionError("No client provided!") | ||
ref_rules = None | ||
with catch_issues() as issues: | ||
ref_read = DMSImporter.from_data_model_id(self._state.client, include_reference).to_rules() | ||
if ref_read.rules is not None: | ||
ref_rules = ref_read.rules.as_verified_rules() | ||
if ref_rules is None or issues.has_errors: | ||
issues.action = f"Read {include_reference}" | ||
return issues | ||
if ref_rules is not None: | ||
prefix = "Ref" | ||
reference_rules_with_prefix = self._state.last_reference, prefix | ||
if ( | ||
isinstance(ref_rules.metadata, DMSMetadata) | ||
and ref_rules.metadata.as_data_model_id() in COGNITE_MODELS | ||
): | ||
prefix = "CDM" | ||
reference_rules_with_prefix = ref_rules, prefix |
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.
This is something very special for writing to Excel, so kept the logic here.
@@ -35,17 +39,18 @@ def __init__(self, state: SessionState, verbose: bool) -> None: | |||
def excel( | |||
self, | |||
io: Any, | |||
include_reference: bool = True, | |||
include_reference: bool | DataModelIdentifier = True, |
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.
I think this is small feature which does not have to be behind an alpha flag.