FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 01-15-2009, 04:50 PM
David Lehman
 
Default When validating the arguments, compare with None.

Good catch. You can also use 'map.dev.minor is not None' to improve
readability.

On Thu, 2009-01-15 at 17:18 +0100, Joel Granados Moreno wrote:
> ---
> __init__.py | 12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/__init__.py b/__init__.py
> index 523ad74..db4bf01 100644
> --- a/__init__.py
> +++ b/__init__.py
> @@ -214,9 +214,9 @@ def getDmDeps(uuid = None, major = None, minor = None, name = None):
> # If has dpes, return a set of maps, else return an empty set.
> for map in dm.maps():
> if (map.name and map.name == name) or
> - (map.uuid and map.uuid == uuid) or
> - (map.dev.minor and map.dev.minor == long(minor) and
> - map.dev.major and map.dev.major == long(major)):
> + (not map.uuid is None and map.uuid == uuid) or
> + (not map.dev.minor is None and map.dev.minor == long(minor)and
> + not map.dev.major is None and map.dev.major == long(major)):
> return map.deps
> return None
>
> @@ -234,9 +234,9 @@ def getDmTarget(uuid = None, major = None, minor = None, name = None):
> # Return None if we don't find the map.
> for map in dm.maps():
> if (map.name and map.name == name) or
> - (map.uuid and map.uuid == uuid) or
> - (map.dev.minor and map.dev.minor == long(minor) and
> - map.dev.major and map.dev.major == long(major)):
> + (not map.uuid is None and map.uuid == uuid) or
> + (not map.dev.minor is None and map.dev.minor == long(minor)and
> + not map.dev.major is None and map.dev.major == long(major)):
> # might be worth validating tupe.
> return map.table.type
> return None

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 01-15-2009, 04:58 PM
Joel Granados
 
Default When validating the arguments, compare with None.

----- "David Lehman" <dlehman@redhat.com> wrote:

> Good catch. You can also use 'map.dev.minor is not None' to improve
> readability.

mmm. yep, that is kinda better. will change it. Any other comments ?

>
> On Thu, 2009-01-15 at 17:18 +0100, Joel Granados Moreno wrote:
> > ---
> > __init__.py | 12 ++++++------
> > 1 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/__init__.py b/__init__.py
> > index 523ad74..db4bf01 100644
> > --- a/__init__.py
> > +++ b/__init__.py
> > @@ -214,9 +214,9 @@ def getDmDeps(uuid = None, major = None, minor =
> None, name = None):
> > # If has dpes, return a set of maps, else return an empty set.
> > for map in dm.maps():
> > if (map.name and map.name == name) or
> > - (map.uuid and map.uuid == uuid) or
> > - (map.dev.minor and map.dev.minor == long(minor) and
>
> > - map.dev.major and map.dev.major == long(major)):
> > + (not map.uuid is None and map.uuid == uuid) or
> > + (not map.dev.minor is None and map.dev.minor ==
> long(minor)and
> > + not map.dev.major is None and map.dev.major ==
> long(major)):
> > return map.deps
> > return None
> >
> > @@ -234,9 +234,9 @@ def getDmTarget(uuid = None, major = None, minor
> = None, name = None):
> > # Return None if we don't find the map.
> > for map in dm.maps():
> > if (map.name and map.name == name) or
> > - (map.uuid and map.uuid == uuid) or
> > - (map.dev.minor and map.dev.minor == long(minor) and
>
> > - map.dev.major and map.dev.major == long(major)):
> > + (not map.uuid is None and map.uuid == uuid) or
> > + (not map.dev.minor is None and map.dev.minor ==
> long(minor)and
> > + not map.dev.major is None and map.dev.major ==
> long(major)):
> > # might be worth validating tupe.
> > return map.table.type
> > return None
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

--
Joel Andres Granados
Red Hat / Brno Czech Republic

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:55 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org