4.7.2 pde.tools.config module
Handles configuration variables of the package.
Class representing a single parameter. |
|
Class handling the package configuration. |
|
Tries to load certain python packages and returns their version. |
|
Helper function converting a version string into a list of integers. |
|
Checks whether a package has a sufficient version. |
|
Read package names from a requirements file. |
|
Read version number of ffmpeg program. |
|
Check whether the code is running in a high-performance computing environment. |
|
Obtain information about the compute environment. |
- class Config(items=None, mode='update')[source]
Bases:
UserDictClass handling the package configuration.
- Parameters:
items (dict, optional) – Configuration values that should be added or overwritten to initialize the configuration.
mode (str) –
Defines the mode in which the configuration is used. Possible values are
insert: any new configuration key can be inserted
update: only the values of pre-existing items can be updated
locked: no values can be changed
Note that the items specified by items will always be inserted, independent of the mode.
- use_multithreading()[source]
Determine whether multithreading should be used in numba-compiled code.
This method checks the configuration setting for numba.multithreading and determines whether multithreading should be enabled based on the value of this setting. The possible values for numba.multithreading are: - ‘always’: Multithreading is always enabled. - ‘never’: Multithreading is never enabled. - ‘only_local’: Multithreading is enabled only if the code is not running in a high-performance computing (HPC) environment.
- Returns:
True if multithreading should be enabled, False otherwise.
- Return type:
- Raises:
ValueError – If the numba.multithreading setting is not one of the expected
values ('always', 'never', 'only_local'). –
- class Parameter(name, default_value=None, cls=<class 'object'>, description='', hidden=False, extra=None)[source]
Bases:
objectClass representing a single parameter.
Initialize a parameter.
- Parameters:
name (str) – The name of the parameter
default_value – The default value
cls – The type of the parameter, which is used for conversion
description (str) – A string describing the impact of this parameter. This description appears in the parameter help
hidden (bool) – Whether the parameter is hidden in the description summary
extra (dict) – Extra arguments that are stored with the parameter
- convert(value=None)[source]
Converts a value into the correct type for this parameter. If value is not given, the default value is converted.
Note that this does not make a copy of the values, which could lead to unexpected effects where the default value is changed by an instance.
- Parameters:
value – The value to convert
- Returns:
The converted value, which is of type self.cls
- check_package_version(package_name, min_version)[source]
Checks whether a package has a sufficient version.
- environment()[source]
Obtain information about the compute environment.
- Returns:
information about the python installation and packages
- Return type:
- get_package_versions(packages, *, na_str='not available')[source]
Tries to load certain python packages and returns their version.
- is_hpc_environment()[source]
Check whether the code is running in a high-performance computing environment.
- Returns:
True if running in an HPC environment, False otherwise.
- Return type: