Handle the output for the given field
176274
def handle_field(field)
          case field
            when Symbol then return return_symbol_value(field)
            when Array then return  @ldap_object.try(field.first).try(:collect, &field.last)
          end
        end
1362666
def handle_data(self, data):
        """"""
        if not self.silent:
            if self.url:
                if self.url == data:
                    data = ''
                else:
                    data = '(' + data + ')'
            self.url = ''
            self.result += cgi.escape(data, True)
        lines = data.splitlines()
        if len(lines) > 1:
            match_obj = RE_HTML_FIRST_NON_QUOTATION_CHAR_ON_LINE.search(
                lines[-1])
            if match_obj:
                self.line_quotation = '&gt;' * match_obj.start()
            else:
                self.line_quotation = ''
277864
function processZtagOutput(output) {
  return output.split('\n').reduce(function(memo, line) {
    var match, key, value;
      match = ztagRegex.exec(line);
      if(match) {
        key = match[1];
        value = match[2];
        memo[key] = value;
      }
      return memo;
  }, {});
}
313531
def PrintField(self, field, value):
    """"""
    out = self.out
    out.write(' ' * self.indent)
    if self.use_field_number:
      out.write(str(field.number))
    else:
      if field.is_extension:
        out.write('[')
        if (field.containing_type.GetOptions().message_set_wire_format and
            field.type == descriptor.FieldDescriptor.TYPE_MESSAGE and
            field.label == descriptor.FieldDescriptor.LABEL_OPTIONAL):
          out.write(field.message_type.full_name)
        else:
          out.write(field.full_name)
        out.write(']')
      elif field.type == descriptor.FieldDescriptor.TYPE_GROUP:
        # For groups, use the capitalized name.
        out.write(field.message_type.name)
      else:
        out.write(field.name)

    if field.cpp_type != descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
      # The colon is optional in this case, but our cross-language golden files
      # don't include it.
      out.write(': ')

    self.PrintFieldValue(field, value)
    if self.as_one_line:
      out.write(' ')
    else:
      out.write('\n')
1116240
def render_field(self, field, data):
        """"""
        from trionyx.renderer import renderer

        if 'value' in field:
            value = field['value']
        elif isinstance(data, object) and hasattr(data, field['field']):
            value = getattr(data, field['field'])
            if 'renderer' not in field:
                value = renderer.render_field(data, field['field'], **field)
        elif isinstance(data, dict) and field['field'] in data:
            value = data.get(field['field'])
        elif isinstance(data, list) and field['__index__'] < len(data):
            value = data[field['__index__']]
        else:
            return ''

        options = {key: value for key, value in field.items() if key not in ['value', 'data_object']}
        if 'renderer' in field:
            value = field['renderer'](value, data_object=data, **options)
        else:
            value = renderer.render_value(value, data_object=data, **options)

        return field['format'].format(value)
1247918
def dump(output)
      output.name(self)
      output.attribute(:input, input)
      output.nest(:context, context)
    end
500687
def do_execute(self):
        
        result = None
        cont = self.input.payload
        serialization.write_all(
            str(self.resolve_option("output")),
            [cont.get("Model").jobject, cont.get("Header").jobject])
        return result
833712
def parse_field(self, field_data, index=0):
        """"""
        field = {
            '__index__': index,
        }

        if isinstance(field_data, str):
            field.update(self.parse_string_field(field_data))
        elif isinstance(field_data, dict):
            field.update(field_data)
        else:
            raise TypeError('Expected a str or dict get {}'.format(type(field_data)))

        if 'field' not in field:
            field['field'] = None

        if 'label' not in field and field['field']:
            try:
                field['label'] = self.object._meta.get_field(field['field']).verbose_name.capitalize()
            except Exception:
                field['label'] = field['field'].replace('_', '').capitalize()
        elif 'label' not in field:
            field['label'] = ''

        if 'format' not in field:
            field['format'] = '{0}'

        # Set default options
        for name, options in self.fields_options.items():
            if 'default' in options and name not in field:
                field[name] = options['default']

        return field
1274554
private function processFieldDefinition()
    {
        if (isset($this->definition['field'])) {
            $this->fields = $this->definition['field'];
        } elseif (isset($this->definition['fields'])) {
            $this->fields = $this->definition['fields'];
        } else {
            $this->fields = '*';
        }
    }
1282914
def do_output(self, *args):
        
        if args:
            action, params = args[0], args[1:]
            log.debug("Pass %s directly to output with %s", action, params)
            function = getattr(self.output, "do_" + action, None)
            if function:
                function(*params)
1257179
private static void writeField(ObjectOutput out, Fieldable field) throws IOException
   {
      // Name
      out.writeUTF(field.name());
      // Flags
      writeFlags(out, field);
      if (field.getBoost() != 1.0f)
      {
         // Boost
         out.writeFloat(field.getBoost());
      }
      // Value
      writeValue(out, field);
   }
652487
def output(self, context, *args, **kwargs):
        

        output_fields = self.output_fields
        output_type = self.output_type

        if output_fields and output_type:
            raise UnrecoverableError("Cannot specify both output_fields and output_type option.")

        if self.output_type:
            context.set_output_type(self.output_type)

        if self.output_fields:
            context.set_output_fields(self.output_fields)

        yield
583762
def handle(self, tag, data):
        

        if self.is_end(tag):
            self.postprocess_entry()

        if self.is_start(tag):
            self.new_entry()

        if not data or not tag:
            return

        if getattr(self, 'parse_only', None) and tag not in self.parse_only:
            return

        # TODO: revisit encoding here.
        if isinstance(data, unicode):
            data = unicodedata.normalize('NFKD', data)#.encode('utf-8','ignore')

        handler = self._get_handler(tag)
        if handler is not None:
            data = handler(data)

        if tag in self.tags:    # Rename the field.
            tag = self.tags[tag]

        # Multiline fields are represented as lists of values.
        if hasattr(self.data[-1], tag):
            value = getattr(self.data[-1], tag)
            if tag in self.concat_fields:
                value = ' '.join([value, unicode(data)])
            elif type(value) is list:
                value.append(data)
            elif value not in [None, '']:
                value = [value, data]
        else:
            value = data
        setattr(self.data[-1], tag, value)
        self.fields.add(tag)
899405
def handle_chunk_wrapper(self, status, name, content, file_info):
        """"""
        out = self.output
        if out is not None:
            with out:
                print("handling chunk " + repr(type(content)))
                self.handle_chunk(status, name, content, file_info)
        else:
            self.handle_chunk(status, name, content, file_info)
28668
def process_fields(self, fields):
		""""""
		
		result = []
		strip = ''.join(self.PREFIX_MAP)
		
		for field in fields:
			direction = self.PREFIX_MAP['']
			
			if field[0] in self.PREFIX_MAP:
				direction = self.PREFIX_MAP[field[0]]
				field = field.lstrip(strip)
			
			result.append((field, direction))
		
		return result
858835
function parse(value, field, options) {
  options = options || {};
  var parsed = utils.standardizeInput(value);

  // Integer
  if (field.type.key === "BOOLEAN") {
    parsed = utils.toBoolean(parsed);
  }
  else if (field.type.key === "INTEGER") {
    parsed = utils.toInteger(parsed);
  }
  else if (field.type.key === "FLOAT") {
    parsed = utils.toFloat(parsed);
  }
  else if (field.type.key === "DATEONLY") {
    parsed = utils.toDate(parsed, options.dateFormat);
  }
  else if (field.type.key === "DATE") {
    parsed = utils.toDateTime(parsed, options.datetimeFormat);
  }
  else if (field.type.key === "STRING") {
    parsed = utils.toString(parsed);
  }

  return parsed;
}
916979
def extract_field(self, field):
        
        if not isinstance(field, basestring):
            err_msg = u"Invalid extractor! => {}\n".format(field)
            logger.log_error(err_msg)
            raise exceptions.ParamsError(err_msg)

        msg = "extract: {}".format(field)

        if text_extractor_regexp_compile.match(field):
            value = self._extract_field_with_regex(field)
        else:
            value = self._extract_field_with_delimiter(field)

        if is_py2 and isinstance(value, unicode):
            value = value.encode("utf-8")

        msg += "\t=> {}".format(value)
        logger.log_debug(msg)

        return value