Retrieve a header name of the field name from definitions.

    For instance:
    inasafe_field_header('minimum_needs__clean_water') -> 'Clean water'
182125
def inasafe_field_header(field, feature, parent):
    
    _ = feature, parent  # NOQA
    age_fields = [under_5_displaced_count_field, over_60_displaced_count_field]
    symbol_mapping = {
        'over': '>',
        'under': '<'
    }

    field_definition = definition(field, 'field_name')
    if field_definition:
        if field_definition in age_fields:
            header_format = tr('{symbol} {age} y.o')
            field_name = field_definition.get('field_name')
            if field_name:
                symbol, age = field_name.split('_')[:2]
                if symbol.lower() in list(symbol_mapping.keys()):
                    header_name = header_format.format(
                        symbol=symbol_mapping[symbol.lower()],
                        age=age
                    )
                    return header_name

        header_name = field_definition.get('header_name')
        name = field_definition.get('name')
        if header_name:
            return header_name.capitalize()
        else:
            return name.capitalize()
    return None
982242
def get_header(headers, name, default=None):
    
    name = name.lower()
    for header in headers:
        if header[0].lower() == name:
            return header[1]
    return default
438864
def lookupFieldNameFromID( fid, dbid=nil )
     getSchema(dbid) if dbid
      name = nil
      if @fields
            field = lookupField( fid ) if fid
            label = field.elements[ "label" ] if field
            name = label.text if label
      end
      name
   end
1351905
public String getHeaderField(String fieldName) {
        // headers map is null for all regular response calls except when made as a batch request
        if (this.headers == null) {
            if (this.connection != null) {
                return this.connection.getHeaderField(fieldName);
            } else {
                return null;
            }
        } else {
            return this.headers.get(fieldName);
        }
    }
572397
public static String getEnumFieldValueGetterName(Field field) {
        return GETTER_PREFIX + Formatter.toPascalCase(field.getName()) + VALUE;
    }
1231890
def clean_name(self):
        
        field_name = self.cleaned_data['name']
        # get_all_field_names is deprecated in Django 1.8, this also fixes proxied models
        if hasattr(self.model._meta, 'get_fields'):
            field_names = [field.name for field in self.model._meta.get_fields()]
        else:
            field_names = self.model._meta.get_all_field_names()
        if field_name not in field_names:
            raise ValidationError("%r is not a valid field." % field_name)
        return field_name
266555
function getHeaderNames (res) {
  return typeof res.getHeaderNames !== 'function'
    ? Object.keys(res._headers || {})
    : res.getHeaderNames()
}
953290
def get_field_description(f):
    """"""
    type_name = get_field_type(f)
    if type_name == 'MESSAGE' and \
            {sf.name for sf in f.message_type.fields} == {'key', 'value'}:
        return 'map<string, string>'
    elif type_name == 'MESSAGE':
        return f.message_type.full_name
    elif type_name == 'ENUM':
        return f.enum_type.full_name
    else:
        return type_name.lower()
756384
def get_header(self, name, default_value=None):
        
        name_lower = name.lower()
        for value in self.headers:
            if value[0].lower() == name_lower:
                return value[1]

        return default_value
945941
def get_list_header(self):
        
        result = []
        for field_name in self.get_fields():
            item = {}
            if isinstance(field_name, tuple):
                # custom property that is not a field of the model
                item["name"] = field_name[0]
                item["label"] = field_name[1]
            else:
                item["name"] = field_name
                item["label"] = field_name.title()
            if item["name"] in self.get_ordering_fields():
                item["order_url"], item["order_direction"] = self.ordering_url(
                    item["name"]
                )
            result.append(item)

        return result
388532
def _field_name_from_uri(self, uri):
        
        # TODO - should use graph API
        uri = str(uri)
        parts = uri.split('#')
        if len(parts) == 1:
            return uri.split('/')[-1] or uri
        return parts[-1]
109418
def get_header(self, header_name, default=None):
        
        return self.headers.get(
            header_name, self.unredirected_headers.get(header_name, default))
645881
def get_field_names(ctx):
    """"""
    # this does not include labels and literals, only rule names and token names
    # TODO: check ANTLR parser template for full exclusion list
    fields = [
        field
        for field in type(ctx).__dict__
        if not field.startswith("__")
        and field not in ["accept", "enterRule", "exitRule", "getRuleIndex", "copyFrom"]
    ]
    return fields
137773
def parse_headers(self, req, name, field):
        """"""
        return get_value(req.headers, name, field)
673199
public static String getFieldGetterName(Field field) {
        String getterName = GETTER_PREFIX + Formatter.toPascalCase(field.getName());
        if ("getClass".equals(getterName)) {
            return getterName + "_";
        }
        return getterName;
    }
527718
def get_localized_field_name(context, field):
    """"""
    attrs = [
             translation.get_language(), 
             translation.get_language()[:2], 
             settings.LANGUAGE_CODE
            ]
            
    def predicate(x):
        field_name = get_real_fieldname(field, x)
        if hasattr(context, field_name):
            return field_name
        return None

    return first_match(predicate, attrs)
1052861
def get_headers(environ):
    
    for key, value in environ.iteritems():
        key = str(key)
        if key.startswith('HTTP_') and key not in \
           ('HTTP_CONTENT_TYPE', 'HTTP_CONTENT_LENGTH'):
            yield key[5:].replace('_', '-').title(), value
        elif key in ('CONTENT_TYPE', 'CONTENT_LENGTH'):
            yield key.replace('_', '-').title(), value