'Set the components data of a tensor object/expression.
Components data are transformed to the all-contravariant form and stored
with the corresponding ``TensorHead`` object. If a ``TensorHead`` object
cannot be uniquely identified, it will raise an error.'

def __setitem__(self, key, value):

    data = _TensorDataLazyEvaluator.parse_data(value)
    self._check_permutations_on_data(key, data)
    if (not isinstance(key, (TensorHead, TensorIndexType))):
        (key, data) = self._assign_data_to_tensor_expr(key, data)
    if isinstance(key, TensorHead):
        for (dim, indextype) in zip(data.shape, key.index_types):
            if (indextype.data is None):
                raise ValueError('index    type    {}    has    no    components    data    associated    (needed    to    raise/lower    index)'.format(indextype))
            if (indextype.dim is None):
                continue
            if (dim != indextype.dim):
                raise ValueError('wrong    dimension    of    ndarray')
    self._substitutions_dict[key] = data
