Add setter-functions for object attributes that consist of `NamespaceSet`s
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start with the AssetAdministrationShell constructor in basyx/aas/model/aas.py around the ConceptDictionary parameter, then inspect NamespaceSet and ObjectStore handling. Review linked pull request #619 before changing anything. Done means assignments to NamespaceSet-backed attributes no longer leave invalid iterable values that later fail during ObjectStore iteration.
Written by the indexing model from the issue text.
Description
When instantiating an AssetAdministrationShell-object, we hand over ConceptDictionarys in any kind of Iterable (See here)
def __init__(self,
...
concept_dictionary: Iterable[concept.ConceptDictionary] = (),
...):
However, internally, we create a NamespaceSet containing these ConceptDictionarys in order to be able to resolve them later:
self.concept_dictionary: base.NamespaceSet[concept.ConceptDictionary] = \
base.NamespaceSet(self, concept_dictionary)
Now, if a user were to only look at the initialization parameters, and wanted to add a ConceptDictionary later, after initalization, they could theoretically assume, they could set it like this:
my_aas.concept_dictionary = [my_concept_dictionary]
This would have terrible results when iterating over ObjectStores containing these objects, since suddenly, we'd get the (not very helpful) error:
AttributeError: 'list' object has no attribute 'update_nss_from'
This obviously points nowhere in the right direction.
I have the suspicion, that this is not the only time, where such a problem may arise. How can we restrrict the user from making such a mistake in the first place? Should we write getter and setter functions for these kinds of attributes? On the other hand, maybe this is something to be checked by the ObjectStore, when adding an item to it?
- Dominant language
- Python
- Stars
- 102
- Forks
- 52
- Avg merge
- 20d 17h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from eclipse-basyx/basyx-python-sdk
-
bug high priority
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
bug high priority
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
eclipse-basyx/basyx-python-sdk#634 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug high priority
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
All issues in eclipse-basyx/basyx-python-sdk
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stephrobert/dsoxlab#238 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
sublimehq/package_control#1780 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
nwg-piotr/nwg-displays#145 ·