fix tabs with patch from Grobian and bug # 161911, fix developing a bit
authorAlec Warner <antarus@gentoo.org>
Sat, 13 Jan 2007 19:25:20 +0000 (19:25 -0000)
committerAlec Warner <antarus@gentoo.org>
Sat, 13 Jan 2007 19:25:20 +0000 (19:25 -0000)
svn path=/main/trunk/; revision=5633

DEVELOPING
pym/portage.py
tests/portage_dep/test_dep_getcpv.py
tests/portage_dep/test_dep_getslot.py
tests/portage_dep/test_isjustname.py
tests/portage_dep/test_isvalidatom.py

index 0530d99cfa383bdebfbe148617a689907fb2ba18..01eb9bd42695b28f375c29eeac47991dae2083c4 100644 (file)
@@ -56,16 +56,12 @@ Generally you can do two things here, if you are messing with defaults..
 dict.get(foo, some_default)
 
 will try to retrieve foo from dict, if there is a KeyError, will insert foo
-into dict with the value of some_default.  This method is preferred in most cases.
-
-You can also do something like:
+into dict with the value of some_default.  This method is preferred in cases where
+you are messing with defaults:
 
 try:
        dict[foo]
-       ...stuff here..
 except KeyError:
-       print "holy cow we totally expected a keyerror here"
+       dict[foo] = default_value
 
-in most instances however you are only catching the KeyError to set a default,
-in which case you should be using dict.get() or telling the user they are missing
-a required dict key.
+The get call is nicer (compact) and faster (try,except are slow).
index bcbb376f14d8d5b60cce2020b600f16b50e4a856..ee2dd5ef683fd4a39484b82a91af8a9135016b3f 100644 (file)
@@ -2618,7 +2618,7 @@ def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None
        NOTE: manifestonly and overwrite are useless with manifest2 and
              are therefore ignored."""
        if myportdb is None:
-               writemsg("Warning: myportdb not specified to digestgen\n")
+               writemsg("Warning: myportdb not specified to digestgen\n")
                global portdb
                myportdb = portdb
        global _doebuild_manifest_exempt_depend
index 3652169d4d798e4af3af219cdb7191375a31182a..d4d78d9a947e91cfc30087d349ea6ba83f2abef4 100644 (file)
@@ -7,10 +7,10 @@ from unittest import TestCase
 from portage_dep import dep_getcpv
 
 class DepGetCPV(TestCase):
-        """ A simple testcase for isvalidatom
-        """
+       """ A simple testcase for isvalidatom
+       """
 
-        def testDepGetCPV(self):
+       def testDepGetCPV(self):
                
                prefix_ops = ["<", ">", "=", "~", "!", "<=", 
                              ">=", "!=", "!<", "!>", "!~",""]
index fc5a6e3cd212e3ddda1969f10b1e27127fe509c3..9801e064b4912c43729c988beefd932e624e2c24 100644 (file)
@@ -7,11 +7,11 @@ from unittest import TestCase
 from portage_dep import dep_getslot
 
 class DepGetSlot(TestCase):
-        """ A simple testcase for isvalidatom
-        """
+       """ A simple testcase for isvalidatom
+       """
+
+       def testDepGetSlot(self):
 
-        def testDepGetSlot(self):
-               
                slot_char = ":"
                slots = ( "a", "1.2", "1", "IloveVapier", None )
                cpvs = ["sys-apps/portage"]
@@ -20,7 +20,7 @@ class DepGetSlot(TestCase):
                        for slot in slots:
                                if slot:
                                        self.assertEqual( dep_getslot( 
-                                                cpv + slot_char + slot ), slot )
+                                               cpv + slot_char + slot ), slot )
                                else:
                                        self.assertEqual( dep_getslot( cpv ), slot )
 
index 1e152e73d114f39104c3d8e03a0bbe5e68d2a085..3242244139838ea370ae2583c2b1d7432be33c37 100644 (file)
@@ -8,7 +8,7 @@ from portage_dep import isjustname
 
 class IsJustName(TestCase):
 
-        def testIsJustName(self):
+       def testIsJustName(self):
 
                cats = ( "", "sys-apps/", "foo/", "virtual/" )
                pkgs = ( "portage", "paludis", "pkgcore", "notARealPkg" )
index f1410366ce994d60af69b3cf0b801e6d7fcef9b9..ed66b34876803b5e1534b76a5a58671cd1f8571a 100644 (file)
@@ -7,10 +7,10 @@ from unittest import TestCase
 from portage_dep import isvalidatom
 
 class IsValidAtom(TestCase):
-        """ A simple testcase for isvalidatom
-        """
+       """ A simple testcase for isvalidatom
+       """
 
-        def testIsValidAtom(self):
+       def testIsValidAtom(self):
                
                tests = [ ( "sys-apps/portage", True ),
                          ( "=sys-apps/portage-2.1", True ),