diff --git a/glances/core/glances_client.py b/glances/core/glances_client.py index e207dc5d66cd3abe34b79ef690fcede2cd811ae0..5e3f2c7101e410ef3f38ba133400febb17a03641 100644 --- a/glances/core/glances_client.py +++ b/glances/core/glances_client.py @@ -32,10 +32,10 @@ except ImportError: # Python 2 # Import Glances libs from glances.core.glances_globals import version from glances.core.glances_stats import GlancesStatsClient -from glances.outputs.glances_curses import glancesCurses +from glances.outputs.glances_curses import GlancesCurses -class GlancesClient(): +class GlancesClient(object): """ This class creates and manages the TCP client """ @@ -126,7 +126,7 @@ class GlancesClient(): self.stats.load_limits(self.config) # Init screen - self.screen = glancesCurses(args=self.args) + self.screen = GlancesCurses(args=self.args) # Return result return ret @@ -201,4 +201,3 @@ class GlancesClient(): End of the client session """ self.screen.end() - diff --git a/glances/core/glances_globals.py b/glances/core/glances_globals.py index 7de11090f7e60ab45aa5914dd1d31d1b4e199658..5b46cee4c877f1263909b7b062127af9a42d19bc 100644 --- a/glances/core/glances_globals.py +++ b/glances/core/glances_globals.py @@ -60,9 +60,9 @@ else: # ============================================ # glances_processes for processcount and processlist plugins -from glances.core.glances_processes import glancesProcesses -glances_processes = glancesProcesses() +from glances.core.glances_processes import GlancesProcesses +glances_processes = GlancesProcesses() # The global instance for the logs -from glances.core.glances_logs import glancesLogs -glances_logs = glancesLogs() +from glances.core.glances_logs import GlancesLogs +glances_logs = GlancesLogs() diff --git a/glances/core/glances_logs.py b/glances/core/glances_logs.py index 37e3143ed12e89b99e4530a1a88afda8e2cea9ef..99f97cc0f8db7cec03daff03c24c01d6e339c7b9 100644 --- a/glances/core/glances_logs.py +++ b/glances/core/glances_logs.py @@ -25,7 +25,7 @@ from datetime import datetime from glances.core.glances_globals import glances_processes -class glancesLogs: +class GlancesLogs(object): """ Manage logs inside the Glances software Logs is a list of list (stored in the self.logs_list var) diff --git a/glances/core/glances_main.py b/glances/core/glances_main.py index d3d2692bcdbf53ca0ed56ef261a3f24d2dc0a753..50c494822bc1c6a61416c2711b7e3f72f47cd871 100644 --- a/glances/core/glances_main.py +++ b/glances/core/glances_main.py @@ -175,9 +175,9 @@ class GlancesMain(object): """ Hash a plain password and return the hashed one """ - from glances.core.glances_password import glancesPassword + from glances.core.glances_password import GlancesPassword - password = glancesPassword() + password = GlancesPassword() return password.hash_password(plain_password) @@ -187,9 +187,9 @@ class GlancesMain(object): - with confirmation if confirm = True - plain (clear password) if clear = True """ - from glances.core.glances_password import glancesPassword + from glances.core.glances_password import GlancesPassword - password = glancesPassword() + password = GlancesPassword() return password.get_password(description, confirm, clear) diff --git a/glances/core/glances_monitor_list.py b/glances/core/glances_monitor_list.py index 4de6fcf05ac6d096f2ded2967f9e710de67ef9fd..33ce74c294e3287d63e4a67d2f23749877228a5f 100644 --- a/glances/core/glances_monitor_list.py +++ b/glances/core/glances_monitor_list.py @@ -25,7 +25,7 @@ import subprocess from glances.core.glances_globals import glances_processes -class monitorList: +class MonitorList(object): """ This class describes the optionnal monitored processes list A list of 'important' processes to monitor. @@ -52,11 +52,11 @@ class monitorList: if self.config is not None and self.config.has_section('monitor'): # Process monitoring list - self.__setMonitorList('monitor', 'list') + self.__set_monitor_list('monitor', 'list') else: self.__monitor_list = [] - def __setMonitorList(self, section, key): + def __set_monitor_list(self, section, key): """ Init the monitored processes list The list is defined in the Glances configuration file diff --git a/glances/core/glances_password.py b/glances/core/glances_password.py index 04bd738506833d6ef5542eb55db85174bd12001b..96b1bd6bfed5f63b1158f669579b93e9427fc3d6 100644 --- a/glances/core/glances_password.py +++ b/glances/core/glances_password.py @@ -40,7 +40,7 @@ except NameError: pass -class glancesPassword: +class GlancesPassword(object): """ Manage password """ diff --git a/glances/core/glances_processes.py b/glances/core/glances_processes.py index 48640b563c71b11467a455badae8f2a10df7e844..a36044d91dd0e3187987b32bdbb301e6a61d00ec 100644 --- a/glances/core/glances_processes.py +++ b/glances/core/glances_processes.py @@ -17,14 +17,13 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -import psutil - -# Import Glances lib from glances.core.glances_globals import is_bsd, is_mac, is_windows from glances.core.glances_timer import Timer, getTimeSinceLastUpdate +import psutil + -class glancesProcesses: +class GlancesProcesses(object): """ Get processed stats using the PsUtil lib """ diff --git a/glances/core/glances_server.py b/glances/core/glances_server.py index 0325894ae8594b8e8d3b673b00ec5bae980ac910..56244e00eee3228987e1b15cd248cbbf20d78f49 100644 --- a/glances/core/glances_server.py +++ b/glances/core/glances_server.py @@ -65,22 +65,22 @@ class GlancesXMLRPCHandler(SimpleXMLRPCRequestHandler): assert basic == 'Basic', 'Only basic authentication supported' # Encoded portion of the header is a string # Need to convert to bytestring - encodedByteString = encoded.encode() + encoded_byte_string = encoded.encode() # Decode Base64 byte String to a decoded Byte String - decodedBytes = b64decode(encodedByteString) + decoded_bytes = b64decode(encoded_byte_string) # Convert from byte string to a regular String - decodedString = decodedBytes.decode() + decoded_string = decoded_bytes.decode() # Get the username and password from the string - (username, _, password) = decodedString.partition(':') + (username, _, password) = decoded_string.partition(':') # Check that username and password match internal global dictionary return self.check_user(username, password) def check_user(self, username, password): # Check username and password in the dictionnary if username in self.server.user_dict: - from glances.core.glances_password import glancesPassword + from glances.core.glances_password import GlancesPassword - pwd = glancesPassword() + pwd = GlancesPassword() return pwd.check_password(self.server.user_dict[username], password) else: @@ -119,7 +119,7 @@ class GlancesXMLRPCServer(SimpleXMLRPCServer): requestHandler) -class GlancesInstance(): +class GlancesInstance(object): """ All the methods of this class are published as XML RPC methods """ @@ -189,7 +189,7 @@ class GlancesInstance(): raise AttributeError(item) -class GlancesServer(): +class GlancesServer(object): """ This class creates and manages the TCP server """ diff --git a/glances/core/glances_standalone.py b/glances/core/glances_standalone.py index 2c89d537f09b06af31630292cf495200ced3b6e2..c6edf5894399ec658c5e74b0c510c3b6f1759f71 100644 --- a/glances/core/glances_standalone.py +++ b/glances/core/glances_standalone.py @@ -19,10 +19,10 @@ # Import Glances libs from glances.core.glances_stats import GlancesStats -from glances.outputs.glances_curses import glancesCurses +from glances.outputs.glances_curses import GlancesCurses -class GlancesStandalone(): +class GlancesStandalone(object): """ This class creates and manages the Glances standalone session """ @@ -37,15 +37,15 @@ class GlancesStandalone(): # Init CSV output if args.output_csv is not None: - from glances.outputs.glances_csv import glancesCSV + from glances.outputs.glances_csv import GlancesCSV - self.csvoutput = glancesCSV(args=args) + self.csvoutput = GlancesCSV(args=args) self.csv_tag = True else: self.csv_tag = False # Init screen - self.screen = glancesCurses(args=args) + self.screen = GlancesCurses(args=args) def serve_forever(self): """ diff --git a/glances/core/glances_timer.py b/glances/core/glances_timer.py index ce9ce4ef9786334c93e8532fb37ca90bc6ba0e0c..7c5710abe541750e9c2bc464f69ccc73b163aa14 100644 --- a/glances/core/glances_timer.py +++ b/glances/core/glances_timer.py @@ -36,7 +36,7 @@ def getTimeSinceLastUpdate(IOType): return time_since_update -class Timer: +class Timer(object): """ The timer class A simple chrono @@ -57,4 +57,3 @@ class Timer: def finished(self): return time() > self.target - diff --git a/glances/core/glances_webserver.py b/glances/core/glances_webserver.py index 6c134feb93ebe7c463bc59f8400d0d8fb0d84c05..c8249710a5a8b64298410890e293b6b76bb90166 100644 --- a/glances/core/glances_webserver.py +++ b/glances/core/glances_webserver.py @@ -22,10 +22,10 @@ Glances Web Interface (Bottle based) # Import Glances libs from glances.core.glances_stats import GlancesStats -from glances.outputs.glances_bottle import glancesBottle +from glances.outputs.glances_bottle import GlancesBottle -class GlancesWebServer(): +class GlancesWebServer(object): """ This class creates and manages the Glances Web Server session """ @@ -39,7 +39,7 @@ class GlancesWebServer(): self.stats.update() # Init the Bottle Web server - self.web = glancesBottle(args=args) + self.web = GlancesBottle(args=args) def serve_forever(self): """ diff --git a/glances/outputs/glances_bottle.py b/glances/outputs/glances_bottle.py index fe5ea208fe3d2981929fa52e3c7220dae12e4826..08673a73bc06265f7ed712898742ade6ddd3f1f1 100644 --- a/glances/outputs/glances_bottle.py +++ b/glances/outputs/glances_bottle.py @@ -27,7 +27,7 @@ except ImportError: sys.exit(1) -class glancesBottle: +class GlancesBottle(object): """ This class manage the Bottle Web Server """ @@ -186,7 +186,7 @@ class glancesBottle: if m['msg'].split(' ', 1)[0] != '': tpl += ' %s' % \ (self.__style_list[m['decoration']], - m['msg'].split(' ', 1)[0].replace(' ', ' ')[:20]) + m['msg'].split(' ', 1)[0].replace(' ', ' ')[:20]) elif m['optional']: # Manage optional stats (responsive design) tpl += '%s' % \ diff --git a/glances/outputs/glances_colorconsole.py b/glances/outputs/glances_colorconsole.py index 20d9b1ae2d4b43f664206e5d4e2ea43ca5fb9127..f61f66a24b6b79c78c3a7294a3f93f25ad3f5776 100644 --- a/glances/outputs/glances_colorconsole.py +++ b/glances/outputs/glances_colorconsole.py @@ -59,7 +59,7 @@ class ListenGetch(threading.Thread): return default -class Screen(): +class Screen(object): COLOR_DEFAULT_WIN = '0F' # 07'#'0F' COLOR_BK_DEFAULT = colorconsole.terminal.colors["BLACK"] @@ -116,7 +116,7 @@ class Screen(): return None -class WCurseLight(): +class WCurseLight(object): COLOR_WHITE = colorconsole.terminal.colors["WHITE"] COLOR_RED = colorconsole.terminal.colors["RED"] diff --git a/glances/outputs/glances_csv.py b/glances/outputs/glances_csv.py index ae17e2670e17efe48a1939b49bd281c4e9f2d0d4..4c1293447ad559c2023943cd35c73fd2afca39fc 100644 --- a/glances/outputs/glances_csv.py +++ b/glances/outputs/glances_csv.py @@ -28,7 +28,7 @@ from glances.core.glances_globals import is_py3 csv_stats_list = ['cpu', 'load', 'mem', 'memswap'] -class glancesCSV: +class GlancesCSV(object): """ This class manages the CSV output """ diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index a07f32b3b94f6b0bb7fc22facd787873d2cb81f8..147433d003707d5ee2642521addf3293d14f0568 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -37,7 +37,7 @@ else: curses = WCurseLight() -class glancesCurses: +class GlancesCurses(object): """ This class manage the curses display (and key pressed) """ @@ -160,7 +160,7 @@ class glancesCurses: self.term_window.nodelay(1) self.pressedkey = -1 - def __getkey(self, window): + def __get_key(self, window): """ A getKey function to catch ESC key AND Numlock key (issue #163) """ @@ -174,10 +174,10 @@ class glancesCurses: else: return keycode[0] - def __catchKey(self): + def __catch_key(self): # Get key - #~ self.pressedkey = self.term_window.getch() - self.pressedkey = self.__getkey(self.term_window) + # ~ self.pressedkey = self.term_window.getch() + self.pressedkey = self.__get_key(self.term_window) # Actions... if self.pressedkey == ord('\x1b') or self.pressedkey == ord('q'): @@ -456,7 +456,7 @@ class glancesCurses: countdown = Timer(self.__refresh_time) while (not countdown.finished()): # Getkey - if self.__catchKey() > -1: + if self.__catch_key() > -1: # flush display self.flush(stats, cs_status=cs_status) # Wait 100ms... diff --git a/glances/plugins/glances_batpercent.py b/glances/plugins/glances_batpercent.py index c961aa07694dbd1b65c9013d12db571d1cefe617..335e4dd8dcf4a395ff54b331f035f417b92770d3 100644 --- a/glances/plugins/glances_batpercent.py +++ b/glances/plugins/glances_batpercent.py @@ -41,7 +41,7 @@ class Plugin(GlancesPlugin): GlancesPlugin.__init__(self, args=args) # Init the sensor class - self.glancesgrabbat = glancesGrabBat() + self.glancesgrabbat = GlancesGrabBat() # We do not want to display the stat in a dedicated area # The HDD temp is displayed within the sensors plugin @@ -78,7 +78,7 @@ class Plugin(GlancesPlugin): return self.stats -class glancesGrabBat: +class GlancesGrabBat(object): """ Get batteries stats using the Batinfo library """ diff --git a/glances/plugins/glances_core.py b/glances/plugins/glances_core.py index dd147eab5c5ae10dd07ed34009c0e482578a532b..d060b2b46754b433b6f33ff9747a1019126a78f5 100644 --- a/glances/plugins/glances_core.py +++ b/glances/plugins/glances_core.py @@ -17,10 +17,10 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -import psutil - from glances.plugins.glances_plugin import GlancesPlugin +import psutil + class Plugin(GlancesPlugin): """ diff --git a/glances/plugins/glances_cpu.py b/glances/plugins/glances_cpu.py index dbf541b6187272b8a4f7f1e485f37f0b610fa5d0..2d229c8407090a03c283666a6ae250b76c396c1e 100644 --- a/glances/plugins/glances_cpu.py +++ b/glances/plugins/glances_cpu.py @@ -20,10 +20,10 @@ Glances CPU plugin """ -import psutil - from glances.plugins.glances_plugin import GlancesPlugin +import psutil + # SNMP OID # percentage of user CPU time: .1.3.6.1.4.1.2021.11.9.0 # percentages of system CPU time: .1.3.6.1.4.1.2021.11.10.0 diff --git a/glances/plugins/glances_diskio.py b/glances/plugins/glances_diskio.py index f0c572f684507c4c1b6a135e4701b4e92c7c3aa3..87f4041f3058be1ead697c5ef6aeca5bac3d59e1 100644 --- a/glances/plugins/glances_diskio.py +++ b/glances/plugins/glances_diskio.py @@ -20,12 +20,12 @@ Glances DiskIO plugin """ -import psutil - # Import Glances libs from glances.core.glances_timer import getTimeSinceLastUpdate from glances.plugins.glances_plugin import GlancesPlugin +import psutil + class Plugin(GlancesPlugin): """ diff --git a/glances/plugins/glances_fs.py b/glances/plugins/glances_fs.py index db41cbcdeae58662b764f555b204bd09771dc70f..e3c2b1e28b867d6d5a04fb764a53c6317530703b 100644 --- a/glances/plugins/glances_fs.py +++ b/glances/plugins/glances_fs.py @@ -17,10 +17,10 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -import psutil - from glances.plugins.glances_plugin import GlancesPlugin +import psutil + # SNMP OID # The snmpd.conf needs to be edited. # Add the following to enable it on all disk diff --git a/glances/plugins/glances_hddtemp.py b/glances/plugins/glances_hddtemp.py index 89423b29720891705a11b08dbd8ff17688d25a4f..3deeb85a033f4c08f8a26f62e1281de514a54221 100644 --- a/glances/plugins/glances_hddtemp.py +++ b/glances/plugins/glances_hddtemp.py @@ -35,7 +35,7 @@ class Plugin(GlancesPlugin): GlancesPlugin.__init__(self, args=args) # Init the sensor class - self.glancesgrabhddtemp = glancesGrabHDDTemp() + self.glancesgrabhddtemp = GlancesGrabHDDTemp() # We do not want to display the stat in a dedicated area # The HDD temp is displayed within the sensors plugin @@ -70,7 +70,7 @@ class Plugin(GlancesPlugin): return self.stats -class glancesGrabHDDTemp: +class GlancesGrabHDDTemp(object): """ Get hddtemp stats using a socket connection """ diff --git a/glances/plugins/glances_mem.py b/glances/plugins/glances_mem.py index b11bdb3a84b3b5b77359091a199bab117117c52d..d102854aacc4d8963ac00819a9676f29a97124a5 100644 --- a/glances/plugins/glances_mem.py +++ b/glances/plugins/glances_mem.py @@ -20,10 +20,10 @@ Glances virtual memory plugin """ -import psutil - from glances.plugins.glances_plugin import GlancesPlugin +import psutil + # SNMP OID # Total RAM in machine: .1.3.6.1.4.1.2021.4.5.0 # Total RAM used: .1.3.6.1.4.1.2021.4.6.0 diff --git a/glances/plugins/glances_memswap.py b/glances/plugins/glances_memswap.py index 57307ec2f403f5f237bc0e6e16ce2ef2331e7bd1..985913507af041ddc1c9ac99fc14ab5d52428c37 100644 --- a/glances/plugins/glances_memswap.py +++ b/glances/plugins/glances_memswap.py @@ -20,10 +20,10 @@ Glances swap memory plugin """ -import psutil - from glances.plugins.glances_plugin import GlancesPlugin +import psutil + # SNMP OID # Total Swap Size: .1.3.6.1.4.1.2021.4.3.0 # Available Swap Space: .1.3.6.1.4.1.2021.4.4.0 diff --git a/glances/plugins/glances_monitor.py b/glances/plugins/glances_monitor.py index 3cefe2112bbb4c7570875754feda4e9fccd65fb7..a1d16b3b2b8d491030af0cbe6e2e6a7f8f8866c4 100644 --- a/glances/plugins/glances_monitor.py +++ b/glances/plugins/glances_monitor.py @@ -18,7 +18,7 @@ # along with this program. If not, see . # Import Glances lib -from glances.core.glances_monitor_list import monitorList as glancesMonitorList +from glances.core.glances_monitor_list import MonitorList as glancesMonitorList from glances.plugins.glances_plugin import GlancesPlugin diff --git a/glances/plugins/glances_network.py b/glances/plugins/glances_network.py index d9bd26df303dd85f81f5e0b6272aacaa821a9881..68176c55e275a802e6d37301b66e35fe2c98cb8c 100644 --- a/glances/plugins/glances_network.py +++ b/glances/plugins/glances_network.py @@ -20,13 +20,11 @@ Glances Network interface plugin """ -# Import system libs -import psutil - -# Import Glances lib from glances.core.glances_timer import getTimeSinceLastUpdate from glances.plugins.glances_plugin import GlancesPlugin +import psutil + # SNMP OID # http://www.net-snmp.org/docs/mibs/interfaces.html # Dict key = interface_name @@ -169,7 +167,7 @@ class Plugin(GlancesPlugin): Return the dict to displayoid in the curse interface """ - #!!! TODO: Add alert on network interface bitrate + # !!! TODO: Add alert on network interface bitrate # Init the return message ret = [] diff --git a/glances/plugins/glances_percpu.py b/glances/plugins/glances_percpu.py index 0bdf04c6328c95dabfff77900120bfff66005680..88942541f5262f30227fba1225821b2915e094eb 100644 --- a/glances/plugins/glances_percpu.py +++ b/glances/plugins/glances_percpu.py @@ -20,12 +20,12 @@ CPU stats (per cpu) """ -# Check for psutil already done in the glances_core script -import psutil - # Import Glances libs from glances.plugins.glances_plugin import GlancesPlugin +# Check for psutil already done in the glances_core script +import psutil + class Plugin(GlancesPlugin): """ diff --git a/glances/plugins/glances_plugin.py b/glances/plugins/glances_plugin.py index 95408ba9d7c3b9dda04a8f0b5b8666f3c9cb46d9..e157c5141ce335ac5d3644863908ab82a7e4f9ef 100644 --- a/glances/plugins/glances_plugin.py +++ b/glances/plugins/glances_plugin.py @@ -256,7 +256,7 @@ class GlancesPlugin(object): def get_stats_display(self, args=None): # Return a dict with all the information needed to display the stat # key | description - #---------------------------- + # ---------------------------- # display | Display the stat (True or False) # msgdict | Message to display (list of dict [{ 'msg': msg, 'decoration': decoration } ... ]) # column | column number diff --git a/glances/plugins/glances_psutilversion.py b/glances/plugins/glances_psutilversion.py index 1999f9f3bfeec17cb470ac35422f43064d31c23f..21199913c289fc264b1936784bd00bd62cacfb65 100644 --- a/glances/plugins/glances_psutilversion.py +++ b/glances/plugins/glances_psutilversion.py @@ -17,10 +17,10 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -from psutil import __version__ as __psutil_version - from glances.plugins.glances_plugin import GlancesPlugin +from psutil import __version__ as __psutil_version + class Plugin(GlancesPlugin): """ diff --git a/glances/plugins/glances_sensors.py b/glances/plugins/glances_sensors.py index 9b18e8c68ac799521ec494a78222a36d9e473d82..8e7070fc2eb4d520bbc298d8d5b449f7d393c2a8 100644 --- a/glances/plugins/glances_sensors.py +++ b/glances/plugins/glances_sensors.py @@ -44,7 +44,7 @@ class Plugin(GlancesPlugin): GlancesPlugin.__init__(self, args=args) # Init the sensor class - self.glancesgrabsensors = glancesGrabSensors() + self.glancesgrabsensors = GlancesGrabSensors() # Instance for the HDDTemp Plugin in order to display the hard disks temperatures self.hddtemp_plugin = HddTempPlugin() @@ -143,7 +143,7 @@ class Plugin(GlancesPlugin): return ret -class glancesGrabSensors: +class GlancesGrabSensors(object): """ Get sensors stats using the PySensors library """ diff --git a/glances/plugins/glances_system.py b/glances/plugins/glances_system.py index 922b43ae94019d7a591a97383623e5df67103ac8..29fdaeab7bf38275a12c12e7a02835d45167349e 100644 --- a/glances/plugins/glances_system.py +++ b/glances/plugins/glances_system.py @@ -31,6 +31,7 @@ from glances.plugins.glances_plugin import GlancesPlugin snmp_oid = {'hostname': '1.3.6.1.2.1.1.5.0', 'os_name': '1.3.6.1.2.1.1.1.0'} + class Plugin(GlancesPlugin): """ Glances' Host/System Plugin diff --git a/glances/plugins/glances_uptime.py b/glances/plugins/glances_uptime.py index e482d230c18958876c5ea9789a53e7c289ad30c4..900fe1c2ac3543cbce19908e5a6a4360fb99a1f8 100644 --- a/glances/plugins/glances_uptime.py +++ b/glances/plugins/glances_uptime.py @@ -20,15 +20,16 @@ # Import system libs from datetime import datetime, timedelta -# Check for psutil already done in the glances_core script -import psutil - # Import Glances libs from glances.plugins.glances_plugin import GlancesPlugin +# Check for psutil already done in the glances_core script +import psutil + # SNMP OID snmp_oid = {'_uptime': '1.3.6.1.2.1.1.3.0'} + class Plugin(GlancesPlugin): """ Glances' Uptime Plugin