-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
If certain attributes are missing from an action's attributes.yaml, the returned type will be a one of expipe's class instances instead of NoneType.
For example, if entities is not specified in attributes.yaml, then
>>> Action.entities
Nonebut
>>>type(Action.entities)
expipe.core.PropertyListThis prevents comparisons like
if Action.entities is None:
...In the case of missing attributes, I would expect the returned type to be the proper Python NoneType.
Relevant part in the code for the .entities attribute:
Lines 489 to 492 in baa6efd
| @property | |
| def entities(self): | |
| return PropertyList(self._backend.attributes, 'entities', dtype=str, unique=True, | |
| data=self._backend.attributes.get('entities')) |
Note that self._backend.attributes.get('entities') is the proper NoneType if the attribute is missing, so the logic of the return could utilize this; for example
@property
def entities(self):
data = self._backend.attributes.get("entities")
if data is not None:
return PropertyList(self._backend.attributes, "entities", dtype=str, unique=True, data=data)Metadata
Metadata
Assignees
Labels
No labels