From 5b2021c132e78030fa51c6beaf4fbc14bacc4fa5 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sat, 28 May 2022 22:37:57 +1000 Subject: [PATCH] Coding style - Use staticmethod where possible. --- diff_edit/__init__.py | 3 ++- diff_edit/editor.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/diff_edit/__init__.py b/diff_edit/__init__.py index aea8e69..3e20247 100755 --- a/diff_edit/__init__.py +++ b/diff_edit/__init__.py @@ -165,7 +165,8 @@ class DiffEditor: with contextlib.suppress(AttributeError): del self.diff - def _highlight_lines(self, appearance, start, end, opcode, change_opcode): + @staticmethod + def _highlight_lines(appearance, start, end, opcode, change_opcode): if opcode == change_opcode: for index in range(start, end): appearance[index] = highlight_str(appearance[index], (0, 200, 0), 0.6) diff --git a/diff_edit/editor.py b/diff_edit/editor.py index 8a4c6c7..918e525 100755 --- a/diff_edit/editor.py +++ b/diff_edit/editor.py @@ -118,8 +118,9 @@ class Text: def get_text(self): return "\n".join(self) + @staticmethod @functools.lru_cache(maxsize=5000) - def _convert_line(self, line, max_line_length): + def _convert_line(line, max_line_length): return expand_str(line).ljust(max_line_length) def appearance(self):