Spaces Data
Minimal test - lines (338, 364)
path: .spaces[7].spaces[15].metrics.loc.cloc
old: 6.0
new: 8.0
path: .spaces[7].spaces[15].metrics.loc.sloc
old: 25.0
new: 27.0
path: .spaces[7].spaces[15].metrics.mi.mi_visual_studio
old: 49.26148035398551
new: 48.532375753748504
path: .spaces[7].spaces[15].metrics.mi.mi_original
old: 84.23713140531522
new: 82.99036253890995
path: .spaces[7].spaces[15].metrics.mi.mi_sei
old: 81.2537157720711
new: 82.38835241965526
Code
def read_file(self, fileob):
"""Read the metadata values from a file object."""
msg = message_from_file(fileob)
self._fields['Metadata-Version'] = msg['metadata-version']
# When reading, get all the fields we can
for field in _ALL_FIELDS:
if field not in msg:
continue
if field in _LISTFIELDS:
# we can have multiple lines
values = msg.get_all(field)
if field in _LISTTUPLEFIELDS and values is not None:
values = [tuple(value.split(',')) for value in values]
self.set(field, values)
else:
# single line
value = msg[field]
if value is not None and value != 'UNKNOWN':
self.set(field, value)
# PEP 566 specifies that the body be used for the description, if
# available
body = msg.get_payload()
self["Description"] = body if body else self["Description"]
# logger.debug('Attempting to set metadata for %s', self)
# self.set_metadata_version()