Retrieve age gender section header string from definitions.
547972
def age_gender_section_header_element(feature, parent):
    """"""
    _ = feature, parent  # NOQA
    header = age_gender_section_header['string_format']
    return header.capitalize()
137773
def parse_headers(self, req, name, field):
        """"""
        return get_value(req.headers, name, field)
116938
def _str_desc(self, reader):
        """"""
        data_version = reader.data_version
        if data_version is not None:
            data_version = data_version.replace("releases/", "")
        desc = "{OBO}: fmt({FMT}) rel({REL}) {N:,} GO Terms".format(
            OBO=reader.obo_file, FMT=reader.format_version,
            REL=data_version, N=len(self))
        if reader.optobj:
            desc = "{D}; optional_attrs({A})".format(D=desc, A=" ".join(sorted(reader.optobj.optional_attrs)))
        return desc
945218
def match(header):
        '''
        
        '''
        mo = Library.header_re.match(header)
        if mo is None:
            raise ValueError(f'Not a SAS Version 5 or 6 XPORT file')
        return {
            'created': strptime(mo['created']),
            'modified': strptime(mo['modified']),
            'sas_version': float(mo['version']),
            'os_version': mo['os'].decode().strip(),
        }
606148
def hsts_header(self):
        """"""
        hsts_policy = 'max-age={0}'.format(self.hsts_age)

        if self.hsts_include_subdomains:
            hsts_policy += '; includeSubDomains'

        return hsts_policy
380541
def convert_ages(Recs, data_model=3):
    
    if data_model == 3:
        site_key = 'site'
        agekey = "age"
        keybase = ""
    else:
        site_key = 'er_site_names'
        agekey = find('age', list(rec.keys()))
        if agekey != "":
            keybase = agekey.split('_')[0] + '_'

    New = []
    for rec in Recs:
        age = ''
        if rec[keybase + 'age'] != "":
            age = float(rec[keybase + "age"])
        elif rec[keybase + 'age_low'] != "" and rec[keybase + 'age_high'] != '':
            age = np.mean([rec[keybase + 'age_high'],
                           rec[keybase + "age_low"]])
            # age = float(rec[keybase + 'age_low']) + old_div(
            #    (float(rec[keybase + 'age_high']) - float(rec[keybase + 'age_low'])), 2.)
        if age != '':
            rec[keybase + 'age_unit']
            if rec[keybase + 'age_unit'] == 'Ma':
                rec[keybase + 'age'] = '%10.4e' % (age)
            elif rec[keybase + 'age_unit'] == 'ka' or rec[keybase + 'age_unit'] == 'Ka':
                rec[keybase + 'age'] = '%10.4e' % (age * .001)
            elif rec[keybase + 'age_unit'] == 'Years AD (+/-)':
                rec[keybase + 'age'] = '%10.4e' % ((2011 - age) * 1e-6)
            elif rec[keybase + 'age_unit'] == 'Years BP':
                rec[keybase + 'age'] = '%10.4e' % ((age) * 1e-6)
            rec[keybase + 'age_unit'] = 'Ma'
            New.append(rec)
        else:
            if 'site_key' in list(rec.keys()):
                print('problem in convert_ages:', rec['site_key'])
            elif 'er_site_name' in list(rec.keys()):
                print('problem in convert_ages:', rec['site_key'])
            else:
                print('problem in convert_ages:', rec)
        if len(New) == 0:
            print('no age key:', rec)
    return New
798050
def get_metadata(headers):
  """"""
  return dict((k, v) for k, v in headers.iteritems()
              if any(k.lower().startswith(valid) for valid in _GCS_METADATA))
761717
def get_assessment_section_mdata():
    """"""
    return {
        'assessment_taken': {
            'element_label': {
                'text': 'assessment taken',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'accepts an osid.id.Id object',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_id_values': [''],
            'syntax': 'ID',
            'id_set': [],
        },
    }
61687
def extract_headers(headers):
    """"""
    sorted_headers = {}
    matches = re.findall(r'(.*):\s(.*)', headers)
    for match in matches:
        header = match[0]
        value = match[1]
        try:
            if value[-1] == ',':
                value = value[:-1]
            sorted_headers[header] = value
        except IndexError:
            pass
    return sorted_headers
543001
def map_gender(gender):
        

        if gender == 'male':
            return issuers.Gender.MALE
        elif gender == 'female':
            return issuers.Gender.FEMALE
        else:
            return issuers.Gender.UNKNOWN
367543
def process_header(self, headers):
        """"""

        return [c.name for c in self.source.dest_table.columns][1:]
919321
def parse_header(cls, value='*/*'):
        """"""
        yield from sorted((
            cls.from_string(token.strip())
            for token in value.split(',')
            if token.strip()
        ), reverse=True)
121744
def ParseAgeSpecification(cls, age):
    """"""
    try:
      return (0, int(age))
    except (ValueError, TypeError):
      pass

    if age == NEWEST_TIME:
      return data_store.DB.NEWEST_TIMESTAMP
    elif age == ALL_TIMES:
      return data_store.DB.ALL_TIMESTAMPS
    elif len(age) == 2:
      start, end = age

      return (int(start), int(end))

    raise ValueError("Unknown age specification: %s" % age)
1275497
def parse_speaker_info(readme_path):
        
        idx = None
        gender = issuers.Gender.UNKNOWN
        age_group = issuers.AgeGroup.UNKNOWN
        native_lang = None

        with open(readme_path, 'r', errors='ignore') as f:
            for raw_line in f:
                line = raw_line.strip()

                if line is not None and line is not '':
                    line = line.rstrip(';.')
                    parts = line.split(':', maxsplit=1)

                    if len(parts) > 1:
                        key = parts[0].strip().lower()
                        value = parts[1].strip()

                        if key == 'user name':
                            idx = value

                        value = value.lower()

                        if key == 'gender':
                            if value in ['männlich', 'male', 'mnnlich']:
                                gender = issuers.Gender.MALE
                            elif value in ['weiblich', 'female', '[female]']:
                                gender = issuers.Gender.FEMALE

                        if key == 'age range':
                            if value in ['erwachsener', 'adult', '[adult]', '[erwachsener]']:
                                age_group = issuers.AgeGroup.ADULT
                            elif value in ['senior', '[senior']:
                                age_group = issuers.AgeGroup.SENIOR
                            elif value in ['youth', 'jugendlicher', '[youth]', '[jugendlicher]']:
                                age_group = issuers.AgeGroup.YOUTH
                            elif value in ['kind', 'child']:
                                age_group = issuers.AgeGroup.CHILD

                        if key == 'language':
                            if value in ['de', 'ger', 'deu', '[de]']:
                                native_lang = 'deu'
                            elif value in ['en', 'eng', '[en]']:
                                native_lang = 'eng'

        return issuers.Speaker(idx, gender=gender, age_group=age_group, native_language=native_lang)
1079213
def map_age(age):
        

        if age in [None, '']:
            return issuers.AgeGroup.UNKNOWN
        elif age == 'teens':
            return issuers.AgeGroup.YOUTH
        elif age in ['sixties', 'seventies', 'eighties', 'nineties']:
            return issuers.AgeGroup.SENIOR
        else:
            return issuers.AgeGroup.ADULT
1129717
def _guess_header(info):
    """"""
    value = "group"
    if "metadata" in info:
        if info["metadata"]:
            return ",".join(map(str, info["metadata"].keys()))
    return value
1252733
def internal_get_goids_or_sections(self):
        """"""
        if self.goids_fin:
            chk_goids(self.goids_fin, "read_goids")
            return {'goids' : self.goids_fin}
        else:
            # Convert dict into 2D list retaining original section order
            sections_2d = []
            for section_name in self.sections_seen:
                if section_name in self.section2goids:
                    goids = self.section2goids.get(section_name)
                    chk_goids(goids, "GO IDs IN SECTION({S})".format(S=section_name))
                    sections_2d.append((section_name, goids))
            return {'sections' : sections_2d}