Add documentation

This commit is contained in:
Guilhem Lavaux 2024-04-05 08:59:19 +02:00
parent 15bd391cf4
commit 4939c50378

View File

@ -28,6 +28,18 @@ def _int_tuple(value):
return t return t
class VariadicType(click.ParamType): class VariadicType(click.ParamType):
"""
A custom parameter type for Click command-line interface.
This class provides a way to define custom parameter types for Click commands.
It supports various types such as string, integer, float, JSON, and file paths.
Args:
typename (str or dict): The name of the type or a dictionary specifying the type and options.
Raises:
ValueError: If the typename is not recognized.
"""
_mapper = { _mapper = {
"str_list": {"type": "string_list", "func": _str_list}, "str_list": {"type": "string_list", "func": _str_list},
@ -58,7 +70,6 @@ class VariadicType(click.ParamType):
except Exception as e: except Exception as e:
self.fail(f"Could not parse {self._typename}: {e}", param, ctx) self.fail(f"Could not parse {self._typename}: {e}", param, ctx)
def _apply_options(options_file, f): def _apply_options(options_file, f):
common_args = yaml.load(_load_resource_file(options_file), Loader=Loader) common_args = yaml.load(_load_resource_file(options_file), Loader=Loader)
common_args = common_args['arguments'] common_args = common_args['arguments']