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
but
>>>type(Action.entities)
expipe.core.PropertyList
This 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:
|
@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)
If certain attributes are missing from an action's
attributes.yaml, the returned type will be a one ofexpipe's class instances instead ofNoneType.For example, if
entitiesis not specified inattributes.yaml, thenbut
This prevents comparisons like
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
.entitiesattribute:expipe/expipe/core.py
Lines 489 to 492 in baa6efd
Note that
self._backend.attributes.get('entities')is the properNoneTypeif the attribute is missing, so the logic of the return could utilize this; for example