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
Ilya Mashchenko committed
Sep 24, 2018 at 16:16 UTC
a216190bb0b1c017df05a297bdc20e48eb4f395f
5 files changed
+23
-16
python.d/Makefile.am
-1
@@ -77,7 +77,6 @@ dist_python_DATA = \
77
pythonmodulesdir=$(pythondir)/python_modules
78
dist_pythonmodules_DATA = \
79
python_modules/__init__.py \
80
- python_modules/base.py \
80
$(NULL)
81
82
basesdir=$(pythonmodulesdir)/bases
python.d/mongodb.chart.py
+8
-5
@@ -258,8 +258,10 @@ CHARTS = {
258
['moves', None, 'incremental', 1, 1]
259
]},
260
'asserts': {
261
- 'options': [None, 'Number of message, warning, regular, corresponding to errors generated'
262
- ' by users assertions raised', 'number', 'errors (asserts)', 'mongodb.asserts', 'line'],
261
+ 'options': [
262
+ None,
263
+ 'Number of message, warning, regular, corresponding to errors generated by users assertions raised',
264
+ 'number', 'errors (asserts)', 'mongodb.asserts', 'line'],
265
'lines': [
266
['msg', None, 'incremental', 1, 1],
267
['warning', None, 'incremental', 1, 1],
@@ -492,9 +494,10 @@ class Service(SimpleService):
494
# Create "heartbeat delay" chart
495
self.order.append('heartbeat_delay')
496
self.definitions['heartbeat_delay'] = {
495
- 'options': [None, 'Time when last heartbeat was received'
496
- ' from the replica set member (lastHeartbeatRecv)',
497
- 'seconds ago', 'replication and oplog', 'mongodb.replication_heartbeat_delay', 'stacked'],
497
+ 'options': [
498
+ None,
499
+ 'Time when last heartbeat was received from the replica set member (lastHeartbeatRecv)',
500
+ 'seconds ago', 'replication and oplog', 'mongodb.replication_heartbeat_delay', 'stacked'],
501
'lines': create_lines(other_hosts, 'heartbeat_lag')}
502
# Create "optimedate delay" chart
503
self.order.append('optimedate_delay')
python.d/python_modules/base.py
deleted
-10
@@ -1,10 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-# Description: backward compatibility with old version
3
-# SPDX-License-Identifier: GPL-3.0+
4
-
5
-from bases.FrameworkServices.SimpleService import SimpleService
6
-from bases.FrameworkServices.UrlService import UrlService
7
-from bases.FrameworkServices.SocketService import SocketService
8
-from bases.FrameworkServices.LogService import LogService
9
-from bases.FrameworkServices.ExecutableService import ExecutableService
10
-from bases.FrameworkServices.MySQLService import MySQLService
python.d/python_modules/bases/charts.py
+9
@@ -307,6 +307,12 @@ class Dimension:
307
return self.id == other
308
return self.id == other.id
309
310
+ def __ne__(self, other):
311
+ return not self == other
312
+
313
+ def __hash__(self):
314
+ return hash(repr(self))
315
+
316
def create(self):
317
return DIMENSION_CREATE.format(**self.params)
318
@@ -363,6 +369,9 @@ class ChartVariable:
369
return self.id == other.id
370
return False
371
372
+ def __ne__(self, other):
373
+ return not self == other
374
+
375
def __hash__(self):
376
return hash(repr(self))
377
python.d/smartd_log.chart.py
+6
@@ -185,6 +185,12 @@ class Disk:
185
return self.name == other.name
186
return self.name == other
187
188
+ def __ne__(self, other):
189
+ return not self == other
190
+
191
+ def __hash__(self):
192
+ return hash(repr(self))
193
+
194
@handle_os_error
195
def is_active(self):
196
return (time() - os.path.getmtime(self.log_file.path)) / 60 < self.age