Sanitizes a field for output.

    This method removes the field delimiter from the field string.

    Args:
      field (str): field value.

     Returns:
       str: formatted field value.
437347
def _SanitizeField(self, field):
    
    if self._FIELD_DELIMITER and isinstance(field, py2to3.STRING_TYPES):
      return field.replace(self._FIELD_DELIMITER, ' ')
    return field
137610
def _remove_long_fields(self, wk_raw_data):
        

        match_str_list = ["rtc_cm:com.ibm.",
                          "calm:"]
        for key in wk_raw_data.keys():
            for match_str in match_str_list:
                if key.startswith(match_str):
                    try:
                        wk_raw_data.pop(key)
                        self.log.debug("Successfully remove field [%s] from "
                                       "the template", key)
                    except:
                        self.log.warning("Cannot remove field [%s] from the "
                                         "template", key)
                    continue
827383
def decode_field(self, field, value):
        
        if isinstance(field, messages.EnumField):
            try:
                return field.type(value)
            except TypeError:
                raise messages.DecodeError(
                    'Invalid enum value "%s"' % (value or ''))

        elif isinstance(field, messages.BytesField):
            try:
                return base64.b64decode(value)
            except (binascii.Error, TypeError) as err:
                raise messages.DecodeError('Base64 decoding error: %s' % err)

        elif isinstance(field, message_types.DateTimeField):
            try:
                return util.decode_datetime(value)
            except ValueError as err:
                raise messages.DecodeError(err)

        elif (isinstance(field, messages.MessageField) and
              issubclass(field.type, messages.Message)):
            return self.__decode_dictionary(field.type, value)

        elif (isinstance(field, messages.FloatField) and
              isinstance(value, (six.integer_types, six.string_types))):
            try:
                return float(value)
            except:  # pylint:disable=bare-except
                pass

        elif (isinstance(field, messages.IntegerField) and
              isinstance(value, six.string_types)):
            try:
                return int(value)
            except:  # pylint:disable=bare-except
                pass

        return value
105503
def autostrip(cls):
    
    warnings.warn(
        "django-annoying autostrip is deprecated and will be removed in a "
        "future version. Django now has native support for stripping form "
        "fields. "
        "https://docs.djangoproject.com/en/stable/ref/forms/fields/#django.forms.CharField.strip",
        DeprecationWarning,
        stacklevel=2,
    )
    fields = [(key, value) for key, value in cls.base_fields.items() if isinstance(value, forms.CharField)]
    for field_name, field_object in fields:
        def get_clean_func(original_clean):
            return lambda value: original_clean(value and value.strip())
        clean_func = get_clean_func(getattr(field_object, 'clean'))
        setattr(field_object, 'clean', clean_func)
    return cls
8196
def get_field_errors(self, field):
        
        identifier = format_html('{0}[\'{1}\']', self.form_name, field.name)
        errors = self.errors.get(field.html_name, [])
        return self.error_class([SafeTuple(
            (identifier, self.field_error_css_classes, '$pristine', '$pristine', 'invalid', e)) for e in errors])
749903
function capitalizeHeaderField(field) {
    return field.split('-').map(function (part) {
        return part[ 0 ].toUpperCase() + part.substring(1).toLowerCase()
    }).join('-')
}
60023
def encode_field(self, field, value):
    
    # Override the handling of 64-bit integers, so they're always encoded
    # as strings.
    if (isinstance(field, messages.IntegerField) and
        field.variant in (messages.Variant.INT64,
                          messages.Variant.UINT64,
                          messages.Variant.SINT64)):
      if value not in (None, [], ()):
        # Convert and replace the value.
        if isinstance(value, list):
          value = [str(subvalue) for subvalue in value]
        else:
          value = str(value)
        return value

    return super(EndpointsProtoJson, self).encode_field(field, value)
1087736
def _sanitize_url_components(comp_list, field):
    '''
    
    '''
    if not comp_list:
        return ''
    elif comp_list[0].startswith('{0}='.format(field)):
        ret = '{0}=XXXXXXXXXX&'.format(field)
        comp_list.remove(comp_list[0])
        return ret + _sanitize_url_components(comp_list, field)
    else:
        ret = '{0}&'.format(comp_list[0])
        comp_list.remove(comp_list[0])
        return ret + _sanitize_url_components(comp_list, field)
1230723
def _normalize_coerce_to_field_dict(self, v):
        

        def tokenize(s):
            """ Tokenize a string by splitting it by + and -

            >>> tokenize('this + that')
            ['this', '+', 'that']

            >>> tokenize('this+that')
            ['this', '+', 'that']

            >>> tokenize('this+that-other')
            ['this', '+', 'that', '-', 'other]
            """

            # Crude tokenization
            s = s.replace('+', ' + ').replace('-', ' - ') \
                .replace('/', ' / ').replace('*', ' * ')
            words = [w for w in s.split(' ') if w]
            return words

        if isinstance(v, _str_type):
            field_parts = tokenize(v)
            field = field_parts[0]
            d = {'value': field}
            if len(field_parts) > 1:
                # if we need to add and subtract from the field join the field
                # parts into pairs, for instance if field parts is
                #     [MyTable.first, '-', MyTable.second, '+', MyTable.third]
                # we will get two pairs here
                #     [('-', MyTable.second), ('+', MyTable.third)]
                d['operators'] = []
                for operator, other_field in zip(
                    field_parts[1::2], field_parts[2::2]
                ):
                    d['operators'].append({
                        'operator': operator,
                        'field': {
                            'value': other_field
                        }
                    })
            return d
        else:
            return v
369426
def to_string(self, value):
        
        self._warn_deprecated_outside_JSONField()
        value = json.dumps(
            self.to_json(value),
            indent=2,
            sort_keys=True,
            separators=(',', ': '),
        )
        return value
1005159
def _split_str(self, field):
        
        field_items = field.split("|")
        if len(field_items) == 2:
            return field_items[0], field_items[1]
        elif len(field_items) == 1:
            return field_items[0], None
1215979
def delete_field_value(self, name):
        
        name = self.get_real_name(name)

        if name and self._can_write_field(name):
            if name in self.__modified_data__:
                self.__modified_data__.pop(name)

            if name in self.__original_data__ and name not in self.__deleted_fields__:
                self.__deleted_fields__.append(name)
283007
private static String cleanString(String field) {
        int size = field.length();
        StringBuilder sb = new StringBuilder(size);
        for (int i = 0; i < size; i++) {
            char nextChar = field.charAt(i);
            switch (nextChar) {
            case HttpConstants.COLON:
            case HttpConstants.COMMA:
            case HttpConstants.EQUALS:
            case HttpConstants.SEMICOLON:
            case HttpConstants.HT:
                sb.append(HttpConstants.SP_CHAR);
                break;
            case HttpConstants.DOUBLE_QUOTE:
                // nothing added, just removes it
                break;
            default:
                sb.append(nextChar);
                break;
            }
        }
        return sb.toString().trim();
    }
1176850
public static String getFieldName(Field field) {
        String name = field.getName();
        String formattedName = Formatter.toCamelCase(name);
        if (isReservedKeyword(formattedName)) {
            return formattedName + '_';
        }
        return formattedName;
    }
764321
def format_values(field, value, options={})
      value = value.dup
      value.to_s.strip!
      if !fields.key?(field) || fields[field][:format].nil?
        return value
      end
      rules = fields[field][:format].dup
      # ignore rules
      if options[:ignore_rules]
        rules = rules - options[:ignore_rules]
      end
      # use fullname rather than abbreviated
      # fullname rule must be applied first!
      if rules.delete('fullname') && regions[value]
        value = regions[value]
      end
      # formatting
      rules.each do |rule|
        case rule
        when 'upcase'
          value.upcase!
        end
      end
      value
    end
910327
def cleaniddfield(acomm):
    """"""
    for key in list(acomm.keys()):
        val = acomm[key]
        acomm[key.lower()] = val
    for key in list(acomm.keys()):
        val = acomm[key]
        if key != key.lower():
            acomm.pop(key)
    return acomm
1152988
def pretty_str(self, indent=0):
        
        spaces = ' ' * indent
        pretty = '{}({})' if self.parenthesis else '{}{}'
        name = ('{}.{}'.format(self.field_of.pretty_str(), self.name)
                if self.field_of else self.name)
        return pretty.format(spaces, name)