In [1]:
import json, os, sys
from collections import namedtuple

In [11]:
class RawFile(object):
    def __init__(self, raw):
        self.id = raw['id']
        self.entry = raw.get('entry', False)
        self.deps = {id_: rel_path for id, rel_path in raw["deps"].iteritems}
        self.source = raw['source']
        self.refs = {}

class RawBundle(object):
    def __init__(self, raw_file_list):
        files_by_id = {f['id']: File(f) for f in raw_file_list}
        for file_id, file_ in files_by_id.itervalues():
            for dep_id, dep_path in file_.deps.iteritems():
                files_by_id[dep_id][file_id] = dep_path
        entry = get_entry(files_by_id)

    def __getitem__(self, key):
        return files_by_id(key)

In [4]:
with open("unbundled/artist.spa/unbundled.json") as f:
    bundle = json.loads(f.read())

In [9]:
rb = RawBundle()


Out[9]:
{u'deps', u'entry', u'id', u'source'}

In [ ]: