Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Joshua Lock <josh@linux.intel.com>
To: bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH 05/12] Hob: fix '!= None' and '== None' in the code
Date: Mon, 19 Mar 2012 16:51:15 -0700	[thread overview]
Message-ID: <4F67C673.7000502@linux.intel.com> (raw)
In-Reply-To: <32ef0101438198032c77c14ed701339417e3749f.1331910234.git.shane.wang@intel.com>



On 16/03/12 08:10, Shane Wang wrote:
> This patch is to fix the following:
>
> if foo != None ----->  if foo
> if foo == None ----->  if not foo
>
> Signed-off-by: Shane Wang<shane.wang@intel.com>

Thanks!

Signed-off-by: Joshua Lock <josh@linux.intel.com>

> ---
>   bitbake/lib/bb/ui/crumbs/hobeventhandler.py  |    4 ++--
>   bitbake/lib/bb/ui/crumbs/hoblistmodel.py     |    2 +-
>   bitbake/lib/bb/ui/crumbs/hobpages.py         |    4 ++--
>   bitbake/lib/bb/ui/crumbs/hobwidget.py        |    6 +++---
>   bitbake/lib/bb/ui/crumbs/imagedetailspage.py |   12 ++++++------
>   bitbake/lib/bb/ui/crumbs/runningbuild.py     |    4 ++--
>   6 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
> index 790e2ef..1e1151e 100644
> --- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
> +++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
> @@ -119,7 +119,7 @@ class HobHandler(gobject.GObject):
>               self.generating = False
>
>       def run_next_command(self, initcmd=None):
> -        if initcmd != None:
> +        if initcmd:
>               self.initcmd = initcmd
>
>           if self.commands_async:
> @@ -127,7 +127,7 @@ class HobHandler(gobject.GObject):
>               next_command = self.commands_async.pop(0)
>           else:
>               self.clear_busy()
> -            if self.initcmd != None:
> +            if self.initcmd:
>                   self.emit("command-succeeded", self.initcmd)
>               return
>
> diff --git a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
> index caf31bc..69e13cf 100644
> --- a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
> +++ b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
> @@ -713,7 +713,7 @@ class RecipeListModel(gtk.ListStore):
>           return None
>
>       def set_selected_image(self, img):
> -        if img == None:
> +        if not img:
>               return
>           path = self.find_path_for_item(img)
>           self.include_item(item_path=path,
> diff --git a/bitbake/lib/bb/ui/crumbs/hobpages.py b/bitbake/lib/bb/ui/crumbs/hobpages.py
> index bd4b292..63ee3dd 100755
> --- a/bitbake/lib/bb/ui/crumbs/hobpages.py
> +++ b/bitbake/lib/bb/ui/crumbs/hobpages.py
> @@ -34,7 +34,7 @@ class HobPage (gtk.VBox):
>           self.builder = builder
>           self.builder_width, self.builder_height = self.builder.size_request()
>
> -        if title == None:
> +        if not title:
>               self.title = "HOB -- Image Creator"
>           else:
>               self.title = title
> @@ -62,7 +62,7 @@ class HobPage (gtk.VBox):
>           label.set_markup("<span font_desc=\'14\'>%s</span>" % self.title)
>           hbox.pack_start(label, expand=False, fill=False, padding=20)
>
> -        if widget != None:
> +        if widget:
>               # add the widget in the event box
>               hbox.pack_end(widget, expand=False, fill=False, padding=padding)
>           eventbox.add(hbox)
> diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
> index 247bbd1..f0d9cbc 100644
> --- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
> +++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
> @@ -366,7 +366,7 @@ class HobTabBar(gtk.DrawingArea):
>               child["x"] = self.tab_x + i * self.tab_width
>               child["y"] = self.tab_y
>
> -        if self.blank_rectangle != None:
> +        if self.blank_rectangle:
>               self.resize_blank_rectangle()
>
>       def resize_blank_rectangle(self):
> @@ -553,7 +553,7 @@ class HobTabBar(gtk.DrawingArea):
>           self.queue_draw()
>
>       def set_blank_size(self, x, y, w, h):
> -        if self.blank_rectangle == None or self.blank_rectangle.x != x or self.blank_rectangle.width != w:
> +        if not self.blank_rectangle or self.blank_rectangle.x != x or self.blank_rectangle.width != w:
>               self.emit("blank-area-changed", x, y, w, h)
>
>           return gtk.gdk.Rectangle(x, y, w, h)
> @@ -640,7 +640,7 @@ class HobNotebook(gtk.VBox):
>           if not notebook:
>               return
>           title = notebook.get_tab_label_text(notebook_child)
> -        if title == None:
> +        if not title:
>               return
>           for child in self.tabbar.children:
>               if child["title"] == title:
> diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
> index c063d74..30c25aa 100755
> --- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
> +++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
> @@ -64,9 +64,9 @@ class ImageDetailsPage (HobPage):
>               self.hbox.set_border_width(15)
>               self.add(self.hbox)
>
> -            if widget != None:
> +            if widget:
>                   row = 1
> -            elif varlist != None and vallist != None:
> +            elif varlist and vallist:
>                   # pack the icon and the text on the left
>                   row = len(varlist)
>               self.table = gtk.Table(row, 20, True)
> @@ -75,18 +75,18 @@ class ImageDetailsPage (HobPage):
>
>               colid = 0
>               self.line_widgets = {}
> -            if icon != None:
> +            if icon:
>                   self.table.attach(icon, colid, colid + 2, 0, 1)
>                   colid = colid + 2
> -            if widget != None:
> +            if widget:
>                   self.table.attach(widget, colid, 20, 0, 1)
> -            elif varlist != None and vallist != None:
> +            elif varlist and vallist:
>                   for line in range(0, row):
>                       self.line_widgets[varlist[line]] = self.text2label(varlist[line], vallist[line])
>                       self.table.attach(self.line_widgets[varlist[line]], colid, 20, line, line + 1)
>
>               # pack the button on the right
> -            if button != None:
> +            if button:
>                   self.hbox.pack_end(button, expand=False, fill=False)
>
>           def update_line_widgets(self, variable, value):
> diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py
> index ddac232..d8af55c 100644
> --- a/bitbake/lib/bb/ui/crumbs/runningbuild.py
> +++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py
> @@ -43,7 +43,7 @@ class RunningBuildModel (gtk.TreeStore):
>
>       def config_model_filter(self, model, it):
>           msg = model.get(it, self.COL_MESSAGE)[0]
> -        if msg == None or type(msg) != str:
> +        if not msg or type(msg) != str:
>               return False
>           if msg.startswith("\nOE Build Configuration:\n"):
>               return True
> @@ -51,7 +51,7 @@ class RunningBuildModel (gtk.TreeStore):
>
>       def failure_model_filter(self, model, it):
>           color = model.get(it, self.COL_COLOR)[0]
> -        if color == None:
> +        if not color:
>               return False
>           if color == HobColors.ERROR:
>               return True

-- 
Joshua '贾詡' Lock
         Yocto Project "Johannes factotum"
         Intel Open Source Technology Centre



  reply	other threads:[~2012-03-20  0:00 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-16 15:10 [PATCH 00/12] [V3]Hob Notebook Implementation and Others Shane Wang
2012-03-16 15:10 ` [PATCH 01/12] Hob: implement a self-defined notebook visual component for Hob Shane Wang
2012-03-19 23:49   ` Joshua Lock
2012-03-16 15:10 ` [PATCH 02/12] Hob: use HobNotebook to implement a notebook in build details page Shane Wang
2012-03-19 23:49   ` Joshua Lock
2012-03-20 13:44     ` Wang, Shane
2012-03-20 14:17     ` Wang, Shane
2012-03-16 15:10 ` [PATCH 03/12] Hob: show indicators on the tabs of the Hob notebook Shane Wang
2012-03-19 23:49   ` Joshua Lock
2012-03-16 15:10 ` [PATCH 04/12] Hob: change the code style to enumerate a list in a for-loop Shane Wang
2012-03-19 23:50   ` Joshua Lock
2012-03-16 15:10 ` [PATCH 05/12] Hob: fix '!= None' and '== None' in the code Shane Wang
2012-03-19 23:51   ` Joshua Lock [this message]
2012-03-16 15:10 ` [PATCH 06/12] Hob: allow users to setup the proxies Shane Wang
2012-03-19 23:51   ` Joshua Lock
2012-03-20 13:27     ` Wang, Shane
2012-03-26 17:38       ` Barros Pena, Belen
2012-03-16 15:10 ` [PATCH 07/12] Hob: remove the invalid code in hobwidget.py Shane Wang
2012-03-19 23:51   ` Joshua Lock
2012-03-16 15:10 ` [PATCH 08/12] Hob: change the range dance in hobwidget make it like a pythonista Shane Wang
2012-03-19 23:57   ` Joshua Lock
2012-03-20 12:16     ` An, LimingX L
2012-03-16 15:10 ` [PATCH 09/12] Hob: fix static variable "self.search" to parameter "search" in signal callback function Shane Wang
2012-03-19 23:52   ` Joshua Lock
2012-03-16 15:10 ` [PATCH 10/12] Hob: add auto adjust background area function for long issue text Shane Wang
2012-03-19 23:52   ` Joshua Lock
2012-03-16 15:10 ` [PATCH 11/12] Hob: change HobNoteBook tab edge color from green to gray Shane Wang
2012-03-19 23:53   ` Joshua Lock
2012-03-16 15:10 ` [PATCH 12/12] Hob: per UI design add refresh icon for building log Shane Wang
2012-03-19 23:53   ` Joshua Lock
2012-03-20 13:04     ` An, LimingX L
2012-03-20 18:29       ` Joshua Lock

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=4F67C673.7000502@linux.intel.com \
    --to=josh@linux.intel.com \
    --cc=bitbake-devel@lists.openembedded.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