# loki.transformations.extract package

## Subpackages

- loki.transformations.extract.tests package
  - Submodules
    - loki.transformations.extract.tests.test_extract_internal module
    - loki.transformations.extract.tests.test_extract_transformation module
    - loki.transformations.extract.tests.test_outline module
  - Module contents

## Submodules

- loki.transformations.extract.internal module
  - `extract_contained_procedures()`
  - `extract_contained_procedure()`
  - `extract_internal_procedures()`
  - `extract_internal_procedure()`
- loki.transformations.extract.outline module
  - `outline_region()`
  - `outline_pragma_regions()`

## Module contents

Transformations sub-package that provides various forms of source-code extraction into standalone `Subroutine` objects.

The various extractions mechanisms are provided as standalone utility methods, or via the `ExtractTransformation` class for for batch processing.

These utilities represent the conceptual inverse operation to “inlining”, as done by the `InlineTransformation`.

class ExtractTransformation(extract_internals=False, outline_regions=True)

  Bases: `Transformation`

  `Transformation` class to apply several types of source extraction when batch-processing large source trees via the `Scheduler`.

  Parameters:

    - extract_internals (bool) – Extract internal procedure (see `extract_internal_procedures`); default: False.

    - outline_regions (bool) – Outline pragma-annotated code regions to `Subroutine` objects. (see `outline_pragma_regions`); default: True.

  transform_module(module, **kwargs)

    Extract internals procedures and marked subroutines and add them to the given `Module`.

  transform_file(sourcefile, **kwargs)

    Extract internals procedures and marked subroutines and add them to the given `Sourcefile`.