From 0ab831e48b8a612221e9e586089b4be6ecac9a61 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sat, 28 May 2022 22:44:37 +1000 Subject: [PATCH] Coding style - Use staticmethod where possible. --- eris/eris/__main__.py | 3 ++- fill3/fill3/__init__.py | 3 ++- termstr/termstr.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/eris/eris/__main__.py b/eris/eris/__main__.py index 6283c06..bb1a32d 100755 --- a/eris/eris/__main__.py +++ b/eris/eris/__main__.py @@ -679,7 +679,8 @@ class Screen: worker_.result.reset() worker_.kill() - def _partition(self, percentage, widgets, length): + @staticmethod + def _partition(percentage, widgets, length): smaller_length = max(int(length * (percentage / 100)), 10) return [smaller_length, length - smaller_length] diff --git a/fill3/fill3/__init__.py b/fill3/fill3/__init__.py index 54526b8..e09a5b7 100755 --- a/fill3/fill3/__init__.py +++ b/fill3/fill3/__init__.py @@ -122,7 +122,8 @@ class Column: return join_vertical([row_widget.appearance_for((width, item_height)) for row_widget, item_height in zip(self.widgets, heights)]) - def _appearance_list(self, widgets): + @staticmethod + def _appearance_list(widgets): if widgets == []: return [] appearances = [row_widget.appearance() for row_widget in widgets] diff --git a/termstr/termstr.py b/termstr/termstr.py index 89d2907..ffbe0ad 100644 --- a/termstr/termstr.py +++ b/termstr/termstr.py @@ -127,7 +127,8 @@ class CharStyle: attributes.append("u") return f"" - def _color_code(self, color_, is_foreground): + @staticmethod + def _color_code(color_, is_foreground): if isinstance(color_, int): return color(color_, is_foreground) else: # true color