Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert match, "Invalid version header '%s'" % lines[0]
name, day, month, year = match.groups()
lines = crop_line_padding(lines[1:])
notes = []
for i, line in enumerate(lines):
if not re.match(r'^###\s*changes\s*$', line, re.IGNORECASE):
notes.append(line)
else:
break
notes = '\n'.join(notes)
lines = filter(None, crop_line_padding(lines[i+1:]))
version = cls(name, int(day), month, int(year), notes)
for line in lines:
version.changes.append(Change.from_string(line))
return version
assert match, "Invalid version header '%s'" % lines[0]
name, day, month, year = match.groups()
lines = crop_line_padding(lines[1:])
notes = []
for i, line in enumerate(lines):
if not re.match(r'^###\s*changes\s*$', line, re.IGNORECASE):
notes.append(line)
else:
break
notes = '\n'.join(notes)
lines = filter(None, crop_line_padding(lines[i + 1:]))
version = cls(name, int(day), month, int(year), notes)
for line in lines:
version.changes.append(Change.from_string(line))
return version