(definition)
Update `definition` in-place with the contents of base profile files listed in the 'extends' section.

    Base profiles should be referenced by filename, which can be relative (built-in profile)
    or absolute (custom profile).

    Raises:
    * Exception: if any definition file referred in the 'extends' section was not found or is malformed.
Update `definition` in-place with the contents of base profile files listed in the 'extends' section.
Update definition in - place with the contents of base profile files listed in the extends section .
def recursively_expand_base_profiles(definition):
    # type: (Dict[str, Any]) -> None
    """
    Update `definition` in-place with the contents of base profile files listed in the 'extends' section.

    Base profiles should be referenced by filename, which can be relative (built-in profile)
    or absolute (custom profile).

    Raises:
    * Exception: if any definition file referred in the 'extends' section was not found or is malformed.
    """
    extends = definition.get('extends', [])

    for filename in extends:
        base_definition = _read_profile_definition(filename)
        recursively_expand_base_profiles(base_definition)

        base_metrics = base_definition.get('metrics', [])
        existing_metrics = definition.get('metrics', [])
        definition['metrics'] = base_metrics + existing_metrics  # NOTE: base metrics must be added first.

        definition.setdefault('metric_tags', []).extend(base_definition.get('metric_tags', []))
def recursively_expand_base_profiles ( definition ) : # type: (Dict[str, Any]) -> None extends = definition . get ( 'extends' , [ ] ) for filename in extends : base_definition = _read_profile_definition ( filename ) recursively_expand_base_profiles ( base_definition ) base_metrics = base_definition . get ( 'metrics' , [ ] ) existing_metrics = definition . get ( 'metrics' , [ ] ) definition [ 'metrics' ] = base_metrics + existing_metrics # NOTE: base metrics must be added first. definition . setdefault ( 'metric_tags' , [ ] ) . extend ( base_definition . get ( 'metric_tags' , [ ] ) )