

def _get_base_value_unwrapped_as_list(self, entity):
    'Like _get_base_value(), but always returns a list.\n\n    Returns:\n      A new list of unwrapped base values.  For an unrepeated\n      property, if the value is missing or None, returns [None]; for a\n      repeated property, if the original value is missing or None or\n      empty, returns [].\n    '
    wrapped = self._get_base_value(entity)
    if self._repeated:
        if (wrapped is None):
            return []
        assert isinstance(wrapped, list)
        return [w.b_val for w in wrapped]
    else:
        if (wrapped is None):
            return [None]
        assert isinstance(wrapped, _BaseValue)
        return [wrapped.b_val]

dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/model.py Property._get_base_value_unwrapped_as_list/original