-
Notifications
You must be signed in to change notification settings - Fork 127
Skip unallowed common properties provided by ObjectFactory #606
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 | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -83,6 +83,13 @@ def create(self, cls, **kwargs): | |||||||
| # Use self.defaults as the base, but update with any explicit args | ||||||||
| # provided by the user. | ||||||||
| properties = copy.deepcopy(self._defaults) | ||||||||
|
|
||||||||
| # SCOs do not have these common properties provided by the factory | ||||||||
| if "observables" in cls.__module__: | ||||||||
| properties.pop("created", None) | ||||||||
| properties.pop("created_by_ref", None) | ||||||||
| properties.pop("external_references", None) | ||||||||
|
||||||||
| properties.pop("external_references", None) | |
| properties.pop("external_references", None) | |
| properties.pop("modified", None) |
Copilot
AI
Jan 19, 2026
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.
The new functionality for filtering out properties when creating observables lacks test coverage. Consider adding a test that creates an observable (like DomainName) using an ObjectFactory initialized with created_by_ref or created properties to ensure these properties are correctly filtered out.
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.
The module name checking approach using string matching is fragile and could break if module structure changes. Consider using a more robust approach like checking if the class is a subclass of _Observable. You would need to import _Observable from .base and then use:
issubclass(cls, _Observable)instead of"observables" in cls.__module__.