Utility method to fetch items from the Durable table if they are too big for SNS/SQS.

    :param record:
    :param durable_model:
    :return:
349723
def get_full_durable_object(arn, event_time, durable_model):
    
    LOG.debug(f'[-->] Item with ARN: {arn} was too big for SNS -- fetching it from the Durable table...')
    item = list(durable_model.query(arn, durable_model.eventTime == event_time))

    # It is not clear if this would ever be the case... We will consider this an error condition for now.
    if not item:
        LOG.error(f'[?] Item with ARN/Event Time: {arn}/{event_time} was NOT found in the Durable table...'
                  f' This is odd.')
        raise DurableItemIsMissingException({"item_arn": arn, "event_time": event_time})

    # We need to place the real configuration data into the record so it can be deserialized into
    # the durable model correctly:
    return item[0]
389162
def static_records_for_calculation(column_name, options={}, &block)#:nodoc:
      if columns_hash.has_key?(column_name.to_s)
        records = static_record_cache[:primary_key].values.collect(&(column_name.to_sym)).compact
        results = (options[:distinct]||options['distinct']) ? records.uniq : records
        block ? yield(results) : results
      else
        nil
      end
    end
300389
def from_record(self, record):
        
        kwargs = self.get_field_kwargs(record)
        return self.sequenced_item_class(**kwargs)
995670
def _getitem(self, index):
        """"""
        row = self._records[index]
        if row is not None:
            pass
        elif self.is_attached():
            # need to handle negative indices manually
            if index < 0:
                index = len(self._records) + index
            row = next((decode_row(line)
                        for i, line in self._enum_lines()
                        if i == index),
                       None)
            if row is None:
                raise ItsdbError('could not retrieve row in attached table')
        else:
            raise ItsdbError('invalid row in detached table: {}'.format(index))

        return Record._make(self.fields, row, self, index)
1270396
def modify_record(durable_model, current_revision, arn, event_time, diff_func):
    """"""
    # We want the newest items first.
    # See: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html
    items = list(durable_model.query(
        arn,
        (durable_model.eventTime <= event_time),
        scan_index_forward=False,
        limit=1,
        consistent_read=True))

    if items:
        latest_revision = items[0]

        latest_config = latest_revision._get_json()[1]['attributes']    # pylint: disable=W0212
        current_config = current_revision._get_json()[1]['attributes']  # pylint: disable=W0212

        # Determine if there is truly a difference, disregarding Ephemeral Paths
        diff = diff_func(latest_config, current_config)
        if diff:
            LOG.debug(
                f'[~] Difference found saving new revision to durable table. Arn: {arn} LatestConfig: {latest_config} '
                f'CurrentConfig: {json.dumps(current_config)}')
            current_revision.save()
    else:
        current_revision.save()
        LOG.info(f'[?] Got modify event but no current revision found. Arn: {arn}')
201491
def get_record(name, zone, record_type, fetch_all=False, region=None, key=None,
               keyid=None, profile=None, split_dns=False, private_zone=False,
               identifier=None, retry_on_rate_limit=None,
               rate_limit_retries=None, retry_on_errors=True, error_retries=5):
    '''
    
    '''
    if region is None:
        region = 'universal'

    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if retry_on_rate_limit or rate_limit_retries is not None:
        salt.utils.versions.warn_until(
            'Neon',
            'The \'retry_on_rate_limit\' and \'rate_limit_retries\' arguments '
            'have been deprecated in favor of \'retry_on_errors\' and '
            '\'error_retries\' respectively. Their functionality will be '
            'removed, as such, their usage is no longer required.'
        )
        if retry_on_rate_limit is not None:
            retry_on_errors = retry_on_rate_limit
        if rate_limit_retries is not None:
            error_retries = rate_limit_retries

    while error_retries > 0:
        try:
            if split_dns:
                _zone = _get_split_zone(zone, conn, private_zone)
            else:
                _zone = conn.get_zone(zone)
            if not _zone:
                msg = 'Failed to retrieve zone {0}'.format(zone)
                log.error(msg)
                return None
            _type = record_type.upper()
            ret = odict.OrderedDict()

            name = _encode_name(name)

            _record = _zone.find_records(name, _type, all=fetch_all, identifier=identifier)

            break  # the while True

        except DNSServerError as e:
            if retry_on_errors:
                if 'Throttling' == e.code:
                    log.debug('Throttled by AWS API.')
                elif 'PriorRequestNotComplete' == e.code:
                    log.debug('The request was rejected by AWS API.\
                              Route 53 was still processing a prior request')
                time.sleep(3)
                error_retries -= 1
                continue
            raise e

    if _record:
        ret['name'] = _decode_name(_record.name)
        ret['value'] = _record.resource_records[0]
        ret['record_type'] = _record.type
        ret['ttl'] = _record.ttl
        if _record.identifier:
            ret['identifier'] = []
            ret['identifier'].append(_record.identifier)
            ret['identifier'].append(_record.weight)

    return ret
824387
def filter(self, record):
        
        found = self._pattern.search(record.getMessage())
        return not found
770749
def _get_record(self, record_type):
        
        if (not self.has_record_type(record_type) and
                record_type.get_identifier() not in self._record_type_data_sets):
            raise errors.Unsupported()
        if str(record_type) not in self._records:
            record_initialized = self._init_record(str(record_type))
            if record_initialized and str(record_type) not in self._my_map['recordTypeIds']:
                self._my_map['recordTypeIds'].append(str(record_type))
        return self._records[str(record_type)]
318841
def from_record(cls, record, crs, schema=None):
        """"""
        properties = cls._to_properties(record, schema)
        vector = GeoVector(shape(record['geometry']), crs)
        if record.get('raster'):
            assets = {k: dict(type=RASTER_TYPE, product='visual', **v) for k, v in record.get('raster').items()}
        else:
            assets = record.get('assets', {})
        return cls(vector, properties, assets)
641553
def filter_record(self, record):
        
        if len(record) >= self.max_length:
            return record[:self.max_length]
        else:
            return record
485678
function (record, index) {
		var geohash = this.options.geohashField ? L.Util.getFieldValue(record, this.options.geohashField) : index;
		var locationInfo = GeoHash.decodeGeoHash(geohash);
		var bounds;

		if (locationInfo.latitude[2] && locationInfo.longitude[2]) {
			bounds = new L.LatLngBounds(new L.LatLng(locationInfo.latitude[0], locationInfo.longitude[0]), new L.LatLng(locationInfo.latitude[1], locationInfo.longitude[1]));
		}

		return {
			location: bounds,
			text: geohash,
			center: bounds.getCenter()
		};
	}
610785
public void index(Record record) {
    // FIXME: check if record is already indexed

    // allocate an ID for this record
    long id = store.makeNewRecordId();
    store.registerRecord(id, record);
    
    // go through ID properties and register them
    for (Property p : config.getIdentityProperties())
      for (String extid : record.getValues(p.getName()))
        store.registerId(id, extid);

    // go through lookup properties and register those
    for (Property p : config.getLookupProperties()) {
      String propname = p.getName();
      for (String value : record.getValues(propname)) {
        String[] tokens = StringUtils.split(value);
        for (int ix = 0; ix < tokens.length; ix++)
          store.registerToken(id, propname, tokens[ix]);
      }
    }
  }
935465
def _get_record(self, name):
        """"""
        request = self._session.get(self._baseurl, params={'name': name,
                                                           'type': 'A'})
        if not request.ok:
            raise RuntimeError('Failed to search record: %s - %s' %
                               (self._format_hostname(name), request.json()))
        records = request.json()
        if len(records) == 0:
            return
        record = records[0]
        if 'record' not in record or 'id' not in record['record']:
            raise RuntimeError('Invalid record JSON format: %s - %s' %
                               (self._format_hostname(name), request.json()))
        return int(record['record']['id'])
307280
def _getPayload(self, record):
        

        try:
            # top level payload items
            d = record.__dict__
            pid = d.pop('process', 'nopid')
            tid = d.pop('thread', 'notid')

            payload = {
                k: v for (k, v) in d.items()
                if k in TOP_KEYS
            }

            # logging meta attributes
            payload['meta'] = {
                k: v for (k, v) in d.items()
                if k in META_KEYS
            }

            # everything else goes in details
            payload['details'] = {
                k: simple_json(v) for (k, v) in d.items()
                if k not in self.detail_ignore_set
            }

            payload['log'] = payload.pop('name', 'n/a')
            payload['level'] = payload.pop('levelname', 'n/a')
            payload['meta']['line'] = payload['meta'].pop('lineno', 'n/a')

            payload['message'] = record.getMessage()
            tb = self._getTraceback(record)
            if tb:
                payload['traceback'] = tb

        except Exception as e:
            payload = {
                'level': 'ERROR',
                'message': 'could not format',
                'exception': repr(e),
            }
        payload['pid'] = 'p-{}'.format(pid)
        payload['tid'] = 't-{}'.format(tid)
        return payload
1233198
def record(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('ES record not yet initialized!')

        return b'ES' + struct.pack('=BBB', RRESRecord.length(), SU_ENTRY_VERSION, self.extension_sequence)
131289
public List evaluate(Record record) {
    // fast path (not functionally necessary):
    if (fields.size() == 1) {
      Object first = fields.get(0);
      if (first instanceof String) {
        return Collections.singletonList(first);
      } else {
        String ref = ((Field) first).getName();
        if (ref.length() != 0) {
          List resolvedValues = record.get(ref);
          return resolvedValues;
        }
      }
    }

    // slow path:
    ArrayList<Object> results = new ArrayList<Object>(1);
    evaluate2(0, record, new StringBuilder(), results);
    return results;
  }
625749
def _get_record(self, record_type):
        """"""
        if not self.has_record_type(record_type):
            raise errors.Unsupported()
        if str(record_type) not in self._records:
            raise errors.Unimplemented()
        return self._records[str(record_type)]