O2-DQ User Interface 1.0.0
Loading...
Searching...
No Matches
actionHandler.py
Go to the documentation of this file.
1#!/usr/bin/env python
2# PYTHON_ARGCOMPLETE_OK
3# -*- coding: utf-8 -*-
4
5# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
6# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
7# All rights not expressly granted are reserved.
8#
9# This software is distributed under the terms of the GNU General Public
10# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
11#
12# In applying this license CERN does not waive the privileges and immunities
13# granted to it by virtue of its status as an Intergovernmental Organization
14# or submit itself to any jurisdiction.
15
16import argparse
17
18
19class NoAction(argparse.Action):
20
21 """
22 NoAction class adds dummy positional arguments to an argument,
23 so sub helper messages can be created
24
25 Args:
26 argparse (Class): Input as args
27 """
28
29 def __init__(self, **kwargs):
30 kwargs.setdefault("default", argparse.SUPPRESS)
31 kwargs.setdefault("nargs", 0)
32 super(NoAction, self).__init__(**kwargs)
33
34 def __call__(self, parser, namespace, values, option_string = None):
35 pass
36
37
38class ChoicesAction(argparse._StoreAction):
39
40 """
41 ChoicesAction class is used to add extra choices
42 to a parseargs choices list
43
44 Args:
45 argparse (Class): Input as args
46 """
47
48 def add_choice(self, choice, help = ""):
49 if self.choices is None:
50 self.choices = []
51 self.choices.append(choice)
52 self.container.add_argument(choice, help = help, action = "none")
def add_choice(self, choice, help="")
def __init__(self, **kwargs)
def __call__(self, parser, namespace, values, option_string=None)