mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 09:23:24 +00:00
tools: fix deprecated syntax.
This fixes a similar deprecation warning on various pieces of code: > DeprecationWarning: Testing an element's truth value will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. > samples = log.find ("samples") or empty_element
This commit is contained in:
parent
05c86dad8a
commit
1726a6f89f
5 changed files with 27 additions and 23 deletions
|
@ -252,7 +252,7 @@ AddressInfo = namedtuple ("AddressInfo", ("id",
|
|||
|
||||
address_map = {}
|
||||
|
||||
if log.find ("address-map"):
|
||||
if log.find ("address-map") is not None:
|
||||
for address in log.find ("address-map").iterfind ("address"):
|
||||
value = int (address.get ("value"), 0)
|
||||
|
||||
|
@ -308,7 +308,7 @@ for element in log.find ("samples"):
|
|||
raw = var.text.strip () if var.text else None
|
||||
)
|
||||
|
||||
if element.find ("backtrace"):
|
||||
if element.find ("backtrace") is not None:
|
||||
for thread in element.find ("backtrace").iterfind ("thread"):
|
||||
id = thread.get ("id")
|
||||
name = thread.get ("name")
|
||||
|
@ -1671,12 +1671,12 @@ class InformationViewer (Gtk.ScrolledWindow):
|
|||
|
||||
params = log.find ("params")
|
||||
|
||||
if params:
|
||||
if params is not None:
|
||||
add_element (params)
|
||||
|
||||
info = log.find ("info")
|
||||
|
||||
if info:
|
||||
if info is not None:
|
||||
for element in info:
|
||||
add_element (element)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue