Make sure that both emotive and emotional records are actually able to
 express and/or receive emotions
5735
def ensure_valid_associated_record(association)
      value = send(association)
      predicate = :"#{association}?"

      if !value.class.respond_to?(predicate) || !value.class.send(predicate)
        errors.add association, I18n.t(:invalid, scope: [:errors, :messages])
      end
    end
89426
def records(self, data=None):
        
        if data:
            return self._session.post(
                self.__v1() + "/records", data=data).json()
        else:
            return self._session.get(self.__v1() + "/records").json()
639057
function formatRecordToString(record, style) {
  const parts = [];

  if (record.displayName) {
    parts.push(style(['gray-light'], record.displayName));
  } else if (record.key) {
    parts.push(style(['gray-light'], record.key));
  }

  if (record.datetime) {
    parts.push(style(['gray', 'bold'], record.datetime.toTimeString().split(' ')[0]));
    /* new Date().toFormat('HH24:MI:SS') */
  }

  let message = record.symbol || levelToSymbol[record.level];
  const styles = record.styles || levelToStyles[record.level];

  if (record.message) {
    if (message) {
      message += ` ${record.message}`;
    } else {
      message = record.message;
    }
  }

  if (message) {
    if (styles) {
      message = style(styles, message);
    }

    parts.push(message);
  }

  const formatRecordObject = function formatRecordObject(key, object, styles) {
    if (!object) {
      return;
    }

    const stringObject = formatObject(object, style, styles);

    if (!stringObject) {
      return;
    }

    parts.push(stringObject);
  };

  formatRecordObject('metadata', record.metadata, record.metadataStyles);
  formatRecordObject('extra', record.extra, undefined);
  formatRecordObject('context', record.context, undefined);
  return parts.join(' ');
}
431323
def emit (self, record):
        
        color = self.get_color(record)
        msg = self.format(record)
        if not hasattr(types, "UnicodeType"):
            # no unicode support
            self.stream.write("%s" % msg, color=color)
        else:
            try:
                self.stream.write("%s" % msg, color=color)
            except UnicodeError:
                self.stream.write("%s" % msg.encode("UTF-8"),
                                  color=color)
        self.stream.write(os.linesep)
        self.flush()
889489
def make_proper_dynamodb_record(record, force_shrink=False):
    
    # Get the initial blob and determine if it is too big for SNS/SQS:
    blob = json.dumps(record)
    size = math.ceil(sys.getsizeof(blob) / 1024)

    # If it is too big, then we need to send over a smaller blob to inform the recipient that it needs to go out and
    # fetch the item from the Historical table!
    if size >= 200 or force_shrink:
        deletion = False
        # ^^ However -- deletions need to be handled differently, because the Differ won't be able to find a
        # deleted record. For deletions, we will only shrink the 'OldImage', but preserve the 'NewImage' since that is
        # "already" shrunken.
        if record['dynamodb'].get('NewImage'):
            # Config will be empty if there was a deletion:
            if not (record['dynamodb']['NewImage'].get('configuration', {}) or {}).get('M'):
                deletion = True

        blob = json.dumps(shrink_blob(record, deletion))

    return blob
48709
function(record) {
        var i;
        if(record instanceof widget.Record) {
            for(i=0; i<this._records.length; i++) {
                if(this._records[i] && (this._records[i]._sId === record._sId)) {
                    return record;
                }
            }
        }
        else if(lang.isNumber(record)) {
            if((record > -1) && (record < this.getLength())) {
                return this._records[record];
            }
        }
        else if(lang.isString(record)) {
            for(i=0; i<this._records.length; i++) {
                if(this._records[i] && (this._records[i]._sId === record)) {
                    return this._records[i];
                }
            }
        }
        // Not a valid Record for this RecordSet
        return null;

    }
1032588
def emit(self, record):
        """"""
        try:
            msg = self.format(record)
            if isinstance(msg,unicode):
                if hasattr(self.stream, "encoding") and self.stream.encoding:
                    # Stream should take care of encoding, but do it explicitly to
                    # prevent bug in Python 2.6 - see
                    # https://stackoverflow.com/questions/8016236/python-unicode-handling-differences-between-print-and-sys-stdout-write
                    self.stream.write(msg.encode(self.stream.encoding))
                else:
                    self.stream.write(msg.encode(encoding))
            else:
                self.stream.write(msg)
            terminator = getattr(record, 'terminator', '\n')
            if terminator is not None:
                self.stream.write(terminator)
            self.flush()
        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            self.handleError(record)
863149
function _validateKinesisStreamEventRecord(record) {
  if (!record.kinesis) {
    throw new Error(`Missing kinesis property for Kinesis stream event record (${record.eventID})`);
  }
  if (!record.kinesis.data) {
    throw new Error(`Missing data property for Kinesis stream event record (${record.eventID})`);
  }
  if (!record.kinesis.partitionKey) {
    throw new Error(`Missing partitionKey property for Kinesis stream event record (${record.eventID})`);
  }
  if (!record.kinesis.sequenceNumber) {
    throw new Error(`Missing sequenceNumber property for Kinesis stream event record (${record.eventID})`);
  }
}
666263
def __record(self):
        """"""
        f = self.__getFileObj(self.dbf)
        recFmt = self.__recordFmt()
        recordContents = unpack(recFmt[0], f.read(recFmt[1]))
        if recordContents[0] != b(' '):
            # deleted record
            return None
        record = []
        for (name, typ, size, deci), value in zip(self.fields,
                                                                                                recordContents):
            if name == 'DeletionFlag':
                continue
            elif not value.strip():
                record.append(value)
                continue
            elif typ == "N":
                value = value.replace(b('\0'), b('')).strip()
                if value == b(''):
                    value = 0
                elif deci:
                    try:
                        value = float(value)
                    except ValueError:
                        value = 0
                else:
                    value = int(value)
            elif typ == b('D'):
                try:
                    y, m, d = int(value[:4]), int(value[4:6]), int(value[6:8])
                    value = [y, m, d]
                except:
                    value = value.strip()
            elif typ == b('L'):
                value = (value in b('YyTt') and b('T')) or \
                                        (value in b('NnFf') and b('F')) or b('?')
            else:
                value = u(value)
                value = value.strip()
            record.append(value)
        return record
1288121
def _create_record(self, rtype, name, content):
        """"""
        if not self._list_records(rtype, name, content):
            self._update_records([{}], {
                'type': rtype,
                'hostname': self._relative_name(name),
                'destination': content,
                'priority': self._get_lexicon_option('priority'),
            })
        LOGGER.debug('create_record: %s', True)
        return True
373794
def accept_record(self, record):
        
        with db.session.begin_nested():
            req = InclusionRequest.get(self.id, record.id)
            if req is None:
                raise InclusionRequestMissingError(community=self,
                                                   record=record)
            req.delete()
            self.add_record(record)
            self.last_record_accepted = datetime.utcnow()
320297
function applyRecords(path, records) {
  let numApply = 0;
  let maxSpecificity = 0;

  for (let i = 0; i < records.length; i = i + 1) {
    const record = records[i];
    if (record.path.test(path)) {
      numApply = numApply + 1;
      if (record.specificity > maxSpecificity) {
        maxSpecificity = record.specificity;
      }
    }
  }

  return {
    numApply,
    maxSpecificity
  }
}
1268624
function onStorageResponse (
  error, record, recordName, socketWrapper, onComplete, onError, options, context, metaData
) {
  if (error) {
    sendError(
      C.EVENT.RECORD_LOAD_ERROR,
      `error while loading ${recordName} from storage:${error.toString()}`,
      recordName,
      socketWrapper,
      onError,
      options,
      context,
      metaData
    )
  } else {
    onComplete.call(context, record || null, recordName, socketWrapper)

    if (record) {
      options.cache.set(recordName, record, () => {}, metaData)
    }
  }
}
166406
def maybe_start_recording(tokens, index):
        """"""
        if tokens[index].type == TokenType.BeginInlineRST:
            return _InlineRSTRecorder(index)
691259
private void computeStatistics(Record record) {
    computeStatistics(record.tip, record.host, record.inputBytes);
  }
969469
def _create_record(self, rtype, name, content):
        """"""
        found = self._list_records(rtype=rtype, name=name, content=content)
        if found:
            return True

        record = self._create_request_record(None, rtype, name, content,
                                             self._get_lexicon_option('ttl'),
                                             self._get_lexicon_option('priority'))

        self._request_add_dns_record(record)
        return True
207514
private void processSingleRecord(Record record) {
        // TODO Add your own record processing logic here

        String data = null;
        try {
            // For this app, we interpret the payload as UTF-8 chars.
            data = decoder.decode(record.getData()).toString();
            // Assume this record came from AmazonKinesisSample and log its age.
            long recordCreateTime = new Long(data.substring("testData-".length()));
            long ageOfRecordInMillis = System.currentTimeMillis() - recordCreateTime;

            LOG.info(record.getSequenceNumber() + ", " + record.getPartitionKey() + ", " + data + ", Created "
                    + ageOfRecordInMillis + " milliseconds ago.");
        } catch (NumberFormatException e) {
            LOG.info("Record does not match sample record format. Ignoring record with data; " + data);
        } catch (CharacterCodingException e) {
            LOG.error("Malformed data: " + data, e);
        }
    }