Comment uncommented methods in utils

This commit is contained in:
Michael DeHaan 2012-07-07 08:18:33 -04:00
parent 749472559b
commit b551eba6d4

View file

@ -58,6 +58,7 @@ def smjson(result):
return json.dumps(result2, sort_keys=True) return json.dumps(result2, sort_keys=True)
def task_start_msg(name, conditional): def task_start_msg(name, conditional):
# FIXME: move to callbacks code
if conditional: if conditional:
return "NOTIFIED: [%s]" % name return "NOTIFIED: [%s]" % name
else: else:
@ -166,6 +167,7 @@ def path_dwim(basedir, given):
return os.path.join(basedir, given) return os.path.join(basedir, given)
def json_loads(data): def json_loads(data):
''' parse a JSON string and return a data structure '''
return json.loads(data) return json.loads(data)
def parse_json(data): def parse_json(data):
@ -220,9 +222,9 @@ def _varLookup(name, vars):
return space return space
_KEYCRE = re.compile(r"\$(?P<complex>\{){0,1}((?(complex)[\w\.\[\]]+|\w+))(?(complex)\})") _KEYCRE = re.compile(r"\$(?P<complex>\{){0,1}((?(complex)[\w\.\[\]]+|\w+))(?(complex)\})")
# if { -> complex if complex, allow . and need trailing }
def varLookup(varname, vars): def varLookup(varname, vars):
''' helper function used by varReplace '''
m = _KEYCRE.search(varname) m = _KEYCRE.search(varname)
if not m: if not m:
return None return None
@ -288,9 +290,11 @@ def template_from_file(basedir, path, vars, setup_cache):
return template(res, vars, setup_cache) return template(res, vars, setup_cache)
def parse_yaml(data): def parse_yaml(data):
''' convert a yaml string to a data structure '''
return yaml.load(data) return yaml.load(data)
def parse_yaml_from_file(path): def parse_yaml_from_file(path):
''' convert a yaml file to a data structure '''
try: try:
data = file(path).read() data = file(path).read()
except IOError: except IOError: