Skip to content

preprocess_toolbox.loader.cli


LoaderArgParser

Bases: BaseArgParser

An ArgumentParser specialised to support forecast plot arguments

The 'allow_*' methods return self to permit method chaining.

Parameters:

Name Type Description Default
suppress_logs
required
Source code in preprocess_toolbox/loader/cli.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class LoaderArgParser(BaseArgParser):
    """An ArgumentParser specialised to support forecast plot arguments

    The 'allow_*' methods return self to permit method chaining.

    :param suppress_logs:
    """

    def __init__(self,
                 source=False,
                 *args,
                 **kwargs):
        super().__init__(*args, **kwargs)

        if source:
            self.add_argument("source",
                              help="A complete path to a source configuration",
                              type=str)

        self.add_argument("name",
                          type=str)

    def add_configurations(self):
        self.add_argument("configurations",
                          type=argparse.FileType("r"),
                          nargs="+")
        return self

    def add_sections(self):
        self.add_argument("segments",
                          nargs="+")
        return self