'Find any courseware.models objects that are needed by any descriptor
in descriptors. Attempts to minimize the number of queries to the database.
Note: Only modules that have store_state = True or have shared
state will have a StudentModule.
Arguments
descriptors: A list of XModuleDescriptors.
course_id: The id of the current course
user: The user for which to cache data
asides: The list of aside types to load, or None to prefetch no asides.
read_only: We should not perform writes (they become a no-op).'

def __init__(self, descriptors, course_id, user, asides=None, read_only=False):

    if (asides is None):
        self.asides = []
    else:
        self.asides = asides
    assert isinstance(course_id, CourseKey)
    self.course_id = course_id
    self.user = user
    self.read_only = read_only
    self.cache = {Scope.user_state: UserStateCache(self.user, self.course_id), Scope.user_info: UserInfoCache(self.user), Scope.preferences: PreferencesCache(self.user), Scope.user_state_summary: UserStateSummaryCache(self.course_id)}
    self.scorable_locations = set()
    self.add_descriptors_to_cache(descriptors)
