From 9252d69ede0b2a086fb7359706d7ef58b41e6561 Mon Sep 17 00:00:00 2001 From: toonn Date: Thu, 26 May 2022 15:13:09 +0200 Subject: colorscheme: Make use an abstract method The `use` method has always been decorated as being a `@staticmethod`. Many colorschemes use fields to store certain properties, these then need to be accessed using `self`. This isn't possible with a static method so they override it with a regular method. This is fine as far as Python is concerned but PyLint doesn't like the `self` parameters adding an argument to the method. All colorschemes should actually implement the `use` method anyway so making it an `@abstractmethod` seems appropriate and allows us to include the `self` argument. --- ranger/gui/colorscheme.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ranger') diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py index 859773fb..22ff053f 100644 --- a/ranger/gui/colorscheme.py +++ b/ranger/gui/colorscheme.py @@ -27,6 +27,7 @@ set colorscheme yourschemename from __future__ import (absolute_import, division, print_function) import os.path +from abc import abstractmethod from curses import color_pair from io import open @@ -72,8 +73,8 @@ class ColorScheme(object): fg, bg, attr = self.get(*flatten(keys)) return attr | color_pair(get_color(fg, bg)) - @staticmethod - def use(_): + @abstractmethod + def use(self, context): """Use the colorscheme to determine the (fg, bg, attr) tuple. Override this method in your own colorscheme. -- cgit 1.4.1-2-gfad0