* [gentoo-commits] portage r12674 - in main/trunk/pym/portage: . cache
@ 2009-02-21 22:07 Zac Medico (zmedico)
0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2009-02-21 22:07 UTC (permalink / raw
To: gentoo-commits
Author: zmedico
Date: 2009-02-21 22:07:51 +0000 (Sat, 21 Feb 2009)
New Revision: 12674
Modified:
main/trunk/pym/portage/__init__.py
main/trunk/pym/portage/cache/mappings.py
main/trunk/pym/portage/util.py
Log:
Make the UserDict and LazyItemsDict constructors use an optional positional
argument instead of a keyword argument.
Modified: main/trunk/pym/portage/__init__.py
===================================================================
--- main/trunk/pym/portage/__init__.py 2009-02-21 21:51:13 UTC (rev 12673)
+++ main/trunk/pym/portage/__init__.py 2009-02-21 22:07:51 UTC (rev 12674)
@@ -7693,7 +7693,7 @@
myroots.append((settings["ROOT"], settings))
for myroot, mysettings in myroots:
- trees[myroot] = portage.util.LazyItemsDict(trees.get(myroot, None))
+ trees[myroot] = portage.util.LazyItemsDict(trees.get(myroot, {}))
trees[myroot].addLazySingleton("virtuals", mysettings.getvirtuals, myroot)
trees[myroot].addLazySingleton(
"vartree", vartree, myroot, categories=mysettings.categories,
Modified: main/trunk/pym/portage/cache/mappings.py
===================================================================
--- main/trunk/pym/portage/cache/mappings.py 2009-02-21 21:51:13 UTC (rev 12673)
+++ main/trunk/pym/portage/cache/mappings.py 2009-02-21 22:07:51 UTC (rev 12674)
@@ -139,10 +139,16 @@
http://bugs.python.org/issue2876
"""
- def __init__(self, dict=None, **kwargs):
- self.data = {}
- if dict is not None:
- self.update(dict)
+ def __init__(self, *args, **kwargs):
+
+ if len(args) > 1:
+ raise TypeError(
+ "expected at most 1 positional argument, got " + \
+ repr(len(args)))
+
+ if args:
+ self.update(args[0])
+
if kwargs:
self.update(kwargs)
Modified: main/trunk/pym/portage/util.py
===================================================================
--- main/trunk/pym/portage/util.py 2009-02-21 21:51:13 UTC (rev 12673)
+++ main/trunk/pym/portage/util.py 2009-02-21 22:07:51 UTC (rev 12674)
@@ -1201,11 +1201,22 @@
__slots__ = ('lazy_items',)
- def __init__(self, initial_items=None):
+ def __init__(self, *args, **kwargs):
+
+ if len(args) > 1:
+ raise TypeError(
+ "expected at most 1 positional argument, got " + \
+ repr(len(args)))
+
dict.__init__(self)
self.lazy_items = {}
- if initial_items is not None:
- self.update(initial_items)
+
+ if args:
+ self.update(args[0])
+
+ if kwargs:
+ self.update(kwargs)
+
def addLazyItem(self, item_key, value_callable, *pargs, **kwargs):
"""Add a lazy item for the given key. When the item is requested,
value_callable will be called with *pargs and **kwargs arguments."""
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-02-21 22:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-21 22:07 [gentoo-commits] portage r12674 - in main/trunk/pym/portage: . cache Zac Medico (zmedico)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox