diff -r c3cf24fe9113 -r f8371a2dd08f src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py --- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py Tue Oct 22 17:22:53 2024 +0200 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Miscellaneous/MiscellaneousChecker.py Tue Oct 22 17:49:41 2024 +0200 @@ -40,7 +40,6 @@ from .eradicate import Eradicator from .MiscellaneousDefaults import MiscellaneousCheckerDefaultArgs - BugbearMutableLiterals = ("Dict", "List", "Set") BugbearMutableComprehensions = ("ListComp", "DictComp", "SetComp") BugbearMutableCalls = ( @@ -1647,12 +1646,14 @@ BugBearContext = namedtuple("BugBearContext", ["node", "stack"]) + @dataclass class M540CaughtException: """ Class to hold the data for a caught exception. """ - name : str + + name: str hasNote: bool @@ -2044,10 +2045,7 @@ names = self.__checkForM513_M529_M530(node) - if ( - "BaseException" in names - and not ExceptBaseExceptionVisitor(node).reRaised() - ): + if "BaseException" in names and not ExceptBaseExceptionVisitor(node).reRaised(): self.violations.append((node, "M536")) self.generic_visit(node) @@ -2504,6 +2502,8 @@ @param node reference to the node to be processed @type ast.ExceptHandler + @return list of exception handler names + @rtype list of str """ handlers = self.__flattenExcepthandler(node.type) names = [] @@ -2651,8 +2651,7 @@ # Preserve decorator order so we can get the lineno from the decorator node # rather than the function node (this location definition changes in Python 3.8) resolvedDecorators = ( - ".".join(composeCallPath(decorator)) - for decorator in node.decorator_list + ".".join(composeCallPath(decorator)) for decorator in node.decorator_list ) for idx, decorator in enumerate(resolvedDecorators): if decorator in {"classmethod", "staticmethod"}: @@ -3118,7 +3117,8 @@ @param node reference to the node to be processed @type ast.expr or None - """ + """ # noqa: D234y + def superwalk(node: ast.AST | list[ast.AST]): """ Function to walk an AST node or a list of AST nodes. @@ -3483,7 +3483,7 @@ if callPath == "float" and len(node.args) == 1: try: value = float(ast.literal_eval(node.args[0])) - except Exception: + except Exception: # secok pass else: if math.isfinite(value):