From 4939c50378761a6be23271de8be6abaf28a9844b Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Fri, 5 Apr 2024 08:59:19 +0200 Subject: [PATCH] Add documentation --- map2map/main.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/map2map/main.py b/map2map/main.py index 03a10cb..63782f0 100644 --- a/map2map/main.py +++ b/map2map/main.py @@ -28,6 +28,18 @@ def _int_tuple(value): return t 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 = { "str_list": {"type": "string_list", "func": _str_list}, @@ -58,7 +70,6 @@ class VariadicType(click.ParamType): except Exception as e: self.fail(f"Could not parse {self._typename}: {e}", param, ctx) - def _apply_options(options_file, f): common_args = yaml.load(_load_resource_file(options_file), Loader=Loader) common_args = common_args['arguments']