From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36367C433EF for ; Mon, 10 Jan 2022 03:21:02 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 711FD834A8; Mon, 10 Jan 2022 04:16:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Ib8049Si"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4F9F4830A1; Mon, 10 Jan 2022 04:15:57 +0100 (CET) Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1060E83103 for ; Mon, 10 Jan 2022 04:15:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd30.google.com with SMTP id q5so15717695ioj.7 for ; Sun, 09 Jan 2022 19:15:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q78H22+M2xZJiWtrZqKYQI5BVUovD0OPQMEXdcypn0U=; b=Ib8049SixVapMJza1aaY1ZQ8U6gBJHqXhKkxl2yMwu08Bssq59g7vvqazyYBMwaMGC WQc7MkalDQ9PyumrUtqhk7jE8yt2GEwl5V2uuKiNtPAxkAHqRsfpx9H0/7KBemtIfCow mJcGKAtR3JIx/psjCww2TNq762qfFCGjPAoJk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q78H22+M2xZJiWtrZqKYQI5BVUovD0OPQMEXdcypn0U=; b=WaHrpu2bIgQixK7+bffJKgHUHXpchAJQiprXxDz5Jqss65QO3iBkBDyVJoJ9JJBBi9 ZihLyx4gobOzlkGjskutV4Wj9ktliAccPvjmuAgp5qrk8w6EG0DJaRIhe2aUyCC2sh5W pVXKHcQcwL3ZoHM0ZlSBaVY4mUPXadUsVG5uNm6/9HINECbObILFzHPUtuF1XgIDzL2i frP8bz7efKmI6K28yLFw+a3LqActkmftFN5MIhGBA92u7fMPKhboQdnkKUGify/6onf5 +LcizC1RsuqPgdjkN99jgYU7nrtJY+8rhH0FjZXGgdIVYXibxSfjhnjkg478864ARGcs RrmA== X-Gm-Message-State: AOAM5334Jy8AHIxXCXrcQfUoeeShCBZbL+QCEKl6UFebR6DJE3J65P0E H6fWgeQnu6wpLUQKXVR1ZSAYP7YDdwGUDw== X-Google-Smtp-Source: ABdhPJyRK9koqhRCaDxVU1prul6qRzYe55qQiQLmg6vT8jbGoH3iLGSaFU9kwWti1BcirXtf7XLQbw== X-Received: by 2002:a02:7747:: with SMTP id g68mr2312749jac.3.1641784525624; Sun, 09 Jan 2022 19:15:25 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id d16sm3542182ioy.29.2022.01.09.19.15.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jan 2022 19:15:25 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 29/38] binman: Tidy up pylint warnings in comp_util Date: Sun, 9 Jan 2022 20:14:04 -0700 Message-Id: <20220110031413.1970836-30-sjg@chromium.org> X-Mailer: git-send-email 2.34.1.575.g55b058a8bb-goog In-Reply-To: <20220110031413.1970836-1-sjg@chromium.org> References: <20220110031413.1970836-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Tweak some naming and comments to resolve these. Use WriteFile() to write the file. Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/cbfs_util.py | 8 ++++---- tools/binman/comp_util.py | 19 +++++++++---------- tools/binman/entry.py | 2 +- tools/binman/etype/section.py | 2 +- tools/binman/ftest.py | 8 ++++---- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/tools/binman/cbfs_util.py b/tools/binman/cbfs_util.py index 2b4178a6854..eea7868b16c 100644 --- a/tools/binman/cbfs_util.py +++ b/tools/binman/cbfs_util.py @@ -241,9 +241,9 @@ class CbfsFile(object): """Handle decompressing data if necessary""" indata = self.data if self.compress == COMPRESS_LZ4: - data = comp_util.Decompress(indata, 'lz4', with_header=False) + data = comp_util.decompress(indata, 'lz4', with_header=False) elif self.compress == COMPRESS_LZMA: - data = comp_util.Decompress(indata, 'lzma', with_header=False) + data = comp_util.decompress(indata, 'lzma', with_header=False) else: data = indata self.memlen = len(data) @@ -362,9 +362,9 @@ class CbfsFile(object): elif self.ftype == TYPE_RAW: orig_data = data if self.compress == COMPRESS_LZ4: - data = comp_util.Compress(orig_data, 'lz4', with_header=False) + data = comp_util.compress(orig_data, 'lz4', with_header=False) elif self.compress == COMPRESS_LZMA: - data = comp_util.Compress(orig_data, 'lzma', with_header=False) + data = comp_util.compress(orig_data, 'lzma', with_header=False) self.memlen = len(orig_data) self.data_len = len(data) attr = struct.pack(ATTR_COMPRESSION_FORMAT, diff --git a/tools/binman/comp_util.py b/tools/binman/comp_util.py index 541e1919dd6..7e741cb62cc 100644 --- a/tools/binman/comp_util.py +++ b/tools/binman/comp_util.py @@ -8,7 +8,7 @@ import tempfile from patman import tools -def Compress(indata, algo, with_header=True): +def compress(indata, algo, with_header=True): """Compress some data using a given algorithm Note that for lzma this uses an old version of the algorithm, not that @@ -21,11 +21,11 @@ def Compress(indata, algo, with_header=True): called from multiple threads. Args: - indata: Input data to compress - algo: Algorithm to use ('none', 'gzip', 'lz4' or 'lzma') + indata (bytes): Input data to compress + algo (str): Algorithm to use ('none', 'gzip', 'lz4' or 'lzma') Returns: - Compressed data + bytes: Compressed data """ if algo == 'none': return indata @@ -51,7 +51,7 @@ def Compress(indata, algo, with_header=True): data = hdr + data return data -def Decompress(indata, algo, with_header=True): +def decompress(indata, algo, with_header=True): """Decompress some data using a given algorithm Note that for lzma this uses an old version of the algorithm, not that @@ -61,11 +61,11 @@ def Decompress(indata, algo, with_header=True): directory to be previously set up, by calling PrepareOutputDir(). Args: - indata: Input data to decompress - algo: Algorithm to use ('none', 'gzip', 'lz4' or 'lzma') + indata (bytes): Input data to decompress + algo (str): Algorithm to use ('none', 'gzip', 'lz4' or 'lzma') Returns: - Compressed data + (bytes) Compressed data """ if algo == 'none': return indata @@ -73,8 +73,7 @@ def Decompress(indata, algo, with_header=True): data_len = struct.unpack('