From 5a0a215bfcee0240018feb6f3ff7f4bce4bcab6a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 15 Apr 2022 14:44:30 +0300 Subject: [PATCH] Use PY3 super() zero-argument syntax --- docs | 2 +- platformio/builder/tools/piolib.py | 4 ++-- platformio/clients/account.py | 4 ++-- platformio/clients/http.py | 8 +++----- platformio/clients/registry.py | 2 +- platformio/commands/__init__.py | 4 ++-- platformio/commands/check/tools/cppcheck.py | 4 ++-- platformio/commands/check/tools/pvsstudio.py | 4 ++-- platformio/commands/device/filters/hexlify.py | 2 +- platformio/commands/device/filters/log2file.py | 2 +- .../commands/device/filters/send_on_enter.py | 2 +- platformio/commands/device/filters/time.py | 2 +- platformio/commands/home/helpers.py | 2 +- platformio/commands/remote/ac/psync.py | 2 +- platformio/commands/remote/factory/ssl.py | 2 +- platformio/debug/config/generic.py | 2 +- platformio/debug/config/jlink.py | 6 ++---- platformio/debug/config/mspdebug.py | 2 +- platformio/debug/config/qemu.py | 2 +- platformio/debug/config/renode.py | 4 ++-- platformio/debug/process/client.py | 6 +++--- platformio/debug/process/gdb.py | 10 +++++----- platformio/debug/process/server.py | 6 +++--- platformio/exception.py | 2 +- platformio/package/exception.py | 2 +- platformio/package/manager/_install.py | 2 +- platformio/package/manager/library.py | 6 +++--- platformio/package/manager/platform.py | 14 +++++--------- platformio/package/manager/tool.py | 8 +++++--- platformio/package/manifest/schema.py | 4 +--- platformio/package/meta.py | 2 +- platformio/package/unpack.py | 10 +++------- platformio/package/vcsclient.py | 2 +- platformio/proc.py | 4 ++-- platformio/telemetry.py | 6 +++--- 35 files changed, 67 insertions(+), 79 deletions(-) diff --git a/docs b/docs index acdba4ba..c6172dce 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit acdba4baeca51d9ea89032a9bc948ccc4a62618f +Subproject commit c6172dcea44d83613fa550f40d89259f96e0722b diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index a63a0f5c..c3e5da14 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -632,7 +632,7 @@ class MbedLibBuilder(LibBuilderBase): def process_extra_options(self): self._process_mbed_lib_confs() - return super(MbedLibBuilder, self).process_extra_options() + return super().process_extra_options() def _process_mbed_lib_confs(self): mbed_lib_paths = [ @@ -851,7 +851,7 @@ class ProjectAsLibBuilder(LibBuilderBase): def __init__(self, env, *args, **kwargs): # backup original value, will be reset in base.__init__ project_src_filter = env.get("SRC_FILTER") - super(ProjectAsLibBuilder, self).__init__(env, *args, **kwargs) + super().__init__(env, *args, **kwargs) self.env["SRC_FILTER"] = project_src_filter @property diff --git a/platformio/clients/account.py b/platformio/clients/account.py index 60349934..2afe6fbe 100644 --- a/platformio/clients/account.py +++ b/platformio/clients/account.py @@ -40,7 +40,7 @@ class AccountClient(HTTPClient): # pylint:disable=too-many-public-methods SUMMARY_CACHE_TTL = 60 * 60 * 24 * 7 def __init__(self): - super(AccountClient, self).__init__(__accounts_api__) + super().__init__(__accounts_api__) @staticmethod def get_refresh_token(): @@ -63,7 +63,7 @@ class AccountClient(HTTPClient): # pylint:disable=too-many-public-methods def fetch_json_data(self, *args, **kwargs): try: - return super(AccountClient, self).fetch_json_data(*args, **kwargs) + return super().fetch_json_data(*args, **kwargs) except HTTPClientError as exc: raise AccountError(exc) from exc diff --git a/platformio/clients/http.py b/platformio/clients/http.py index 70c9cfb8..8c59a47d 100644 --- a/platformio/clients/http.py +++ b/platformio/clients/http.py @@ -28,7 +28,7 @@ from platformio.exception import PlatformioException, UserSideException class HTTPClientError(PlatformioException): def __init__(self, message, response=None): - super(HTTPClientError, self).__init__() + super().__init__() self.message = message self.response = response @@ -47,16 +47,14 @@ class InternetIsOffline(UserSideException): class EndpointSession(requests.Session): def __init__(self, base_url, *args, **kwargs): - super(EndpointSession, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.base_url = base_url def request( # pylint: disable=signature-differs,arguments-differ self, method, url, *args, **kwargs ): # print(self.base_url, method, url, args, kwargs) - return super(EndpointSession, self).request( - method, urljoin(self.base_url, url), *args, **kwargs - ) + return super().request(method, urljoin(self.base_url, url), *args, **kwargs) class EndpointSessionIterator(object): diff --git a/platformio/clients/registry.py b/platformio/clients/registry.py index 1ff6518a..c50d7932 100644 --- a/platformio/clients/registry.py +++ b/platformio/clients/registry.py @@ -21,7 +21,7 @@ from platformio.clients.http import HTTPClient, HTTPClientError class RegistryClient(HTTPClient): def __init__(self): - super(RegistryClient, self).__init__(__registry_api__) + super().__init__(__registry_api__) @staticmethod def allowed_private_packages(): diff --git a/platformio/commands/__init__.py b/platformio/commands/__init__.py index fac8e238..0b923a51 100644 --- a/platformio/commands/__init__.py +++ b/platformio/commands/__init__.py @@ -22,7 +22,7 @@ class PlatformioCLI(click.MultiCommand): leftover_args = [] def __init__(self, *args, **kwargs): - super(PlatformioCLI, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._pio_cmds_dir = os.path.dirname(__file__) @staticmethod @@ -41,7 +41,7 @@ class PlatformioCLI(click.MultiCommand): PlatformioCLI.leftover_args = ctx.args if hasattr(ctx, "protected_args"): PlatformioCLI.leftover_args = ctx.protected_args + ctx.args - return super(PlatformioCLI, self).invoke(ctx) + return super().invoke(ctx) def list_commands(self, ctx): cmds = [] diff --git a/platformio/commands/check/tools/cppcheck.py b/platformio/commands/check/tools/cppcheck.py index 81272947..1c702b60 100644 --- a/platformio/commands/check/tools/cppcheck.py +++ b/platformio/commands/check/tools/cppcheck.py @@ -23,7 +23,7 @@ from platformio.commands.check.tools.base import CheckToolBase class CppcheckCheckTool(CheckToolBase): def __init__(self, *args, **kwargs): - super(CppcheckCheckTool, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._field_delimiter = "<&PIO&>" self._buffer = "" self.defect_fields = [ @@ -207,7 +207,7 @@ class CppcheckCheckTool(CheckToolBase): return self._create_tmp_file("\n".join(result)) def clean_up(self): - super(CppcheckCheckTool, self).clean_up() + super().clean_up() # delete temporary dump files generated by addons if not self.is_flag_set("--addon", self.get_flags("cppcheck")): diff --git a/platformio/commands/check/tools/pvsstudio.py b/platformio/commands/check/tools/pvsstudio.py index d1981817..e59281f9 100644 --- a/platformio/commands/check/tools/pvsstudio.py +++ b/platformio/commands/check/tools/pvsstudio.py @@ -27,7 +27,7 @@ from platformio.compat import IS_WINDOWS class PvsStudioCheckTool(CheckToolBase): # pylint: disable=too-many-instance-attributes def __init__(self, *args, **kwargs): - super(PvsStudioCheckTool, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._tmp_dir = tempfile.mkdtemp(prefix="piocheck") self._tmp_preprocessed_file = self._generate_tmp_file_path() + ".i" self._tmp_output_file = self._generate_tmp_file_path() + ".pvs" @@ -208,7 +208,7 @@ class PvsStudioCheckTool(CheckToolBase): # pylint: disable=too-many-instance-at self._bad_input = True def clean_up(self): - super(PvsStudioCheckTool, self).clean_up() + super().clean_up() if os.path.isdir(self._tmp_dir): shutil.rmtree(self._tmp_dir) diff --git a/platformio/commands/device/filters/hexlify.py b/platformio/commands/device/filters/hexlify.py index 1023b573..7b7538b5 100644 --- a/platformio/commands/device/filters/hexlify.py +++ b/platformio/commands/device/filters/hexlify.py @@ -21,7 +21,7 @@ class Hexlify(DeviceMonitorFilter): NAME = "hexlify" def __init__(self, *args, **kwargs): - super(Hexlify, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._counter = 0 def rx(self, text): diff --git a/platformio/commands/device/filters/log2file.py b/platformio/commands/device/filters/log2file.py index d7199a19..da933625 100644 --- a/platformio/commands/device/filters/log2file.py +++ b/platformio/commands/device/filters/log2file.py @@ -23,7 +23,7 @@ class LogToFile(DeviceMonitorFilter): NAME = "log2file" def __init__(self, *args, **kwargs): - super(LogToFile, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._log_fp = None def __call__(self): diff --git a/platformio/commands/device/filters/send_on_enter.py b/platformio/commands/device/filters/send_on_enter.py index 50b730cc..97fa92a0 100644 --- a/platformio/commands/device/filters/send_on_enter.py +++ b/platformio/commands/device/filters/send_on_enter.py @@ -19,7 +19,7 @@ class SendOnEnter(DeviceMonitorFilter): NAME = "send_on_enter" def __init__(self, *args, **kwargs): - super(SendOnEnter, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._buffer = "" if self.options.get("eol") == "CR": diff --git a/platformio/commands/device/filters/time.py b/platformio/commands/device/filters/time.py index 0c2d8884..6235337a 100644 --- a/platformio/commands/device/filters/time.py +++ b/platformio/commands/device/filters/time.py @@ -21,7 +21,7 @@ class Timestamp(DeviceMonitorFilter): NAME = "time" def __init__(self, *args, **kwargs): - super(Timestamp, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._line_started = False def rx(self, text): diff --git a/platformio/commands/home/helpers.py b/platformio/commands/home/helpers.py index e7407eb9..494e2709 100644 --- a/platformio/commands/home/helpers.py +++ b/platformio/commands/home/helpers.py @@ -26,7 +26,7 @@ class AsyncSession(requests.Session): async def request( # pylint: disable=signature-differs,invalid-overridden-method self, *args, **kwargs ): - func = super(AsyncSession, self).request + func = super().request return await run_in_threadpool(func, *args, **kwargs) diff --git a/platformio/commands/remote/ac/psync.py b/platformio/commands/remote/ac/psync.py index 6773615c..87789ed8 100644 --- a/platformio/commands/remote/ac/psync.py +++ b/platformio/commands/remote/ac/psync.py @@ -25,7 +25,7 @@ class ProjectSyncAsyncCmd(AsyncCommandBase): def __init__(self, *args, **kwargs): self.psync = None self._upstream = None - super(ProjectSyncAsyncCmd, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def start(self): project_dir = os.path.join( diff --git a/platformio/commands/remote/factory/ssl.py b/platformio/commands/remote/factory/ssl.py index a4233a69..78aa5d79 100644 --- a/platformio/commands/remote/factory/ssl.py +++ b/platformio/commands/remote/factory/ssl.py @@ -23,7 +23,7 @@ class SSLContextFactory(ssl.ClientContextFactory): self.certificate_verified = False def getContext(self): - ctx = super(SSLContextFactory, self).getContext() + ctx = super().getContext() ctx.set_verify( SSL.VERIFY_PEER | SSL.VERIFY_FAIL_IF_NO_PEER_CERT, self.verifyHostname ) diff --git a/platformio/debug/config/generic.py b/platformio/debug/config/generic.py index a8c6c410..870aad7b 100644 --- a/platformio/debug/config/generic.py +++ b/platformio/debug/config/generic.py @@ -34,5 +34,5 @@ $INIT_BREAK """ def __init__(self, *args, **kwargs): - super(GenericDebugConfig, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.port = ":3333" diff --git a/platformio/debug/config/jlink.py b/platformio/debug/config/jlink.py index 020decd7..ed5f9966 100644 --- a/platformio/debug/config/jlink.py +++ b/platformio/debug/config/jlink.py @@ -38,11 +38,9 @@ $INIT_BREAK """ def __init__(self, *args, **kwargs): - super(JlinkDebugConfig, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.port = ":2331" @property def server_ready_pattern(self): - return super(JlinkDebugConfig, self).server_ready_pattern or ( - "Waiting for GDB connection" - ) + return super().server_ready_pattern or ("Waiting for GDB connection") diff --git a/platformio/debug/config/mspdebug.py b/platformio/debug/config/mspdebug.py index e71b09ca..86ee8d6a 100644 --- a/platformio/debug/config/mspdebug.py +++ b/platformio/debug/config/mspdebug.py @@ -32,5 +32,5 @@ $INIT_BREAK """ def __init__(self, *args, **kwargs): - super(MspdebugDebugConfig, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.port = ":2000" diff --git a/platformio/debug/config/qemu.py b/platformio/debug/config/qemu.py index d32af5a2..e272a373 100644 --- a/platformio/debug/config/qemu.py +++ b/platformio/debug/config/qemu.py @@ -33,5 +33,5 @@ $INIT_BREAK """ def __init__(self, *args, **kwargs): - super(QemuDebugConfig, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.port = ":1234" diff --git a/platformio/debug/config/renode.py b/platformio/debug/config/renode.py index 3aef5ef8..0a4164de 100644 --- a/platformio/debug/config/renode.py +++ b/platformio/debug/config/renode.py @@ -35,11 +35,11 @@ monitor start """ def __init__(self, *args, **kwargs): - super(RenodeDebugConfig, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.port = ":3333" @property def server_ready_pattern(self): - return super(RenodeDebugConfig, self).server_ready_pattern or ( + return super().server_ready_pattern or ( "GDB server with all CPUs started on port" ) diff --git a/platformio/debug/process/client.py b/platformio/debug/process/client.py index 3a017e7b..d508bdae 100644 --- a/platformio/debug/process/client.py +++ b/platformio/debug/process/client.py @@ -27,7 +27,7 @@ from platformio.project.helpers import get_project_cache_dir class DebugClientProcess(DebugBaseProcess): def __init__(self, project_dir, debug_config): - super(DebugClientProcess, self).__init__() + super().__init__() self.project_dir = project_dir self.debug_config = debug_config @@ -55,7 +55,7 @@ class DebugClientProcess(DebugBaseProcess): self.debug_config.port = await self._server_process.run() def connection_made(self, transport): - super(DebugClientProcess, self).connection_made(transport) + super().connection_made(transport) self._lock_session(transport.get_pid()) # Disable SIGINT and allow GDB's Ctrl+C interrupt signal.signal(signal.SIGINT, lambda *args, **kwargs: None) @@ -64,7 +64,7 @@ class DebugClientProcess(DebugBaseProcess): def process_exited(self): if self._server_process: self._server_process.terminate() - super(DebugClientProcess, self).process_exited() + super().process_exited() def close(self): self._unlock_session() diff --git a/platformio/debug/process/gdb.py b/platformio/debug/process/gdb.py index 1ff395f5..4ce9aebe 100644 --- a/platformio/debug/process/gdb.py +++ b/platformio/debug/process/gdb.py @@ -29,12 +29,12 @@ class GDBClientProcess(DebugClientProcess): INIT_COMPLETED_BANNER = "PlatformIO: Initialization completed" def __init__(self, *args, **kwargs): - super(GDBClientProcess, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._target_is_running = False self._errors_buffer = b"" async def run(self, extra_args): # pylint: disable=arguments-differ - await super(GDBClientProcess, self).run() + await super().run() self.generate_init_script(os.path.join(self.working_dir, self.PIO_SRC_NAME)) gdb_path = self.debug_config.client_executable_path or "gdb" @@ -109,7 +109,7 @@ class GDBClientProcess(DebugClientProcess): fp.write("\n".join(self.debug_config.reveal_patterns(commands))) def stdin_data_received(self, data): - super(GDBClientProcess, self).stdin_data_received(data) + super().stdin_data_received(data) if b"-exec-run" in data: if self._target_is_running: token, _ = data.split(b"-", 1) @@ -127,7 +127,7 @@ class GDBClientProcess(DebugClientProcess): self.transport.get_pipe_transport(0).write(data) def stdout_data_received(self, data): - super(GDBClientProcess, self).stdout_data_received(data) + super().stdout_data_received(data) self._handle_error(data) # go to init break automatically if self.INIT_COMPLETED_BANNER.encode() in data: @@ -170,7 +170,7 @@ class GDBClientProcess(DebugClientProcess): self._target_is_running = True def stderr_data_received(self, data): - super(GDBClientProcess, self).stderr_data_received(data) + super().stderr_data_received(data) self._handle_error(data) def _handle_error(self, data): diff --git a/platformio/debug/process/server.py b/platformio/debug/process/server.py index b2653511..89b4095f 100644 --- a/platformio/debug/process/server.py +++ b/platformio/debug/process/server.py @@ -30,7 +30,7 @@ class DebugServerProcess(DebugBaseProcess): STD_BUFFER_SIZE = 1024 def __init__(self, debug_config): - super(DebugServerProcess, self).__init__() + super().__init__() self.debug_config = debug_config self._ready = False self._std_buffer = {"out": b"", "err": b""} @@ -134,7 +134,7 @@ class DebugServerProcess(DebugBaseProcess): return self._ready def stdout_data_received(self, data): - super(DebugServerProcess, self).stdout_data_received( + super().stdout_data_received( escape_gdbmi_stream("@", data) if is_gdbmi_mode() else data ) self._std_buffer["out"] += data @@ -142,7 +142,7 @@ class DebugServerProcess(DebugBaseProcess): self._std_buffer["out"] = self._std_buffer["out"][-1 * self.STD_BUFFER_SIZE :] def stderr_data_received(self, data): - super(DebugServerProcess, self).stderr_data_received(data) + super().stderr_data_received(data) self._std_buffer["err"] += data self._check_ready_by_pattern(self._std_buffer["err"]) self._std_buffer["err"] = self._std_buffer["err"][-1 * self.STD_BUFFER_SIZE :] diff --git a/platformio/exception.py b/platformio/exception.py index ef1d3bab..7b52ecae 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -22,7 +22,7 @@ class PlatformioException(Exception): # pylint: disable=not-an-iterable return self.MESSAGE.format(*self.args) - return super(PlatformioException, self).__str__() + return super().__str__() class ReturnErrorCode(PlatformioException): diff --git a/platformio/package/exception.py b/platformio/package/exception.py index 5d63649e..580137a0 100644 --- a/platformio/package/exception.py +++ b/platformio/package/exception.py @@ -34,7 +34,7 @@ class ManifestParserError(ManifestException): class ManifestValidationError(ManifestException): def __init__(self, messages, data, valid_data): - super(ManifestValidationError, self).__init__() + super().__init__() self.messages = messages self.data = data self.valid_data = valid_data diff --git a/platformio/package/manager/_install.py b/platformio/package/manager/_install.py index c9863a65..8129d9b0 100644 --- a/platformio/package/manager/_install.py +++ b/platformio/package/manager/_install.py @@ -64,7 +64,7 @@ class PackageManagerInstallMixin(object): # avoid circle dependencies if not self._INSTALL_HISTORY: self._INSTALL_HISTORY = {} - if spec in self._INSTALL_HISTORY: + if not force and spec in self._INSTALL_HISTORY: return self._INSTALL_HISTORY[spec] # check if package is already installed diff --git a/platformio/package/manager/library.py b/platformio/package/manager/library.py index 2be81196..802e0cfd 100644 --- a/platformio/package/manager/library.py +++ b/platformio/package/manager/library.py @@ -24,7 +24,7 @@ from platformio.project.config import ProjectConfig class LibraryPackageManager(BasePackageManager): # pylint: disable=too-many-ancestors def __init__(self, package_dir=None): - super(LibraryPackageManager, self).__init__( + super().__init__( PackageType.LIBRARY, package_dir or ProjectConfig.get_instance().get("platformio", "globallib_dir"), @@ -36,7 +36,7 @@ class LibraryPackageManager(BasePackageManager): # pylint: disable=too-many-anc def find_pkg_root(self, path, spec): try: - return super(LibraryPackageManager, self).find_pkg_root(path, spec) + return super().find_pkg_root(path, spec) except MissingPackageManifestError: pass assert isinstance(spec, PackageSpec) @@ -86,5 +86,5 @@ class LibraryPackageManager(BasePackageManager): # pylint: disable=too-many-anc if not any(not_builtin_conds): not_builtin_conds.append(not is_builtin_lib(spec.name)) if any(not_builtin_conds): - return super(LibraryPackageManager, self).install_dependency(dependency) + return super().install_dependency(dependency) return None diff --git a/platformio/package/manager/platform.py b/platformio/package/manager/platform.py index 608b9ca0..6d0cc040 100644 --- a/platformio/package/manager/platform.py +++ b/platformio/package/manager/platform.py @@ -29,7 +29,7 @@ from platformio.project.config import ProjectConfig class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-ancestors def __init__(self, package_dir=None): self.config = ProjectConfig.get_instance() - super(PlatformPackageManager, self).__init__( + super().__init__( PackageType.PLATFORM, package_dir or self.config.get("platformio", "platforms_dir"), ) @@ -47,16 +47,14 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an project_targets=None, ): already_installed = self.get_package(spec) - pkg = super(PlatformPackageManager, self).install( - spec, force=force, skip_dependencies=True - ) + pkg = super().install(spec, force=force, skip_dependencies=True) try: p = PlatformFactory.new(pkg) # set logging level for underlying tool manager p.pm.set_log_level(self.log.getEffectiveLevel()) p.ensure_engine_compatible() except IncompatiblePlatform as e: - super(PlatformPackageManager, self).uninstall(pkg, skip_dependencies=True) + super().uninstall(pkg, skip_dependencies=True) raise e if project_env: p.configure_project_packages(project_env, project_targets) @@ -79,9 +77,7 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an p.configure_project_packages(project_env) if not skip_dependencies: p.uninstall_packages() - assert super(PlatformPackageManager, self).uninstall( - pkg, skip_dependencies=True - ) + assert super().uninstall(pkg, skip_dependencies=True) p.on_uninstalled() return pkg @@ -95,7 +91,7 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an pkg = self.get_package(from_spec) if not pkg or not pkg.metadata: raise UnknownPackageError(from_spec) - pkg = super(PlatformPackageManager, self).update( + pkg = super().update( from_spec, to_spec, ) diff --git a/platformio/package/manager/tool.py b/platformio/package/manager/tool.py index 70a76377..0919a33e 100644 --- a/platformio/package/manager/tool.py +++ b/platformio/package/manager/tool.py @@ -19,9 +19,11 @@ from platformio.project.config import ProjectConfig class ToolPackageManager(BasePackageManager): # pylint: disable=too-many-ancestors def __init__(self, package_dir=None): - if not package_dir: - package_dir = ProjectConfig.get_instance().get("platformio", "packages_dir") - super(ToolPackageManager, self).__init__(PackageType.TOOL, package_dir) + super().__init__( + PackageType.TOOL, + package_dir + or ProjectConfig.get_instance().get("platformio", "packages_dir"), + ) @property def manifest_names(self): diff --git a/platformio/package/manifest/schema.py b/platformio/package/manifest/schema.py index 6dc8764a..aa056f9a 100644 --- a/platformio/package/manifest/schema.py +++ b/platformio/package/manifest/schema.py @@ -59,9 +59,7 @@ class StrictListField(fields.List): self, value, attr, data, **kwargs ): try: - return super(StrictListField, self)._deserialize( - value, attr, data, **kwargs - ) + return super()._deserialize(value, attr, data, **kwargs) except ValidationError as exc: if exc.data: exc.data = [item for item in exc.data if item is not None] diff --git a/platformio/package/meta.py b/platformio/package/meta.py index d712ac7d..cd0791de 100644 --- a/platformio/package/meta.py +++ b/platformio/package/meta.py @@ -91,7 +91,7 @@ class PackageOutdatedResult(object): and not isinstance(value, semantic_version.Version) ): value = cast_version_to_semver(str(value)) - return super(PackageOutdatedResult, self).__setattr__(name, value) + return super().__setattr__(name, value) @property def update_increment_type(self): diff --git a/platformio/package/unpack.py b/platformio/package/unpack.py index ede07589..d8544a25 100644 --- a/platformio/package/unpack.py +++ b/platformio/package/unpack.py @@ -57,9 +57,7 @@ class BaseArchiver(object): class TARArchiver(BaseArchiver): def __init__(self, archpath): - super(TARArchiver, self).__init__( - tarfile_open(archpath) # pylint: disable=consider-using-with - ) + super().__init__(tarfile_open(archpath)) # pylint: disable=consider-using-with def get_items(self): return self._afo.getmembers() @@ -90,7 +88,7 @@ class TARArchiver(BaseArchiver): self.is_link(item) and self.is_bad_link(item, dest_dir), ] if not any(bad_conds): - super(TARArchiver, self).extract_item(item, dest_dir) + super().extract_item(item, dest_dir) else: click.secho( "Blocked insecure item `%s` from TAR archive" % item.name, @@ -101,9 +99,7 @@ class TARArchiver(BaseArchiver): class ZIPArchiver(BaseArchiver): def __init__(self, archpath): - super(ZIPArchiver, self).__init__( - ZipFile(archpath) # pylint: disable=consider-using-with - ) + super().__init__(ZipFile(archpath)) # pylint: disable=consider-using-with @staticmethod def preserve_permissions(item, dest_dir): diff --git a/platformio/package/vcsclient.py b/platformio/package/vcsclient.py index ca16c3f4..ab404871 100644 --- a/platformio/package/vcsclient.py +++ b/platformio/package/vcsclient.py @@ -131,7 +131,7 @@ class GitClient(VCSClientBase): def __init__(self, *args, **kwargs): self.configure() - super(GitClient, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) @classmethod def configure(cls): diff --git a/platformio/proc.py b/platformio/proc.py index f041d61c..83943273 100644 --- a/platformio/proc.py +++ b/platformio/proc.py @@ -62,7 +62,7 @@ class BuildAsyncPipe(AsyncPipeBase): def __init__(self, line_callback, data_callback): self.line_callback = line_callback self.data_callback = data_callback - super(BuildAsyncPipe, self).__init__() + super().__init__() def do_reading(self): line = "" @@ -95,7 +95,7 @@ class BuildAsyncPipe(AsyncPipeBase): class LineBufferedAsyncPipe(AsyncPipeBase): def __init__(self, line_callback): self.line_callback = line_callback - super(LineBufferedAsyncPipe, self).__init__() + super().__init__() def do_reading(self): for line in iter(self._pipe_reader.readline, ""): diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 6b133565..2792d5c6 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -64,7 +64,7 @@ class MeasurementProtocol(TelemetryBase): } def __init__(self): - super(MeasurementProtocol, self).__init__() + super().__init__() self["v"] = 1 self["tid"] = self.TID self["cid"] = app.get_cid() @@ -82,12 +82,12 @@ class MeasurementProtocol(TelemetryBase): def __getitem__(self, name): if name in self.PARAMS_MAP: name = self.PARAMS_MAP[name] - return super(MeasurementProtocol, self).__getitem__(name) + return super().__getitem__(name) def __setitem__(self, name, value): if name in self.PARAMS_MAP: name = self.PARAMS_MAP[name] - super(MeasurementProtocol, self).__setitem__(name, value) + super().__setitem__(name, value) def _prefill_appinfo(self): self["av"] = __version__