summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DEVELOPING12
-rw-r--r--pym/portage.py2
-rw-r--r--tests/portage_dep/test_dep_getcpv.py6
-rw-r--r--tests/portage_dep/test_dep_getslot.py10
-rw-r--r--tests/portage_dep/test_isjustname.py2
-rw-r--r--tests/portage_dep/test_isvalidatom.py6
6 files changed, 17 insertions, 21 deletions
diff --git a/DEVELOPING b/DEVELOPING
index 0530d99cf..01eb9bd42 100644
--- a/DEVELOPING
+++ b/DEVELOPING
@@ -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).
diff --git a/pym/portage.py b/pym/portage.py
index bcbb376f1..ee2dd5ef6 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -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
diff --git a/tests/portage_dep/test_dep_getcpv.py b/tests/portage_dep/test_dep_getcpv.py
index 3652169d4..d4d78d9a9 100644
--- a/tests/portage_dep/test_dep_getcpv.py
+++ b/tests/portage_dep/test_dep_getcpv.py
@@ -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 = ["<", ">", "=", "~", "!", "<=",
">=", "!=", "!<", "!>", "!~",""]
diff --git a/tests/portage_dep/test_dep_getslot.py b/tests/portage_dep/test_dep_getslot.py
index fc5a6e3cd..9801e064b 100644
--- a/tests/portage_dep/test_dep_getslot.py
+++ b/tests/portage_dep/test_dep_getslot.py
@@ -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 )
diff --git a/tests/portage_dep/test_isjustname.py b/tests/portage_dep/test_isjustname.py
index 1e152e73d..324224413 100644
--- a/tests/portage_dep/test_isjustname.py
+++ b/tests/portage_dep/test_isjustname.py
@@ -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" )
diff --git a/tests/portage_dep/test_isvalidatom.py b/tests/portage_dep/test_isvalidatom.py
index f1410366c..ed66b3487 100644
--- a/tests/portage_dep/test_isvalidatom.py
+++ b/tests/portage_dep/test_isvalidatom.py
@@ -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 ),