mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-25 06:48:01 -05:00
Add ConfigValue.dict(key_type, value_type) parser.
This commit is contained in:
@@ -47,6 +47,14 @@ class ConfigValue(object):
|
||||
def tuple(v, key=None, data=None):
|
||||
return tuple(ConfigValue.to_iter(v))
|
||||
|
||||
@staticmethod
|
||||
def dict(key_type, value_type):
|
||||
def parse(v, key=None, data=None):
|
||||
return {key_type(x): value_type(y)
|
||||
for x, y in (
|
||||
i.split(':', 1) for i in ConfigValue.to_iter(v))}
|
||||
return parse
|
||||
|
||||
@staticmethod
|
||||
def choice(v, key, data):
|
||||
if v not in data:
|
||||
|
||||
Reference in New Issue
Block a user