From 2d2a3f378057cc22bebca9be12781d982642bbd2 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 12 Jun 2014 15:31:02 +0200 Subject: [PATCH] colorizer: use staticmethod rather than classmethod The methods are actually not class methods at all as they do not use the class nor the instance. Change-Id: I04721bcaef30da291389a1144bdcfe65f10753b2 --- tools/colorizer.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/colorizer.py b/tools/colorizer.py index 8e638416bd..64f5f4e95d 100755 --- a/tools/colorizer.py +++ b/tools/colorizer.py @@ -62,9 +62,10 @@ class _AnsiColorizer(object): def __init__(self, stream): self.stream = stream - def supported(cls, stream=sys.stdout): + @staticmethod + def supported(stream=sys.stdout): """ - A class method that returns True if the current platform supports + A method that returns True if the current platform supports coloring terminal output using this method. Returns False otherwise. """ if not stream.isatty(): @@ -83,7 +84,6 @@ class _AnsiColorizer(object): except Exception: # guess false in case of error return False - supported = classmethod(supported) def write(self, text, color): """ @@ -121,7 +121,8 @@ class _Win32Colorizer(object): 'white': red | green | blue | bold } - def supported(cls, stream=sys.stdout): + @staticmethod + def supported(stream=sys.stdout): try: import win32console screenBuffer = win32console.GetStdHandle( @@ -138,7 +139,6 @@ class _Win32Colorizer(object): return False else: return True - supported = classmethod(supported) def write(self, text, color): color = self._colors[color] @@ -154,9 +154,9 @@ class _NullColorizer(object): def __init__(self, stream): self.stream = stream - def supported(cls, stream=sys.stdout): + @staticmethod + def supported(stream=sys.stdout): return True - supported = classmethod(supported) def write(self, text, color): self.stream.write(text)