diff options
author | Ilya Mashchenko <ilyamaschenko@gmail.com> | 2018-09-24 16:16:09 +0900 |
---|---|---|
committer | Costa Tsaousis <costa@tsaousis.gr> | 2018-09-24 10:16:09 +0300 |
commit | a216190bb0b1c017df05a297bdc20e48eb4f395f (patch) | |
tree | 7f86b5699de60aa990c6fad8f1647e50edfaed35 /python.d | |
parent | a0f1d2becae25e7f3fdd1ef1f391eb794eeb851c (diff) |
fix python warnings identified by LGTM (#4275)
* python.d: remove base.py
* python.d: charts.py lgtm fixes
* python.d: mongodb lgtm fixes
* python.d: smartd_log lgtm fixes
* python.d: remove base.py from makefile
Diffstat (limited to 'python.d')
-rw-r--r-- | python.d/Makefile.am | 1 | ||||
-rw-r--r-- | python.d/mongodb.chart.py | 13 | ||||
-rw-r--r-- | python.d/python_modules/base.py | 10 | ||||
-rw-r--r-- | python.d/python_modules/bases/charts.py | 9 | ||||
-rw-r--r-- | python.d/smartd_log.chart.py | 6 |
5 files changed, 23 insertions, 16 deletions
diff --git a/python.d/Makefile.am b/python.d/Makefile.am index aef5db8a27..899e31244c 100644 --- a/python.d/Makefile.am +++ b/python.d/Makefile.am @@ -77,7 +77,6 @@ dist_python_DATA = \ pythonmodulesdir=$(pythondir)/python_modules dist_pythonmodules_DATA = \ python_modules/__init__.py \ - python_modules/base.py \ $(NULL) basesdir=$(pythonmodulesdir)/bases diff --git a/python.d/mongodb.chart.py b/python.d/mongodb.chart.py index e81bed84d9..c0b50be4d9 100644 --- a/python.d/mongodb.chart.py +++ b/python.d/mongodb.chart.py @@ -258,8 +258,10 @@ CHARTS = { ['moves', None, 'incremental', 1, 1] ]}, 'asserts': { - 'options': [None, 'Number of message, warning, regular, corresponding to errors generated' - ' by users assertions raised', 'number', 'errors (asserts)', 'mongodb.asserts', 'line'], + 'options': [ + None, + 'Number of message, warning, regular, corresponding to errors generated by users assertions raised', + 'number', 'errors (asserts)', 'mongodb.asserts', 'line'], 'lines': [ ['msg', None, 'incremental', 1, 1], ['warning', None, 'incremental', 1, 1], @@ -492,9 +494,10 @@ class Service(SimpleService): # Create "heartbeat delay" chart self.order.append('heartbeat_delay') self.definitions['heartbeat_delay'] = { - 'options': [None, 'Time when last heartbeat was received' - ' from the replica set member (lastHeartbeatRecv)', - 'seconds ago', 'replication and oplog', 'mongodb.replication_heartbeat_delay', 'stacked'], + 'options': [ + None, + 'Time when last heartbeat was received from the replica set member (lastHeartbeatRecv)', + 'seconds ago', 'replication and oplog', 'mongodb.replication_heartbeat_delay', 'stacked'], 'lines': create_lines(other_hosts, 'heartbeat_lag')} # Create "optimedate delay" chart self.order.append('optimedate_delay') diff --git a/python.d/python_modules/base.py b/python.d/python_modules/base.py deleted file mode 100644 index 17be75165a..0000000000 --- a/python.d/python_modules/base.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Description: backward compatibility with old version -# SPDX-License-Identifier: GPL-3.0+ - -from bases.FrameworkServices.SimpleService import SimpleService -from bases.FrameworkServices.UrlService import UrlService -from bases.FrameworkServices.SocketService import SocketService -from bases.FrameworkServices.LogService import LogService -from bases.FrameworkServices.ExecutableService import ExecutableService -from bases.FrameworkServices.MySQLService import MySQLService diff --git a/python.d/python_modules/bases/charts.py b/python.d/python_modules/bases/charts.py index 0c6e78c678..14b2bd562e 100644 --- a/python.d/python_modules/bases/charts.py +++ b/python.d/python_modules/bases/charts.py @@ -307,6 +307,12 @@ class Dimension: return self.id == other return self.id == other.id + def __ne__(self, other): + return not self == other + + def __hash__(self): + return hash(repr(self)) + def create(self): return DIMENSION_CREATE.format(**self.params) @@ -363,6 +369,9 @@ class ChartVariable: return self.id == other.id return False + def __ne__(self, other): + return not self == other + def __hash__(self): return hash(repr(self)) diff --git a/python.d/smartd_log.chart.py b/python.d/smartd_log.chart.py index a73800f40c..050656ba4d 100644 --- a/python.d/smartd_log.chart.py +++ b/python.d/smartd_log.chart.py @@ -185,6 +185,12 @@ class Disk: return self.name == other.name return self.name == other + def __ne__(self, other): + return not self == other + + def __hash__(self): + return hash(repr(self)) + @handle_os_error def is_active(self): return (time() - os.path.getmtime(self.log_file.path)) / 60 < self.age |