fgen.data_models.package#

Package data model

NoProvidingModuleError#

class NoProvidingModuleError(sought_type, value, package)[source]#

Bases: ValueError

Exception raised when no module provides a given type

Package#

class Package(modules, modules_enum_defining=_Nothing.NOTHING)[source]#

Bases: object

Data model of a package

It isn’t clear that our package is exactly like a typical Python/Fortran package, so it is best to think of it exactly as it is for now: a Package is a collection of :obj:~`fgen.data_models.Module`’s. While the naming is similar to the Package > Module hierarchy used by Python, they should be treated as different concepts.

find_providing_module(value)[source]#

Find the module that provides a value’s data type

If no module provides the value’s data type, None is returned.

Parameters:

value (typing.Union[fgen.data_models.multi_return.MultiReturn, fgen.data_models.value.Value]) – Value of which to find the data type provider

Returns:

typing.Optional[fgen.data_models.module.Module] – Module that provides value. If no module provides the value, None is returned.

get_module_that_provides_values_type(value)[source]#

Get the module that provides a value’s data type

Parameters:

value (typing.Union[fgen.data_models.multi_return.MultiReturn, fgen.data_models.value.Value]) – Value of which to find the data type provider

Returns:

fgen.data_models.module.Module – Module that provides value

Raises:

NoProvidingModuleError – No module that provides value’s data type is part of self.modules.

modules: tuple[fgen.data_models.module.Module, ...]#

Collection of modules that define derived types used within the package

modules_enum_defining: tuple[fgen.data_models.module_enum_defining.ModuleEnumDefining, ...]#

Collection of modules that define enums used within the package