From 51994a86e9bfa7507785a907635e3a550cfdc054 Mon Sep 17 00:00:00 2001 From: Robert Roos Date: Tue, 12 Sep 2023 10:38:16 +0200 Subject: [PATCH] Fixed linting and test compatibility with Python 3.8 --- src/tctools/format_class.py | 8 +------- src/tctools/format_rules.py | 7 ------- tests/test_formatter.py | 4 +++- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/tctools/format_class.py b/src/tctools/format_class.py index c15f721..ecdf83d 100644 --- a/src/tctools/format_class.py +++ b/src/tctools/format_class.py @@ -6,13 +6,7 @@ import re from .common import TcTool -from .format_rules import ( - FormattingRule, - FormatTabs, - FormatTrailingWhitespace, - FormatInsertFinalNewline, - FormatEndOfLine, -) +from .format_rules import FormattingRule logger = getLogger("formatter") diff --git a/src/tctools/format_rules.py b/src/tctools/format_rules.py index 2633383..c776d54 100644 --- a/src/tctools/format_rules.py +++ b/src/tctools/format_rules.py @@ -201,10 +201,3 @@ def format(self, content: List[str]): self.add_correction( f"{count} line endings need to be corrected to {eol}`", 0 ) - - -class FormatWhitespaceAlign(FormattingRule): - """Assert whitespace aligns between code blocks. - - Most typical usage is in input/output lists. - """ diff --git a/tests/test_formatter.py b/tests/test_formatter.py index f446bde..d660ad0 100644 --- a/tests/test_formatter.py +++ b/tests/test_formatter.py @@ -243,7 +243,9 @@ def test_reformat_eol(plc_code, eol): ] file = plc_code / "TwinCAT Project1" / "MyPlc" / "POUs" / f"FB_Test.TcPOU" - file.write_text(write_eol.join(content_list), newline="") + file.write_bytes( + write_eol.join(content_list).encode() + ) tctools.format.main(str(file))