| @@ 219-237 (lines=19) @@ | ||
| 216 | _add_eol_comment(element, _extract_comment(comment), len(element) - 1) |
|
| 217 | ||
| 218 | ||
| 219 | def run_update(code, keys, value, comment, _app): |
|
| 220 | key_list = keys.split(".") |
|
| 221 | ||
| 222 | space_str = ":\n " |
|
| 223 | key_str = "{}".format(key_list[0]) |
|
| 224 | for key in key_list[1:]: |
|
| 225 | key_str = key_str + space_str + key |
|
| 226 | space_str = space_str + " " |
|
| 227 | if not _app: |
|
| 228 | yaml_str = """{}: {}""".format(key_str, value) |
|
| 229 | else: |
|
| 230 | yaml_str = "{}{}- {}".format(key_str, space_str, value) |
|
| 231 | ||
| 232 | if comment: |
|
| 233 | yaml_str = "{} # {}".format(yaml_str, comment) |
|
| 234 | ||
| 235 | mcode = yaml.load(yaml_str) |
|
| 236 | ||
| 237 | _merge(code, mcode) |
|
| 238 | ||
| 239 | ||
| 240 | def _update(code, _update, _app, _tips): |
|
| @@ 219-237 (lines=19) @@ | ||
| 216 | _add_eol_comment(element, _extract_comment(comment), len(element) - 1) |
|
| 217 | ||
| 218 | ||
| 219 | def run_update(code, keys, value, comment, _app): |
|
| 220 | key_list = keys.split(".") |
|
| 221 | ||
| 222 | space_str = ":\n " |
|
| 223 | key_str = "{}".format(key_list[0]) |
|
| 224 | for key in key_list[1:]: |
|
| 225 | key_str = key_str + space_str + key |
|
| 226 | space_str = space_str + " " |
|
| 227 | if not _app: |
|
| 228 | yaml_str = """{}: {}""".format(key_str, value) |
|
| 229 | else: |
|
| 230 | yaml_str = "{}{}- {}".format(key_str, space_str, value) |
|
| 231 | ||
| 232 | if comment: |
|
| 233 | yaml_str = "{} # {}".format(yaml_str, comment) |
|
| 234 | ||
| 235 | mcode = yaml.load(yaml_str) |
|
| 236 | ||
| 237 | _merge(code, mcode) |
|
| 238 | ||
| 239 | ||
| 240 | def _update(code, _update, _app, _tips): |
|