diff -r f706be800097 -r b41c9a7bcbbb src/eric7/Plugins/CheckerPlugins/SyntaxChecker/pyCheckSyntax.py --- a/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/pyCheckSyntax.py Sun Mar 19 16:16:28 2023 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/pyCheckSyntax.py Mon Mar 20 10:43:29 2023 +0100 @@ -86,7 +86,11 @@ def pySyntaxAndPyflakesCheck( - filename, codestring, checkFlakes=True, ignoreStarImportWarnings=False + filename, + codestring, + checkFlakes=True, + ignoreStarImportWarnings=False, + additionalBuiltins=None, ): """ Function to compile one Python source file to Python bytecode @@ -100,6 +104,8 @@ @type bool @param ignoreStarImportWarnings flag indicating to ignore 'star import' warnings @type bool + @param additionalBuiltins list of names pyflakes should consider as builtins + @type list of str @return dictionary with the keys 'error' and 'warnings' which hold a list containing details about the error/warnings (file name, line number, column, codestring (only at syntax @@ -107,7 +113,7 @@ @rtype dict """ return __pySyntaxAndPyflakesCheck( - filename, codestring, checkFlakes, ignoreStarImportWarnings + filename, codestring, checkFlakes, ignoreStarImportWarnings, additionalBuiltins ) @@ -201,15 +207,19 @@ @type multiprocessing.Queue """ for filename, args in iter(inputQueue.get, "STOP"): - source, checkFlakes, ignoreStarImportWarnings = args + source, checkFlakes, ignoreStarImportWarnings, additionalBuiltins = args result = __pySyntaxAndPyflakesCheck( - filename, source, checkFlakes, ignoreStarImportWarnings + filename, source, checkFlakes, ignoreStarImportWarnings, additionalBuiltins ) outputQueue.put((filename, result)) def __pySyntaxAndPyflakesCheck( - filename, codestring, checkFlakes=True, ignoreStarImportWarnings=False + filename, + codestring, + checkFlakes=True, + ignoreStarImportWarnings=False, + additionalBuiltins=None, ): """ Function to compile one Python source file to Python bytecode @@ -224,6 +234,8 @@ @param ignoreStarImportWarnings flag indicating to ignore 'star import' warnings @type bool + @param additionalBuiltins list of names pyflakes should consider as builtins + @type list of str @return dictionary with the keys 'error' and 'warnings' which hold a list containing details about the error/ warnings (file name, line number, column, codestring (only at syntax @@ -298,7 +310,9 @@ results = [] lines = codestring.splitlines() try: - warnings = Checker(module, filename, withDoctest=True) + warnings = Checker( + module, filename, builtins=additionalBuiltins, withDoctest=True + ) warnings.messages.sort(key=lambda a: a.lineno) for warning in warnings.messages: if ignoreStarImportWarnings and isinstance(