# loki.transformations.extract

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`.

Classes

`ExtractTransformation`([extract_internals, ...]) | `Transformation` class to apply several types of source extraction when batch-processing large source trees via the `Scheduler`.

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`.

Modules

`internal` |
`outline` |
`tests` |