diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index 7dd36a64..dc7f67bf 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -52,6 +52,7 @@ def BoardConfig(env, board=None): except (AssertionError, UnknownBoard) as e: sys.stderr.write("Error: %s\n" % str(e)) env.Exit(1) + return None def GetFrameworkScript(env, framework): diff --git a/platformio/commands/check/tools/cppcheck.py b/platformio/commands/check/tools/cppcheck.py index 46d15d07..eb7197b2 100644 --- a/platformio/commands/check/tools/cppcheck.py +++ b/platformio/commands/check/tools/cppcheck.py @@ -230,7 +230,7 @@ class CppcheckCheckTool(CheckToolBase): project_files = self.get_project_target_files(self.options["patterns"]) languages = ("c", "c++") - if not any([project_files[t] for t in languages]): + if not any(project_files[t] for t in languages): click.echo("Error: Nothing to check.") return True for language in languages: diff --git a/platformio/commands/debug/helpers.py b/platformio/commands/debug/helpers.py index 7561c338..e2935b5a 100644 --- a/platformio/commands/debug/helpers.py +++ b/platformio/commands/debug/helpers.py @@ -192,7 +192,7 @@ def configure_esp32_load_cmds(debug_options, configuration): debug_options["load_cmds"] != ["load"], "xtensa-esp32" not in configuration.get("cc_path", ""), not flash_images, - not all([isfile(item["path"]) for item in flash_images]), + not all(isfile(item["path"]) for item in flash_images), ] if any(ignore_conds): return debug_options["load_cmds"] diff --git a/platformio/commands/home/rpc/handlers/project.py b/platformio/commands/home/rpc/handlers/project.py index c8ec6f54..39fa6c12 100644 --- a/platformio/commands/home/rpc/handlers/project.py +++ b/platformio/commands/home/rpc/handlers/project.py @@ -257,15 +257,13 @@ class ProjectRPC: return arduino_project_dir is_arduino_project = any( - [ - os.path.isfile( - os.path.join( - arduino_project_dir, - "%s.%s" % (os.path.basename(arduino_project_dir), ext), - ) + os.path.isfile( + os.path.join( + arduino_project_dir, + "%s.%s" % (os.path.basename(arduino_project_dir), ext), ) - for ext in ("ino", "pde") - ] + ) + for ext in ("ino", "pde") ) if not is_arduino_project: raise jsonrpc.exceptions.JSONRPCDispatchException( diff --git a/platformio/commands/test/command.py b/platformio/commands/test/command.py index a4b6634f..8ebda932 100644 --- a/platformio/commands/test/command.py +++ b/platformio/commands/test/command.py @@ -128,9 +128,9 @@ def cli( # pylint: disable=redefined-builtin not environment and default_envs and envname not in default_envs, testname != "*" and patterns["filter"] - and not any([fnmatch(testname, p) for p in patterns["filter"]]), + and not any(fnmatch(testname, p) for p in patterns["filter"]), testname != "*" - and any([fnmatch(testname, p) for p in patterns["ignore"]]), + and any(fnmatch(testname, p) for p in patterns["ignore"]), ] if any(skip_conditions): results.append({"env": envname, "test": testname}) diff --git a/platformio/commands/test/embedded.py b/platformio/commands/test/embedded.py index ca658496..02bf675b 100644 --- a/platformio/commands/test/embedded.py +++ b/platformio/commands/test/embedded.py @@ -95,7 +95,7 @@ class EmbeddedTestProcessor(TestProcessorBase): if isinstance(line, bytes): line = line.decode("utf8", "ignore") self.on_run_out(line) - if all([l in line for l in ("Tests", "Failures", "Ignored")]): + if all(l in line for l in ("Tests", "Failures", "Ignored")): break ser.close() return not self._run_failed diff --git a/platformio/package/manifest/parser.py b/platformio/package/manifest/parser.py index 4dd4476d..f3d35559 100644 --- a/platformio/package/manifest/parser.py +++ b/platformio/package/manifest/parser.py @@ -568,6 +568,7 @@ class LibraryPropertiesManifestParser(BaseManifestParser): continue found = True item["maintainer"] = True + # pylint: disable=unsupported-membership-test if not item.get("email") and email and "@" in email: item["email"] = email if not found: diff --git a/platformio/platform/base.py b/platformio/platform/base.py index 81d9b085..3cadbd73 100644 --- a/platformio/platform/base.py +++ b/platformio/platform/base.py @@ -252,6 +252,7 @@ class PlatformBase( # pylint: disable=too-many-instance-attributes,too-many-pub click.secho( "Could not install Python packages -> %s" % e, fg="red", err=True ) + return None def uninstall_python_packages(self): if not self.python_packages: diff --git a/tests/commands/test_boards.py b/tests/commands/test_boards.py index 21142dd4..244f0b70 100644 --- a/tests/commands/test_boards.py +++ b/tests/commands/test_boards.py @@ -23,7 +23,7 @@ def test_board_json_output(clirunner, validate_cliresult): validate_cliresult(result) boards = json.loads(result.output) assert isinstance(boards, list) - assert any(["mbed" in b["frameworks"] for b in boards]) + assert any("mbed" in b["frameworks"] for b in boards) def test_board_raw_output(clirunner, validate_cliresult): diff --git a/tests/commands/test_init.py b/tests/commands/test_init.py index 09bd8cf9..49db3560 100644 --- a/tests/commands/test_init.py +++ b/tests/commands/test_init.py @@ -70,10 +70,8 @@ def test_init_ide_vscode(clirunner, validate_cliresult, tmpdir): validate_cliresult(result) validate_pioproject(str(tmpdir)) assert all( - [ - tmpdir.join(".vscode").join(f).check() - for f in ("c_cpp_properties.json", "launch.json") - ] + tmpdir.join(".vscode").join(f).check() + for f in ("c_cpp_properties.json", "launch.json") ) assert ( "framework-arduino-avr" @@ -113,7 +111,7 @@ def test_init_ide_eclipse(clirunner, validate_cliresult): result = clirunner.invoke(cmd_init, ["-b", "uno", "--ide", "eclipse"]) validate_cliresult(result) validate_pioproject(getcwd()) - assert all([isfile(f) for f in (".cproject", ".project")]) + assert all(isfile(f) for f in (".cproject", ".project")) def test_init_special_board(clirunner, validate_cliresult): diff --git a/tests/commands/test_lib_complex.py b/tests/commands/test_lib_complex.py index c1314500..5b19c30e 100644 --- a/tests/commands/test_lib_complex.py +++ b/tests/commands/test_lib_complex.py @@ -172,27 +172,23 @@ def test_global_lib_list(clirunner, validate_cliresult): result = clirunner.invoke(cmd_lib, ["-g", "list"]) validate_cliresult(result) assert all( - [ - n in result.output - for n in ( - "Source: https://github.com/Pedroalbuquerque/ESP32WebServer/archive/master.zip", - "Version: 5.10.1", - "Source: git+https://github.com/gioblu/PJON.git#3.0", - "Version: 3.0.0+sha.1fb26fd", - ) - ] + n in result.output + for n in ( + "Source: https://github.com/Pedroalbuquerque/ESP32WebServer/archive/master.zip", + "Version: 5.10.1", + "Source: git+https://github.com/gioblu/PJON.git#3.0", + "Version: 3.0.0+sha.1fb26fd", + ) ) result = clirunner.invoke(cmd_lib, ["-g", "list", "--json-output"]) assert all( - [ - n in result.output - for n in ( - "__pkg_dir", - '"__src_url": "git+https://github.com/gioblu/PJON.git#6.2"', - '"version": "5.10.1"', - ) - ] + n in result.output + for n in ( + "__pkg_dir", + '"__src_url": "git+https://github.com/gioblu/PJON.git#6.2"', + '"version": "5.10.1"', + ) ) items1 = [i["name"] for i in json.loads(result.output)] items2 = [ @@ -316,7 +312,7 @@ def test_global_lib_uninstall(clirunner, validate_cliresult, isolated_pio_core): def test_lib_show(clirunner, validate_cliresult): result = clirunner.invoke(cmd_lib, ["show", "64"]) validate_cliresult(result) - assert all([s in result.output for s in ("ArduinoJson", "Arduino", "Atmel AVR")]) + assert all(s in result.output for s in ("ArduinoJson", "Arduino", "Atmel AVR")) result = clirunner.invoke(cmd_lib, ["show", "OneWire", "--json-output"]) validate_cliresult(result) assert "OneWire" in result.output @@ -333,10 +329,8 @@ def test_lib_stats(clirunner, validate_cliresult): result = clirunner.invoke(cmd_lib, ["stats"]) validate_cliresult(result) assert all( - [ - s in result.output - for s in ("UPDATED", "POPULAR", "https://platformio.org/lib/show") - ] + s in result.output + for s in ("UPDATED", "POPULAR", "https://platformio.org/lib/show") ) result = clirunner.invoke(cmd_lib, ["stats", "--json-output"]) diff --git a/tests/commands/test_platform.py b/tests/commands/test_platform.py index 704543ad..508eae22 100644 --- a/tests/commands/test_platform.py +++ b/tests/commands/test_platform.py @@ -103,7 +103,7 @@ def test_list_json_output(clirunner, validate_cliresult): def test_list_raw_output(clirunner, validate_cliresult): result = clirunner.invoke(cli_platform.platform_list) validate_cliresult(result) - assert all([s in result.output for s in ("atmelavr", "espressif8266")]) + assert all(s in result.output for s in ("atmelavr", "espressif8266")) def test_update_check(clirunner, validate_cliresult, isolated_pio_core): diff --git a/tests/commands/test_test.py b/tests/commands/test_test.py index 4543ad92..08642eaf 100644 --- a/tests/commands/test_test.py +++ b/tests/commands/test_test.py @@ -34,7 +34,7 @@ def test_local_env(): if result["returncode"] != 1: pytest.fail(str(result)) # pylint: disable=unsupported-membership-test - assert all([s in result["err"] for s in ("PASSED", "FAILED")]), result["out"] + assert all(s in result["err"] for s in ("PASSED", "FAILED")), result["out"] def test_multiple_env_build(clirunner, validate_cliresult, tmpdir): diff --git a/tests/commands/test_update.py b/tests/commands/test_update.py index b9ecb5c1..90cb09c7 100644 --- a/tests/commands/test_update.py +++ b/tests/commands/test_update.py @@ -21,7 +21,7 @@ def test_update(clirunner, validate_cliresult, isolated_pio_core): matches = ("Platform Manager", "Library Manager") result = clirunner.invoke(cmd_update, ["--only-check"]) validate_cliresult(result) - assert all([m in result.output for m in matches]) + assert all(m in result.output for m in matches) result = clirunner.invoke(cmd_update) validate_cliresult(result) - assert all([m in result.output for m in matches]) + assert all(m in result.output for m in matches)