fgen.data_models.module#

Data model of a Fortran module

Module#

class Module(name, description, provides, truncated_name=_Nothing.NOTHING, requirements=_Nothing.NOTHING)[source]#

Bases: object

Data model of a Fortran module

It is assumed that each module defines a single derived type.

description: str#

Description of the module

get_requirement_that_provides(provides)[source]#

Get the module requirement that provides the specified type

Parameters:

provides (str) – Name of the provided type

Returns:

fgen.data_models.module_requirement.ModuleRequirement – Module requirement that provides this type

Raises:

ValueError – No module requirement is found that provides provides is part of self.requirements.

property manager_module_name: str#

Name for the Fortran manager module

By default the manager module name is derived from the name, but, in some cases, the complete module name can be too long, leading to the manager module not being able to be built. In this case a truncated_name can be used to derive a shortened manager module name. Given that this manager module is only used by autogenerated code the readability of the name isn’t as important as the full module.

name: str#

Name of the module

provides: fgen.data_models.fortran_derived_type.FortranDerivedType#

Derived type that the module defines

requirements: list[fgen.data_models.module_requirement.ModuleRequirement]#

Requirements from other modules

Put another way, the modules that this module requires in order to run.

truncated_name: str#

If provided, the name to use when creating the Fortran wrapper module.

If not supplied, we simply use the value of name.

This can be used to avoid line length limits for the wrappers when we are wrapping modules with very long names.

truncated_name_default()[source]#

Default value for truncated_name

Return type:

str

property wrapper_module_name: str#

Name for the Fortran wrapper module

By default the wrapper module name is derived from the name, but, in some cases, the complete module name can be too long, leading to the wrapper module not being able to be built. In this case a truncated_name can be used to derive a shortened wrapper module name. Given that this wrapper module is only used by autogenerated code the readability of the name isn’t as important as the full module.