From 0dca10a5beef4c1b85ad2e70f85aa006eae54a44 Mon Sep 17 00:00:00 2001 From: Sergey Kosukhin Date: Thu, 25 Apr 2024 15:23:03 +0200 Subject: [PATCH] depgen.py/deplist.py: address IDE warnings and suggestions. --- mkhelper/depgen.py | 2 +- mkhelper/depgen/__init__.py | 2 ++ mkhelper/depgen/fortran_parser.py | 3 ++- mkhelper/depgen/preprocessor.py | 2 +- mkhelper/deplist.py | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mkhelper/depgen.py b/mkhelper/depgen.py index c94c82a..070746d 100755 --- a/mkhelper/depgen.py +++ b/mkhelper/depgen.py @@ -460,7 +460,7 @@ def module_start_callback(module): def module_use_callback(module): required_modules.add(module) - def submodule_start_callback(submodule, parent, module): + def submodule_start_callback(_submodule, _parent, module): required_modules.add(module) lc_debug_info = None diff --git a/mkhelper/depgen/__init__.py b/mkhelper/depgen/__init__.py index 7cab4b6..c066255 100644 --- a/mkhelper/depgen/__init__.py +++ b/mkhelper/depgen/__init__.py @@ -34,6 +34,7 @@ try: from itertools import zip_longest as zip_longest23 except ImportError: + # noinspection PyUnresolvedReferences from itertools import izip_longest as zip_longest23 @@ -41,6 +42,7 @@ def open23(name, mode="r"): if sys.version_info < (3, 0, 0): return open(name, mode) else: + # noinspection PyArgumentList return open(name, mode, encoding="latin-1") diff --git a/mkhelper/depgen/fortran_parser.py b/mkhelper/depgen/fortran_parser.py index 14646c5..128528f 100644 --- a/mkhelper/depgen/fortran_parser.py +++ b/mkhelper/depgen/fortran_parser.py @@ -40,7 +40,7 @@ class FortranParser: - _re_include = re.compile(r'^\s*include\s+(\'|")(.*?)\1', re.I) + _re_include = re.compile(r'^\s*include\s+([\'"])(.*?)\1', re.I) _re_line_continue_start = re.compile(r"^(.*)&\s*$") _re_line_continue_end = re.compile(r"^\s*&") _re_module_start = re.compile( @@ -212,6 +212,7 @@ def parse(self, stream, stream_name): # return an empty iterator return + # noinspection PyUnreachableCode yield @staticmethod diff --git a/mkhelper/depgen/preprocessor.py b/mkhelper/depgen/preprocessor.py index f30bb18..6f05917 100644 --- a/mkhelper/depgen/preprocessor.py +++ b/mkhelper/depgen/preprocessor.py @@ -409,5 +409,5 @@ def eval_expression(self, expr): try: result = bool(eval(expr, {})) return 1 if result else -1 - except: + except Exception: return 0 diff --git a/mkhelper/deplist.py b/mkhelper/deplist.py index 7045d71..383bc7f 100755 --- a/mkhelper/deplist.py +++ b/mkhelper/deplist.py @@ -498,7 +498,7 @@ def check_cycles_skip_visit_cb(vertex): args.check_colour, ) - def check_cycles_finish_visit_cb(vertex): + def check_cycles_finish_visit_cb(_): path.pop() start_visit_cb_list.append(check_cycles_start_visit_cb)