From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 5/6] tests/functional: Fix problems in uncompress.py reported by pylint
Date: Wed, 15 Oct 2025 11:54:53 +0200 [thread overview]
Message-ID: <20251015095454.1575318-6-thuth@redhat.com> (raw)
In-Reply-To: <20251015095454.1575318-1-thuth@redhat.com>
From: Thomas Huth <thuth@redhat.com>
- put the doc strings in the right locations (after the "def" line)
- use isinstance() instead of checking via type()
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/qemu_test/uncompress.py | 40 ++++++++++++------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/tests/functional/qemu_test/uncompress.py b/tests/functional/qemu_test/uncompress.py
index b7ef8f759b7..5bbdf8fe323 100644
--- a/tests/functional/qemu_test/uncompress.py
+++ b/tests/functional/qemu_test/uncompress.py
@@ -58,20 +58,20 @@ def zstd_uncompress(zstd_path, output_path):
os.chmod(output_path, stat.S_IRUSR | stat.S_IWUSR)
-'''
-@params compressed: filename, Asset, or file-like object to uncompress
-@params uncompressed: filename to uncompress into
-@params format: optional compression format (gzip, lzma)
+def uncompress(compressed, uncompressed, format=None):
+ '''
+ @params compressed: filename, Asset, or file-like object to uncompress
+ @params uncompressed: filename to uncompress into
+ @params format: optional compression format (gzip, lzma)
-Uncompresses @compressed into @uncompressed
+ Uncompresses @compressed into @uncompressed
-If @format is None, heuristics will be applied to guess the format
-from the filename or Asset URL. @format must be non-None if @uncompressed
-is a file-like object.
+ If @format is None, heuristics will be applied to guess the
+ format from the filename or Asset URL. @format must be non-None
+ if @uncompressed is a file-like object.
-Returns the fully qualified path to the uncompessed file
-'''
-def uncompress(compressed, uncompressed, format=None):
+ Returns the fully qualified path to the uncompessed file
+ '''
if format is None:
format = guess_uncompress_format(compressed)
@@ -84,19 +84,19 @@ def uncompress(compressed, uncompressed, format=None):
else:
raise Exception(f"Unknown compression format {format}")
-'''
-@params compressed: filename, Asset, or file-like object to guess
-
-Guess the format of @compressed, raising an exception if
-no format can be determined
-'''
def guess_uncompress_format(compressed):
- if type(compressed) == Asset:
+ '''
+ @params compressed: filename, Asset, or file-like object to guess
+
+ Guess the format of @compressed, raising an exception if
+ no format can be determined
+ '''
+ if isinstance(compressed, Asset):
compressed = urlparse(compressed.url).path
- elif type(compressed) != str:
+ elif not isinstance(compressed, str):
raise Exception(f"Unable to guess compression cformat for {compressed}")
- (name, ext) = os.path.splitext(compressed)
+ (_name, ext) = os.path.splitext(compressed)
if ext == ".xz":
return "xz"
elif ext == ".gz":
--
2.51.0
next prev parent reply other threads:[~2025-10-15 9:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 9:54 [PATCH 0/6] tests/functional: Fix various problems reported by pylint Thomas Huth
2025-10-15 9:54 ` [PATCH 1/6] tests/functional: Fix problems in asset.py " Thomas Huth
2025-10-15 9:54 ` [PATCH 2/6] tests/functional: Fix problems in decorators.py " Thomas Huth
2025-10-22 19:15 ` Philippe Mathieu-Daudé
2025-10-15 9:54 ` [PATCH 3/6] tests/functional: Fix problems in linuxkerenl.py " Thomas Huth
2025-10-22 19:14 ` Philippe Mathieu-Daudé
2025-10-23 6:46 ` Thomas Huth
2025-10-23 15:13 ` John Snow
2025-10-15 9:54 ` [PATCH 4/6] tests/functional: Fix problems in testcase.py " Thomas Huth
2025-10-22 19:10 ` Philippe Mathieu-Daudé
2025-10-23 4:57 ` Thomas Huth
2025-10-15 9:54 ` Thomas Huth [this message]
2025-10-22 19:07 ` [PATCH 5/6] tests/functional: Fix problems in uncompress.py " Philippe Mathieu-Daudé
2025-10-15 9:54 ` [PATCH 6/6] tests/functional: Fix problems in utils.py " Thomas Huth
2025-10-22 19:07 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251015095454.1575318-6-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=berrange@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).