Remove calls to `os.linesep` and add misc. typing

This commit is contained in:
Daniël van Noord 2021-10-10 16:57:46 +02:00
parent f2b0c48536
commit 1cf4f30d5b
2 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,6 @@
A way to create simple reports using python objects, primarily designed to be
formatted as text and html.
"""
import os
import sys
from io import StringIO
from typing import TYPE_CHECKING, Iterator, List, TextIO, Union
@ -59,7 +58,7 @@ class BaseWriter:
def writeln(self, string: str = "") -> None:
"""write a line in the output buffer"""
self.write(string + os.linesep)
self.write(string + "\n")
def write(self, string: str) -> None:
"""write a string in the output buffer"""

View File

@ -302,10 +302,11 @@ def _check_csv(value):
return _splitstrip(value)
def _comment(string):
def _comment(string: str) -> str:
"""return string as a comment"""
lines = [line.strip() for line in string.splitlines()]
return "# " + f"{os.linesep}# ".join(lines)
sep = "\n"
return "# " + f"{sep}# ".join(lines)
def _format_option_value(optdict, value):