[blivet] Used Python type instead of variable name (#968122)

Mark Hamzy hamzy at us.ibm.com
Sat Jun 22 03:36:28 UTC 2013


It seems there are a number of issues with blivet/arch.py:

1) A variable is called type in some places and _type in others. This is inconsistent and also overrides a builtin Python keyword.
2) Some places call find to search for a substring and others call "in."
3) Some places use two spaces for indentation instead of the standard four.

However, since we are in shutdown mode for Fedora 19, I propose that arch.py be rewritten for Fedora 20, and we only fix the bug
(I am adding extra comments because it is not obvious that this is a substring search.

---
 blivet/arch.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/blivet/arch.py b/blivet/arch.py
index d4ffc7b..12cb30d 100644
--- a/blivet/arch.py
+++ b/blivet/arch.py
@@ -63,6 +63,7 @@ def getPPCMachine():
     platform = None
 
     # ppc machine hash
+    # Note: This is a substring match!
     ppcType = { 'Mac'      : 'PMac',
                 'Book'     : 'PMac',
                 'CHRP IBM' : 'pSeries',
@@ -133,6 +134,7 @@ def getPPCMacID():
 # @return The powermac generation, or 0 if not powermac.
 def getPPCMacGen():
     # XXX: should NuBus be here?
+    # Note: This is a substring match!
     pmacGen = ['OldWorld', 'NewWorld', 'NuBus']
 
     if not isPPC():
@@ -154,7 +156,7 @@ def getPPCMacGen():
 
     for _type in pmacGen:
       if _type in gen:
-          return type
+          return _type
 
     log.warning("Unknown Power Mac generation: %s" %(gen,))
     return 0
-- 
1.8.1.4



More information about the anaconda-patches mailing list