Skip to content

Commit

Permalink
fix: check for empty import_log when writing yaml
Browse files Browse the repository at this point in the history
Fixes GitHub #8
  • Loading branch information
patrislav1 committed Jan 7, 2025
1 parent 595e048 commit bd4a57d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions frugy/fru.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,11 @@ def fmt_tree(part):

def postprocess_yaml(self, data):
result = ''
if len(import_log.str) != 0:
import_log.str = '\n' + import_log.str
for line in [self.comment, *import_log.str.splitlines()]:
result += f'# {line}\n'
if hasattr(import_log, 'str'):
if len(import_log.str) != 0:
import_log.str = '\n' + import_log.str
for line in [self.comment, *import_log.str.splitlines()]:
result += f'# {line}\n'
line_prev = ''
for line in data.splitlines():
if line.endswith(':') and not line.startswith(' '):
Expand Down

0 comments on commit bd4a57d

Please sign in to comment.