def set_initial_sources(snapshot):
    single, plural = get_sourced_attributes(snapshot)
    for attr in single:
        # We set the attribute source to be itself.
        setattr(snapshot, '{0}_source'.format(attr), snapshot)

    for attr in plural:
        # We have to assume that it's a dict
        attrs = getattr(snapshot, attr, {})
        sources = getattr(snapshot, '{0}_sources', {})
        for k in attrs:
            sources[k] = snapshot.pk

        setattr(snapshot, '{0}_sources'.format(attr), sources)

    return snapshot
Init
dataset/ETHPy150Open buildingenergy/buildingenergy-platform/seed/models.py/set_initial_sources--crossover with--dataset/ETHPy150Open DTVD/rainbowstream/rainbowstream/interactive.py/RainbowCompleter.__init__