Update classroom and returns a list of errored students
325170
def update_classroom(self, course, classroomid, new_data):
        
        student_list, tutor_list, other_students, _ = self.get_user_lists(course, classroomid)

        # Check tutors
        new_data["tutors"] = [tutor for tutor in map(str.strip, new_data["tutors"]) if tutor in tutor_list]

        students, groups, errored_students = [], [], []

        new_data["students"] = map(str.strip, new_data["students"])

        # Check the students
        for student in new_data["students"]:
            if student in student_list:
                students.append(student)
            else:
                if student in other_students:
                    # Remove user from the other classroom
                    self.database.classrooms.find_one_and_update({"courseid": course.get_id(), "groups.students": student},
                                                                 {"$pull": {"groups.$.students": student, "students": student}})
                    self.database.classrooms.find_one_and_update({"courseid": course.get_id(), "students": student}, {"$pull": {"students": student}})
                    students.append(student)
                else:
                    # Check if user can be registered
                    user_info = self.user_manager.get_user_info(student)
                    if user_info is None or student in tutor_list:
                        errored_students.append(student)
                    else:
                        students.append(student)

        removed_students = [student for student in student_list if student not in new_data["students"]]
        self.database.classrooms.find_one_and_update({"courseid": course.get_id(), "default": True},
                                                     {"$push": {"students": {"$each": removed_students}}})

        new_data["students"] = students

        # Check the groups
        for group in new_data["groups"]:
            group["students"] = [student for student in map(str.strip, group["students"]) if student in new_data["students"]]
            if len(group["students"]) <= group["size"]:
                groups.append(group)

        new_data["groups"] = groups

        classroom = self.database.classrooms.find_one_and_update(
            {"_id": ObjectId(classroomid)},
            {"$set": {"description": new_data["description"],
                      "students": students, "tutors": new_data["tutors"],
                      "groups": groups}}, return_document=ReturnDocument.AFTER)

        return classroom, errored_students
239269
def error
            error = (self[:error_upgrade] & 0b1111111)
            return nil if error == 0

            err = ::HttpParser.err_name(error)[4..-1] # HPE_ is at the start of all these errors
            klass = ERRORS[err.to_sym]
            err = "#{::HttpParser.err_desc(error)} (#{err})"
            return klass.nil? ? Error::UNKNOWN.new(err) : klass.new(err)
        end
564149
def get_errors(self):
        
        result = []
        while not self.errors.empty():  # pragma: no cover
            try:
                e = self.errors.get(False)
                result.append(e)
            except self.errors.Empty:
                continue
            self.errors.task_done()
        return result
1126912
def update_gradebook(self, *args, **kwargs):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.BinAdminSession.update_bin
        # OSID spec does not require returning updated catalog
        return Gradebook(
            self._provider_manager,
            self._get_provider_session('gradebook_admin_session').update_gradebook(*args, **kwargs),
            self._runtime,
            self._proxy)
131125
def no_new_errors(new_data, old_data, strict=False):
    
    success = True
    score = 0
    message = ''
    if new_data['errors'] > old_data['errors']:
        success = False
        message = "Failed, More errors than prior runs!({} > {})\n" \
                  "Average Score: {}".format(new_data['errors'],
                                             old_data['errors'],
                                             new_data['average'])
        score = -1

    return success, score, message
862926
def error_class_for_http_status(status):
    """"""
    try:
        return error_classes[status]
    except KeyError:
        def new_status_error(xml_response):
            if (status > 400 and status < 500):
                return UnexpectedClientError(status, xml_response)
            if (status > 500 and status < 600):
                return UnexpectedServerError(status, xml_response)
            return UnexpectedStatusError(status, xml_response)
        return new_status_error
1089187
def perform(self, store, count):
        
        self.count = count

        try:
            self.upgradeStore(store)
            print 'Upgrade complete'
        except errors.ItemUpgradeError as e:
            print 'Upgrader error:'
            e.originalFailure.printTraceback(file=sys.stdout)
            print self.errorMessageFormat % (
                e.oldType.typeName, e.storeID, e.oldType.schemaVersion,
                e.newType.schemaVersion)
1127139
def update_db(matches):
    
    for match in matches:
        try:
            match.save()
        except IntegrityError:
            args = (match.text_log_error_id, match.matcher_name, match.classified_failure_id)
            logger.warning(
                "Tried to create duplicate match for TextLogError %i with matcher %s and classified_failure %i",
                args,
            )
974394
private void makeErrorList( final DRLParser parser ) {
        for ( final DroolsParserException recogErr : lexer.getErrors() ) {
            final ParserError err = new ParserError( resource,
                                                     recogErr.getMessage(),
                                                     recogErr.getLineNumber(),
                                                     recogErr.getColumn() );
            this.results.add( err );
        }
        for ( final DroolsParserException recogErr : parser.getErrors() ) {
            final ParserError err = new ParserError( resource,
                                                     recogErr.getMessage(),
                                                     recogErr.getLineNumber(),
                                                     recogErr.getColumn() );
            this.results.add( err );
        }
    }
1316042
function updateCollected(err, result) {
            if (typeof result !== 'object') {
                collection.err = collection.err || new Error('Invalid acrhitect plugin format');
                return;
            }

            collection.err = collection.err || err;

            if (!collection.loaded) {
                collection.result = result;
                collection.loaded = true;
                return;
            }

            for (var i in result) {
                if (result.hasOwnProperty(i)) {
                    if (collection.result.hasOwnProperty(i)) {
                        collection.err = collection.err || new Error('Service overloading not supported: ' + i);
                        return;
                    }
                    collection.result[i] = result[i];
                }
            }
        }
679917
def _raise_bulk_write_error(full_result):
    
    if full_result["writeErrors"]:
        full_result["writeErrors"].sort(
            key=lambda error: error["index"])
    raise BulkWriteError(full_result)
104699
def helpful_error_list_get(lst, index):
    
    try:
        return lst[index]
    except IndexError:
        raise IndexError('Tried to access %r, length is only %r' % (index, len(lst)))
953232
def go_to_error(self, text):
        """"""
        match = get_error_match(to_text_string(text))
        if match:
            fname, lnb = match.groups()
            self.edit_script(fname, int(lnb))
1059071
def page(self, course, error="", post=False):
        
        users = sorted(list(self.user_manager.get_users_info(self.user_manager.get_course_registered_users(course, False)).items()),
                       key=lambda k: k[1][0] if k[1] is not None else "")

        users = OrderedDict(sorted(list(self.user_manager.get_users_info(course.get_staff()).items()),
                                   key=lambda k: k[1][0] if k[1] is not None else "") + users)

        user_data = OrderedDict([(username, {
            "username": username, "realname": user[0] if user is not None else "",
            "email": user[1] if user is not None else "", "total_tasks": 0,
            "task_grades": {"answer": 0, "match": 0}, "task_succeeded": 0, "task_tried": 0, "total_tries": 0,
            "grade": 0, "url": self.submission_url_generator(username)}) for username, user in users.items()])

        for username, data in self.user_manager.get_course_caches(list(users.keys()), course).items():
            user_data[username].update(data if data is not None else {})

        if "csv" in web.input():
            return make_csv(user_data)

        return self.template_helper.get_renderer().course_admin.student_list(course, list(user_data.values()), error, post)
991333
def inherit_errors(error_object)
      error_object = error_object.errors if error_object.respond_to?(:errors)

      error_object.each do |k, v|
        next if _error_ignores[k.to_sym]

        if respond_to?(k)
          errors.add(k, v)
        elsif _error_map[k.to_sym]
          errors.add(_error_map[k.to_sym], v)
        else
          errors.add(:base, error_object.full_message(k, v))
        end
      end

      false
    end
887124
def __safe_errback(self, room_data, err_condition, err_text):
        
        method = room_data.errback
        if method is not None:
            try:
                method(room_data.room, room_data.nick, err_condition, err_text)
            except Exception as ex:
                self.__logger.exception("Error calling back room creator: %s",
                                        ex)
1036768
def error(self, instance, value, error_class=None, extra=''):
        
        error_class = error_class or ValidationError
        prefix = 'The {} property'.format(self.__class__.__name__)
        if self.name != '':
            prefix = prefix + " '{}'".format(self.name)
        if instance is not None:
            prefix = prefix + ' of a {cls} instance'.format(
                cls=instance.__class__.__name__,
            )
        print_value = repr(value)
        if len(print_value) > 107:
            print_value = '{}  ...  {}'.format(
                print_value[:50], print_value[-50:]
            )
        message = (
            '{prefix} must be {info}. An invalid value of {val} {vtype} was '
            'specified.{extra}'.format(
                prefix=prefix,
                info=self.info or 'corrected',
                val=print_value,
                vtype=type(value),
                extra=' {}'.format(extra) if extra else '',
            )
        )
        if issubclass(error_class, ValidationError):
            raise error_class(message, 'invalid', self.name, instance)
        raise error_class(message)