easybuild.framework.easyconfig.types module¶
Support for checking types of easyconfig parameter values.
Authors:
- Caroline De Brouwer (Ghent University)
- Kenneth Hoste (Ghent University)
-
easybuild.framework.easyconfig.types.as_hashable(dict_value)¶ Helper function, convert dict value to hashable equivalent via tuples.
-
easybuild.framework.easyconfig.types.check_element_types(elems, allowed_types)¶ Check whether types of elements of specified (iterable) value are as expected.
Parameters: - elems – iterable value (list or dict) of elements
- allowed_types – allowed types per element; either a simple list, or a dict of allowed_types by element name
-
easybuild.framework.easyconfig.types.check_key_types(val, allowed_types)¶ Check whether type of keys for specific dict value are as expected.
-
easybuild.framework.easyconfig.types.check_known_keys(val, allowed_keys)¶ Check whether all keys for specified dict value are known keys.
-
easybuild.framework.easyconfig.types.check_required_keys(val, required_keys)¶ Check whether all required keys are present in the specified dict value.
-
easybuild.framework.easyconfig.types.check_type_of_param_value(key, val, auto_convert=False)¶ Check value type of specified easyconfig parameter.
Parameters: - key – name of easyconfig parameter
- val – easyconfig parameter value, of which type should be checked
- auto_convert – try to automatically convert to expected value type if required
-
easybuild.framework.easyconfig.types.convert_value_type(val, typ)¶ Try to convert type of provided value to specific type.
Parameters: - val – value to convert type of
- typ – target type
-
easybuild.framework.easyconfig.types.ensure_iterable_license_specs(specs)¶ Ensures that the provided license file/server specifications are of correct type and converts them to a list. The input can either be None, a string, or a list/tuple of strings.
Parameters: specs – License file/server specifications as provided via license_file easyconfig parameter
-
easybuild.framework.easyconfig.types.is_value_of_type(value, expected_type)¶ Check whether specified value matches a particular very specific (non-trivial) type, which is specified by means of a 2-tuple: (parent type, tuple with additional type requirements).
Parameters: - value – value to check the type of
- expected_type – type of value to check against
-
easybuild.framework.easyconfig.types.to_checksums(checksums)¶ Ensure correct element types for list of checksums: convert list elements to tuples.
-
easybuild.framework.easyconfig.types.to_dependencies(dep_list)¶ Convert a list of dependencies obtained from parsing a .yeb easyconfig to a list of dependencies in the correct format
-
easybuild.framework.easyconfig.types.to_dependency(dep)¶ Convert a dependency specification to a dependency dict with name/version/versionsuffix/toolchain keys.
- Example:
- {‘foo’: ‘1.2.3’, ‘toolchain’: ‘GCC, 4.8.2’} to {‘name’: ‘foo’, ‘version’: ‘1.2.3’, ‘toolchain’: {‘name’: ‘GCC’, ‘version’: ‘4.8.2’}}
- or
- {‘name’: ‘fftw/3.3.4.1’, ‘external_module’: True} to {‘name’: ‘fftw/3.3.4.1’, ‘external_module’: True, ‘version’: None}
-
easybuild.framework.easyconfig.types.to_list_of_strings(value)¶ Convert specified value to a list of strings, if possible.
Supported: single string value, tuple of string values.
-
easybuild.framework.easyconfig.types.to_list_of_strings_and_tuples(spec)¶ Convert a ‘list of lists and strings’ to a ‘list of tuples and strings’
- Example:
- [‘foo’, [‘bar’, ‘baz’]] to [‘foo’, (‘bar’, ‘baz’)]
-
easybuild.framework.easyconfig.types.to_list_of_strings_and_tuples_and_dicts(spec)¶ Convert a ‘list of dicts and tuples/lists and strings’ to a ‘list of dicts and tuples and strings’
- Example:
- [‘foo’, [‘bar’, ‘baz’]] to [‘foo’, (‘bar’, ‘baz’)]
-
easybuild.framework.easyconfig.types.to_name_version_dict(spec)¶ No longer supported, replaced by to_toolchain_dict.
-
easybuild.framework.easyconfig.types.to_sanity_check_paths_dict(spec)¶ Convert a sanity_check_paths dict as received by yaml (a dict with list values that contain either lists or strings)
- Example:
- {‘files’: [‘file1’, [‘file2a’, ‘file2b]], ‘dirs’: [‘foo/bar’]} to {‘files’: [‘file1’, (‘file2a’, ‘file2b’)], ‘dirs’: [‘foo/bar’]}
-
easybuild.framework.easyconfig.types.to_toolchain_dict(spec)¶ Convert a comma-separated string or 2/3-element list of strings to a dictionary with name/version keys, and optionally a hidden key. If the specified value is a dict already, the keys are checked to be only name/version/hidden.
- For example: “intel, 2015a” => {‘name’: ‘intel’, ‘version’: ‘2015a’}
- “foss, 2016a, True” => {‘name’: ‘foss’, ‘version’: ‘2016a’, ‘hidden’: True}
Parameters: spec – a comma-separated string with two or three values, or a 2/3-element list of strings, or a dict