[YAML Exporter] switch to f-strings

This commit is contained in:
MinchinWeb 2019-12-14 15:22:12 -07:00
parent 2704ad32c2
commit 1ac96ae698

View file

@ -27,7 +27,7 @@ class YAMLExporter(TextExporter):
tagsymbols = entry.journal.config['tagsymbols']
# see also Entry.Entry.rag_regex
multi_tag_regex = re.compile(r'(?u)^\s*([{tags}][-+*#/\w]+\s*)+$'.format(tags=tagsymbols))
multi_tag_regex = re.compile(fr'(?u)^\s*([{tagsymbols}][-+*#/\w]+\s*)+$')
"""Increase heading levels in body text"""
newbody = ''
@ -71,15 +71,15 @@ class YAMLExporter(TextExporter):
hasattr(entry, 'creator_software_agent'):
dayone_attributes += 'creator:\n'
if hasattr(entry, 'creator_device_agent'):
dayone_attributes += ' device agent: {}\n'.format(entry.creator_device_agent)
dayone_attributes += f' device agent: {entry.creator_device_agent}\n'
if hasattr(entry, 'creator_generation_date'):
dayone_attributes += ' generation date: {}\n'.format(str(entry.creator_generation_date))
if hasattr(entry, 'creator_host_name'):
dayone_attributes += ' host name: {}\n'.format(entry.creator_host_name)
dayone_attributes += f' host name: {entry.creator_host_name}\n'
if hasattr(entry, 'creator_os_agent'):
dayone_attributes += ' os agent: {}\n'.format(entry.creator_os_agent)
dayone_attributes += f' os agent: {entry.creator_os_agent}\n'
if hasattr(entry, 'creator_software_agent'):
dayone_attributes += ' software agent: {}\n'.format(entry.creator_software_agent)
dayone_attributes += f' software agent: {entry.creator_software_agent}\n'
# TODO: copy over pictures, if present
# source directory is entry.journal.config['journal']