From: Petr Lautrbach <plautrba@redhat.com>
To: James Carter <jwcart2@gmail.com>, selinux@vger.kernel.org
Subject: Re: [PATCH] python: Use isinstance() instead of type()
Date: Tue, 08 Aug 2023 13:01:09 +0200 [thread overview]
Message-ID: <87sf8tssqy.fsf@redhat.com> (raw)
In-Reply-To: <87wmy5su5c.fsf@redhat.com>
Petr Lautrbach <plautrba@redhat.com> writes:
> James Carter <jwcart2@gmail.com> writes:
>
>> CI testing fails while running flake8 on python scripts with the
>> message "./python/semanage/seobject.py:250:16: E721 do not compare
>> types, for exact checks use `is` / `is not`, for instance checks use
>> `isinstance()`"
>>
>> Use "isinstance(args, str)" instead of "type(args) == str"
>>
>> Signed-off-by: James Carter <jwcart2@gmail.com>
>
> Acked-by: Petr Lautrbach <lautrbach@redhat.com>
This is merged now, thanks!
>
>> ---
>> python/semanage/seobject.py | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
>> index 361205d1..cc944ae2 100644
>> --- a/python/semanage/seobject.py
>> +++ b/python/semanage/seobject.py
>> @@ -247,7 +247,7 @@ class semanageRecords:
>> global handle
>> if args:
>> # legacy code - args was store originally
>> - if type(args) == str:
>> + if isinstance(args, str):
>> self.store = args
>> else:
>> self.args = args
>> --
>> 2.41.0
prev parent reply other threads:[~2023-08-08 17:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-03 13:40 [PATCH] python: Use isinstance() instead of type() James Carter
2023-08-08 10:30 ` Petr Lautrbach
2023-08-08 11:01 ` Petr Lautrbach [this message]
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=87sf8tssqy.fsf@redhat.com \
--to=plautrba@redhat.com \
--cc=jwcart2@gmail.com \
--cc=selinux@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.