diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2016-10-26 19:22:12 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2016-10-26 19:22:12 +0100 |
commit | eefd207b915716cb2f77a4bd5901ca4680f818b7 (patch) | |
tree | 33776e9381a1b69d04bc9ddb9995bc705a5c9174 | |
parent | a587569816f05a21cb7578b6c3feca986892de9a (diff) | |
download | sos-eefd207b915716cb2f77a4bd5901ca4680f818b7.tar.gz |
[global] make class method instance names consistent
A method decorated with @classmethod receives an instance of the
class object (rather than an instance of the class) in its first
argument - use 'cls' in these functions rather than 'self'.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/archive.py | 4 | ||||
-rw-r--r-- | sos/plugins/__init__.py | 8 | ||||
-rw-r--r-- | sos/policies/debian.py | 2 | ||||
-rw-r--r-- | sos/policies/ibmkvm.py | 4 | ||||
-rw-r--r-- | sos/policies/osx.py | 2 | ||||
-rw-r--r-- | sos/policies/redhat.py | 12 | ||||
-rw-r--r-- | sos/policies/suse.py | 4 | ||||
-rw-r--r-- | sos/policies/ubuntu.py | 2 |
8 files changed, 19 insertions, 19 deletions
diff --git a/sos/archive.py b/sos/archive.py index a69bbff8..4d9a4696 100644 --- a/sos/archive.py +++ b/sos/archive.py @@ -45,10 +45,10 @@ class Archive(object): """Abstract base class for archives.""" @classmethod - def archive_type(class_): + def archive_type(cls): """Returns the archive class's name as a string. """ - return class_.__name__ + return cls.__name__ log = logging.getLogger("sos") diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index c6f1fd78..8e65962c 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -137,13 +137,13 @@ class Plugin(object): 'enabled': opt[3]}) @classmethod - def name(class_): + def name(cls): """Returns the plugin's name as a string. This should return a lowercase string. """ - if class_.plugin_name: - return class_.plugin_name - return class_.__name__.lower() + if cls.plugin_name: + return cls.plugin_name + return cls.__name__.lower() def _format_msg(self, msg): return "[plugin:%s] %s" % (self.name(), msg) diff --git a/sos/policies/debian.py b/sos/policies/debian.py index e56e546b..a785c396 100644 --- a/sos/policies/debian.py +++ b/sos/policies/debian.py @@ -25,7 +25,7 @@ class DebianPolicy(LinuxPolicy): self.valid_subclasses = [DebianPlugin] @classmethod - def check(self): + def check(cls): """This method checks to see if we are running on Debian. It returns True or False.""" return os.path.isfile('/etc/debian_version') diff --git a/sos/policies/ibmkvm.py b/sos/policies/ibmkvm.py index c93f9606..1a00cad9 100644 --- a/sos/policies/ibmkvm.py +++ b/sos/policies/ibmkvm.py @@ -34,7 +34,7 @@ class PowerKVMPolicy(RedHatPolicy): self.valid_subclasses = [PowerKVMPlugin, RedHatPlugin] @classmethod - def check(self): + def check(cls): """This method checks to see if we are running on PowerKVM. It returns True or False.""" return os.path.isfile('/etc/ibm_powerkvm-release') @@ -59,7 +59,7 @@ class ZKVMPolicy(RedHatPolicy): self.valid_subclasses = [ZKVMPlugin, RedHatPlugin] @classmethod - def check(self): + def check(cls): """This method checks to see if we are running on IBM Z KVM. It returns True or False.""" return os.path.isfile('/etc/base-release') diff --git a/sos/policies/osx.py b/sos/policies/osx.py index dd8d7753..2228e1e2 100644 --- a/sos/policies/osx.py +++ b/sos/policies/osx.py @@ -7,7 +7,7 @@ class OSXPolicy(Policy): distro = "Mac OS X" @classmethod - def check(class_): + def check(cls): try: return "Mac OS X" in shell_out("sw_vers") except Exception: diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py index 3ed4f244..a1565c63 100644 --- a/sos/policies/redhat.py +++ b/sos/policies/redhat.py @@ -73,7 +73,7 @@ class RedHatPolicy(LinuxPolicy): self.set_exec_path() @classmethod - def check(self): + def check(cls): """This method checks to see if we are running on Red Hat. It must be overriden by concrete subclasses to return True when running on a Fedora, RHEL or other Red Hat distribution or False otherwise.""" @@ -158,10 +158,10 @@ No changes will be made to system configuration. super(RHELPolicy, self).__init__(sysroot=sysroot) @classmethod - def check(self): + def check(cls): """This method checks to see if we are running on RHEL. It returns True or False.""" - return (os.path.isfile(self._redhat_release) and not + return (os.path.isfile(cls._redhat_release) and not os.path.isfile('/etc/fedora-release')) def dist_version(self): @@ -216,11 +216,11 @@ organization before being passed to any third party. """) @classmethod - def check(self): + def check(cls): atomic = False if ENV_HOST_SYSROOT not in os.environ: return atomic - host_release = os.environ[ENV_HOST_SYSROOT] + self._redhat_release + host_release = os.environ[ENV_HOST_SYSROOT] + cls._redhat_release if not os.path.exists(host_release): return False try: @@ -241,7 +241,7 @@ class FedoraPolicy(RedHatPolicy): super(FedoraPolicy, self).__init__(sysroot=sysroot) @classmethod - def check(self): + def check(cls): """This method checks to see if we are running on Fedora. It returns True or False.""" return os.path.isfile('/etc/fedora-release') diff --git a/sos/policies/suse.py b/sos/policies/suse.py index 00414ce8..700f5126 100644 --- a/sos/policies/suse.py +++ b/sos/policies/suse.py @@ -50,7 +50,7 @@ class SuSEPolicy(LinuxPolicy): self.set_exec_path() @classmethod - def check(self): + def check(cls): """This method checks to see if we are running on SuSE. It must be overriden by concrete subclasses to return True when running on an OpenSuSE, SLES or other Suse distribution and False otherwise.""" @@ -108,7 +108,7 @@ No changes will be made to system configuration. super(OpenSuSEPolicy, self).__init__() @classmethod - def check(self): + def check(cls): """This method checks to see if we are running on SuSE. """ return (os.path.isfile('/etc/SuSE-release')) diff --git a/sos/policies/ubuntu.py b/sos/policies/ubuntu.py index f2364219..6309631e 100644 --- a/sos/policies/ubuntu.py +++ b/sos/policies/ubuntu.py @@ -14,7 +14,7 @@ class UbuntuPolicy(DebianPolicy): self.valid_subclasses = [UbuntuPlugin, DebianPlugin] @classmethod - def check(self): + def check(cls): """This method checks to see if we are running on Ubuntu. It returns True or False.""" try: |