[llvm] Refactored verbosity flag in mlgo-utils to common location #107898 (PR #128541)
Ali Raeisdanaei via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 24 10:52:34 PST 2025
================
@@ -0,0 +1,21 @@
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+"""Library functions for setting up common parser arguments"""
+
+from argparse import ArgumentParser
+
+def add_verbosity_arguments(parser: ArgumentParser) -> None:
+ """Adds the arguments for verbosity to the ArgumentParser
+
+ Arguments:
+ parser -- the argument parser being modified with verbosity arguments
+ """
+ parser.add_argument(
+ "--verbosity",
+ type=str,
+ help="The verbosity level to use for logging",
+ default="INFO",
+ nargs="?",
+ choices=["DEBUG", "INFO", "WARNING", "ERROR"],
+ )
----------------
aliraeisdanaei wrote:
For sure. I added the new line at the end of my file. I didn't know it was a thing thank you for teaching me. Let me know if it still does not look good.
https://github.com/llvm/llvm-project/pull/128541
More information about the llvm-commits
mailing list