Commit 7cde53c4 authored by Xavier Thompson's avatar Xavier Thompson

[opti] Unannotate sections in-place

This avoids unecessary copies. This is a preparatory step to
reimplementing the extends algorithm. It may be that this breaks
the extends algorithm as it is currently implemented.
parent 6b0ea6d0
...@@ -261,11 +261,14 @@ def _print_annotate(data, verbose, chosen_sections, basedir): ...@@ -261,11 +261,14 @@ def _print_annotate(data, verbose, chosen_sections, basedir):
def _unannotate_section(section): def _unannotate_section(section):
return {key: entry.value for key, entry in section.items()} for key in section:
section[key] = section[key].value
return section
def _unannotate(data): def _unannotate(data):
return {key: _unannotate_section(section) for key, section in data.items()} for key in data:
_unannotate_section(data[key])
return data
def _format_picked_versions(picked_versions, required_by): def _format_picked_versions(picked_versions, required_by):
...@@ -1587,7 +1590,7 @@ class Options(DictMixin): ...@@ -1587,7 +1590,7 @@ class Options(DictMixin):
result = _annotate_section(result, "") result = _annotate_section(result, "")
data = _annotate_section(copy.deepcopy(data), "") data = _annotate_section(copy.deepcopy(data), "")
_update_section(result, data) _update_section(result, data)
result = _unannotate_section(result) _unannotate_section(result)
result.pop('<', None) result.pop('<', None)
return result return result
finally: finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment