Debian Codegraph @

llvm/utils/mlgo-utils/mlgo/corpus/flags.py

raw
1 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2 # See https://llvm.org/LICENSE.txt for license information.
3 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4 """Library functions for setting up common parser arguments"""
5
6 from argparse import ArgumentParser
7
8
9 def add_verbosity_arguments(parser: ArgumentParser) -> None:
10 """Adds the arguments for verbosity to the ArgumentParser
11
12 Arguments:
13 parser: The argument parser being modified with verbosity arguments.
14 """
15 parser.add_argument(
16 "--verbosity",
17 type=str,
18 help="The verbosity level to use for logging",
19 default="INFO",
20 nargs="?",
21 choices=["DEBUG", "INFO", "WARNING", "ERROR"],
22 )