From: Simon Glass <simon.glass@canonical.com> Fix the remaining pylint warnings: - Remove dead Python 3.6 importlib_resources fallback import - Fix docstring parameter name (verbosity -> verbose) - Remove unnecessary elif/else after return statements - Add missing return statements for consistent function returns Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- tools/buildman/main.py | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/tools/buildman/main.py b/tools/buildman/main.py index 22be946b37d..914dfe04988 100755 --- a/tools/buildman/main.py +++ b/tools/buildman/main.py @@ -6,11 +6,7 @@ """See README for more information""" -try: - import importlib.resources -except ImportError: - # for Python 3.6 - import importlib_resources +import importlib.resources import os import sys @@ -33,7 +29,7 @@ def run_tests(skip_net_tests, debug, verbose, args): Args: skip_net_tests (bool): True to skip tests which need the network debug (bool): True to run in debugging mode (full traceback) - verbosity (int): Verbosity level to use (0-4) + verbose (int): Verbosity level to use (0-4) args (list of str): List of tests to run, empty to run all """ # These imports are here since tests are not available when buildman is @@ -87,27 +83,27 @@ def run_buildman(): if cmdline.HAS_TESTS and args.test: return run_tests(args.skip_net_tests, args.debug, args.verbose, args) - elif cmdline.HAS_TESTS and args.coverage: + if cmdline.HAS_TESTS and args.coverage: run_test_coverage() + return 0 - elif args.full_help: + if args.full_help: if hasattr(importlib.resources, 'files'): dirpath = importlib.resources.files('buildman') tools.print_full_help(str(dirpath.joinpath('README.rst'))) else: with importlib.resources.path('buildman', 'README.rst') as readme: tools.print_full_help(str(readme)) - + return 0 # Build selected commits for selected boards - else: - try: - tout.init(tout.INFO if args.verbose else tout.WARNING) - bsettings.setup(args.config_file) - ret_code = control.do_buildman(args) - finally: - tout.uninit() - return ret_code + try: + tout.init(tout.INFO if args.verbose else tout.WARNING) + bsettings.setup(args.config_file) + ret_code = control.do_buildman(args) + finally: + tout.uninit() + return ret_code if __name__ == "__main__": -- 2.43.0