summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2021-10-10 16:57:46 +0200
committerDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2021-10-10 21:20:58 +0200
commit1cf4f30d5b313ba8bb63d974fb3e8a87100d5a9b (patch)
tree41efa39e2c4d0cd85695f09bdb4ca7c451f1d7d5
parentf2b0c48536c008410e6c3eab51ea1042b96829e2 (diff)
downloadpylint-git-1cf4f30d5b313ba8bb63d974fb3e8a87100d5a9b.tar.gz
Remove calls to ``os.linesep`` and add misc. typing
-rw-r--r--pylint/reporters/ureports/base_writer.py3
-rw-r--r--pylint/utils/utils.py5
2 files changed, 4 insertions, 4 deletions
diff --git a/pylint/reporters/ureports/base_writer.py b/pylint/reporters/ureports/base_writer.py
index 418079ae0..edf588527 100644
--- a/pylint/reporters/ureports/base_writer.py
+++ b/pylint/reporters/ureports/base_writer.py
@@ -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"""
diff --git a/pylint/utils/utils.py b/pylint/utils/utils.py
index d8d4baf0a..96f8a6acc 100644
--- a/pylint/utils/utils.py
+++ b/pylint/utils/utils.py
@@ -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):