Returns the estimated value of the class attribute for the given
        record.
426745
def predict(self, record, depth=0):
        
        
        # Check if we're ready to predict.
        if not self.ready_to_predict:
            raise NodeNotReadyToPredict
        
        # Lookup attribute value.
        attr_value = self._get_attribute_value_for_node(record)
        
        # Propagate decision to leaf node.
        if self.attr_name:
            if attr_value in self._branches:
                try:
                    return self._branches[attr_value].predict(record, depth=depth+1)
                except NodeNotReadyToPredict:
                    #TODO:allow re-raise if user doesn't want an intermediate prediction?
                    pass
                
        # Otherwise make decision at current node.
        if self.attr_name:
            if self._tree.data.is_continuous_class:
                return self._attr_value_cdist[self.attr_name][attr_value].copy()
            else:
#                return self._class_ddist.copy()
                return self.get_value_ddist(self.attr_name, attr_value)
        elif self._tree.data.is_continuous_class:
            # Make decision at current node, which may be a true leaf node
            # or an incomplete branch in a tree currently being built.
            assert self._class_cdist is not None
            return self._class_cdist.copy()
        else:
            return self._class_ddist.copy()
21731
def get_value_for_datastore(self, model_instance, cached=False):
        """"""
        value = getattr(model_instance, self._attr_name(), None)
        if not cached:
            value = getattr(model_instance, self.property_name).keys()
            setattr(model_instance, self._attr_name(), value)
        return value
414553
def from_record(cls, record):
        
        if not isinstance(record, pymarc.Record):
            raise TypeError('record must be of type pymarc.Record')
        record.__class__ = Record
        return record
120981
def RegisterRecordType(cls, record_class):
        

        record_type = record_class.MatchType()
        if record_type not in UpdateRecord.KNOWN_CLASSES:
            UpdateRecord.KNOWN_CLASSES[record_type] = []

        UpdateRecord.KNOWN_CLASSES[record_type].append(record_class)
836828
private ClassRecord getClassRecord(Integer classId) {
		if (!this.classRecords.containsKey(classId)) {
			ClassRecord classRecord = new ClassRecord();
			this.classRecords.put(classId, classRecord);
			return classRecord;
		} else {
			return this.classRecords.get(classId);
		}
	}
719365
def _guess_record(self, rtype, name=None, content=None):
        """"""
        records = self._list_records_internal(
            identifier=None, rtype=rtype, name=name, content=content)
        if len(records) == 1:
            return records[0]
        if len(records) > 1:
            raise Exception(
                'Identifier was not provided and several existing '
                'records match the request for {0}/{1}'.format(rtype, name))
        raise Exception(
            'Identifier was not provided and no existing records match '
            'the request for {0}/{1}'.format(rtype, name))
1040935
public void addClass (ClassRecord record)
    {
        // validate the class id
        if (record.classId > 255) {
            log.warning("Refusing to add class; classId > 255 " + record + ".");
        } else {
            _classes.put(record.classId, record);
        }
    }
1144233
public ClassInfo readFieldClass()
    {
        try   {
            String strBaseClass = null;
            String strFieldClass = "Error-no based records";
            Record recClassInfo = this.getMainRecord();
            FieldData recFieldData = (FieldData)this.getRecord(FieldData.FIELD_DATA_FILE);
            String strRecordClass = recFieldData.getField(FieldData.FIELD_FILE_NAME).getString();
            String strFieldName = recFieldData.getField(FieldData.FIELD_NAME).getString();
            String strBaseFieldName = recFieldData.getField(FieldData.BASE_FIELD_NAME).getString();
            m_BasedFieldHelper.getBasedField(recFieldData, strRecordClass, strFieldName, strBaseFieldName);  // Get the field this is based on
            strFieldClass = recFieldData.getField(FieldData.FIELD_CLASS).getString();
            m_recClassInfo2.getField(ClassInfo.CLASS_NAME).setString(strFieldClass);
            m_recClassInfo2.setKeyArea(ClassInfo.CLASS_NAME_KEY);
            boolean bClassInfoExists = m_recClassInfo2.seek("=");
            if (bClassInfoExists)
                strBaseClass = m_recClassInfo2.getField(ClassInfo.BASE_CLASS_NAME).getString();  // This will probally be the base class
            String strInitField = this.getInitField(recFieldData, false, false);
            if (strInitField.length() != 0)
            {
                strBaseClass = strFieldClass;
                strFieldClass = recFieldData.getField(FieldData.FIELD_NAME).getString();
                strFieldClass = strRecordClass + "_" + strFieldClass;
                m_recClassInfo2.addNew(); // Clear info
                m_recClassInfo2.getField(ClassInfo.CLASS_NAME).setString(strFieldClass);
                m_recClassInfo2.getField(ClassInfo.BASE_CLASS_NAME).setString(strBaseClass);
                m_recClassInfo2.getField(ClassInfo.CLASS_PACKAGE).setString(this.getPackage(CodeType.THICK)); // Manual classes are from the same package
                m_recClassInfo2.getField(ClassInfo.CLASS_SOURCE_FILE).moveFieldToThis(recClassInfo.getField(ClassInfo.CLASS_SOURCE_FILE));
                m_recClassInfo2.getField(ClassInfo.CLASS_PROJECT_ID).moveFieldToThis(recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID));
                return m_recClassInfo2;            // Yes, this field has a unique class
            }
            if (bClassInfoExists)
//?                if (recClassInfo.getField(ClassInfo.CLASS_SOURCE_FILE).getString().equalsIgnoreCase(m_recClassInfo2.getField(ClassInfo.CLASS_SOURCE_FILE).toString()))
                    return m_recClassInfo2;        // Yes, this field has a unique class
//            recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strFieldClass);
//            recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).initField(false);        // Blank base class = other class
        } catch (DBException ex)   {
            ex.printStackTrace();
        }
        return null;           // No, this field uses a different class
    }
394099
def _parse_entry_record(self, lines):
        """"""
        dn = None
        entry = OrderedDict()

        for line in lines:
            attr_type, attr_value = self._parse_attr(line)

            if attr_type == 'dn':
                self._check_dn(dn, attr_value)
                dn = attr_value
            elif attr_type == 'version' and dn is None:
                pass  # version = 1
            else:
                if dn is None:
                    self._error('First line of record does not start '
                        'with "dn:": %s' % attr_type)
                if attr_value is not None and \
                         attr_type.lower() not in self._ignored_attr_types:
                    if attr_type in entry:
                        entry[attr_type].append(attr_value)
                    else:
                        entry[attr_type] = [attr_value]

        return dn, entry
388674
private ClassRecord getClassRecord(EntityIdValue entityIdValue) {
		if (!this.classRecords.containsKey(entityIdValue)) {
			ClassRecord classRecord = new ClassRecord();
			this.classRecords.put(entityIdValue, classRecord);
			return classRecord;
		} else {
			return this.classRecords.get(entityIdValue);
		}
	}
947414
def read_data(record, bytes, attribute_set)
      attribute, length = attribute_set
      content = bytes.slice!(0, length).pack('C*')

      if attribute == :data && record.type_format == BINARY
        content = StringIO.new(content)
      end

      record.send "#{attribute.to_s}=", content
      bytes.slice!(0, 4 - (length & 3)) if (length & 3) != 0
    end
751170
public ColorRecord getColorRecord (String className, String colorName)
    {
        ClassRecord record = getClassRecord(className);
        if (record == null) {
            log.warning("Requested unknown color class",
                "className", className, "colorName", colorName, new Exception());
            return null;
        }

        int colorId = 0;
        try {
            colorId = record.getColorId(colorName);
        } catch (ParseException pe) {
            log.info("Error getting color record by name", "error", pe);
            return null;
        }

        return record.colors.get(colorId);
    }
22118
def get_record(cls, id_, with_deleted=False):
        
        with db.session.no_autoflush:
            query = RecordMetadata.query.filter_by(id=id_)
            if not with_deleted:
                query = query.filter(RecordMetadata.json != None)  # noqa
            obj = query.one()
            return cls(obj.json, model=obj)
791011
def _evaluate(self):
        """"""

        retrieved_records = SortedDict()

        for record_id, record in six.iteritems(self._elements):
            if record is self._field._unset:
                # Record has not yet been retrieved, get it
                try:
                    record = self.target_app.records.get(id=record_id)
                except SwimlaneHTTP400Error:
                    # Record appears to be orphaned, don't include in set of elements
                    logger.debug("Received 400 response retrieving record '{}', ignoring assumed orphaned record")
                    continue

            retrieved_records[record_id] = record

        self._elements = retrieved_records

        return self._elements.values()
656404
private BasicDBObject identifyFieldsToRetrieve(Class<T> entityClass, String viewOfClassName) {
        if (viewOfClassName == null) {
            return null;     // Null is equivalent to retrieving all fields
        }

        BasicDBObject fields = new BasicDBObject();

        try {
            determineFieldsToRetrieve(entityClass, Class.forName(viewOfClassName), "", fields);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }

        if (optimisticLockEnabled) {
            fields.put(OPTIMISTIC_LOCK_VERSION_FIELD, 1);
        }
        
        if (accessControlContextProvider != null) {
            fields.put(ACCESS_CONTROL_FIELD, 1);
        }
        
        if (fields.containsField("id")) {
            fields.remove("id"); // Included by default, no need to specify
        } else {
            fields.put(ID_FIELD, 0); // Need to explicitly exclude it
        }

        return fields;
    }
413276
def convert(cls, record):
        
        if isinstance(record, list):
            return [cls._convert(r) for r in record]
        else:
            return [cls._convert(record)]
586670
public int handleGetRawRecordData(Rec record)
    {
        int iErrorCode = Constant.NORMAL_RETURN;
            
        iErrorCode = super.handleGetRawRecordData(record);
        
        if (iErrorCode == Constant.NORMAL_RETURN)
        {
            if (m_messageDataDescChildren != null)
            {
                for (String strKey : m_messageDataDescChildren.keySet())
                {
                    iErrorCode = m_messageDataDescChildren.get(strKey).handleGetRawRecordData(record);
                    if (iErrorCode != Constant.NORMAL_RETURN)
                        break;
                }
            }
        }

        return iErrorCode;
    }