'Computes the settings inheritance and sets up the cache.
modulestore: the module store that can be used to retrieve additional
modules
course_entry: the originally fetched enveloped course_structure w/ branch and course id info.
Callers to _load_item provide an override but that function ignores the provided structure and
only looks at the branch and course id
module_data: a dict mapping Location -> json that was cached from the
underlying modulestore'

@contract(course_entry=CourseEnvelope)
def __init__(self, modulestore, course_entry, default_class, module_data, lazy, **kwargs):

    if course_entry.course_key.course:
        root = (((modulestore.fs_root / course_entry.course_key.org) / course_entry.course_key.course) / course_entry.course_key.run)
    else:
        root = (modulestore.fs_root / str(course_entry.structure['_id']))
    root.makedirs_p()
    id_manager = SplitMongoIdManager(self)
    kwargs.setdefault('id_reader', id_manager)
    kwargs.setdefault('id_generator', id_manager)
    super(CachingDescriptorSystem, self).__init__(field_data=None, load_item=self._load_item, resources_fs=OSFS(root), **kwargs)
    self.modulestore = modulestore
    self.course_entry = course_entry
    self.course_id = course_entry.course_key
    self.lazy = lazy
    self.module_data = module_data
    self.default_class = default_class
    self.local_modules = {}
    self._services['library_tools'] = LibraryToolsService(modulestore)
