Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Unified Diff: recipe_engine/config.py

Issue 2816083003: config: fix config.Dict with no value type (Closed)
Patch Set: docstring Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_engine/config.py
diff --git a/recipe_engine/config.py b/recipe_engine/config.py
index dd473a1cf78a16b8f29a0d89944330da4d131000..4b378247b2d1cd41f45e0daf274f145da1a23f8b 100644
--- a/recipe_engine/config.py
+++ b/recipe_engine/config.py
@@ -584,7 +584,7 @@ class Dict(ConfigBase, collections.MutableMapping):
jsonish_fn - A function which renders a list of outputs of item_fn to a
JSON-compatiple python datatype. Defaults to dict().
value_type - A type object used for constraining/validating the values
- assigned to this dictionary.
+ assigned to this dictionary. If None, the value can be any type.
hidden - See ConfigBase.
"""
super(Dict, self).__init__(hidden)
@@ -620,8 +620,9 @@ class Dict(ConfigBase, collections.MutableMapping):
if isinstance(val, Dict):
val = val.data
typeAssert(val, collections.Mapping)
- for v in val.itervalues():
- typeAssert(v, self.value_type)
+ if self.value_type:
+ for v in val.itervalues():
+ typeAssert(v, self.value_type)
self.data = val
def as_jsonish(self, _include_hidden=None):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698