mirror of https://github.com/nicolargo/glances.git
Reformat the code
This commit is contained in:
parent
1ed761c1aa
commit
a62ea3d21e
|
|
@ -12,6 +12,7 @@
|
|||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
from glances import __version__
|
||||
import sys
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
|
@ -24,7 +25,6 @@ from datetime import datetime
|
|||
# Insert Glances' path into the system.
|
||||
sys.path.insert(0, os.path.abspath('..'))
|
||||
|
||||
from glances import __version__
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -127,8 +127,7 @@ class GlancesBottle(object):
|
|||
if username == self.args.username:
|
||||
from glances.password import GlancesPassword
|
||||
|
||||
pwd = GlancesPassword(username=username,
|
||||
config=self.config)
|
||||
pwd = GlancesPassword(username=username, config=self.config)
|
||||
return pwd.check_password(self.args.password, pwd.sha256_hash(password))
|
||||
else:
|
||||
return False
|
||||
|
|
|
|||
|
|
@ -41,9 +41,7 @@ class GlancesPassword(object):
|
|||
if self.config is None:
|
||||
return user_config_dir()
|
||||
else:
|
||||
return self.config.get_value('passwords',
|
||||
'local_password_path',
|
||||
default=user_config_dir())
|
||||
return self.config.get_value('passwords', 'local_password_path', default=user_config_dir())
|
||||
|
||||
def sha256_hash(self, plain_password):
|
||||
"""Return the SHA-256 of the given password."""
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ Just a stupid plugin to display the help screen.
|
|||
"""
|
||||
import sys
|
||||
from glances.compat import iteritems
|
||||
from collections import OrderedDict
|
||||
from glances import __version__, psutil_version
|
||||
from glances.plugins.glances_plugin import GlancesPlugin
|
||||
from itertools import chain
|
||||
|
|
@ -63,7 +62,7 @@ class Plugin(GlancesPlugin):
|
|||
|
||||
self.view_data.update(
|
||||
[
|
||||
## First column
|
||||
# First column
|
||||
#
|
||||
('header_sort', msg_header.format('SORT PROCESSES:')),
|
||||
('sort_auto', msg_col.format('a', 'Automatically')),
|
||||
|
|
@ -91,7 +90,7 @@ class Plugin(GlancesPlugin):
|
|||
('show_hide_wifi_module', msg_col.format('W', 'Wifi')),
|
||||
('show_hide_processes', msg_col.format('z', 'Processes')),
|
||||
('show_hide_left_sidebar', msg_col.format('2', 'Left sidebar')),
|
||||
## Second column
|
||||
# Second column
|
||||
#
|
||||
('show_hide_quick_look', msg_col.format('3', 'Quick Look')),
|
||||
('show_hide_cpu_mem_swap', msg_col.format('4', 'CPU, MEM, and SWAP')),
|
||||
|
|
@ -146,7 +145,7 @@ class Plugin(GlancesPlugin):
|
|||
|
||||
ret.append(self.curse_new_line())
|
||||
|
||||
## key-shortcuts
|
||||
# key-shortcuts
|
||||
#
|
||||
# Collect all values after the 1st key-msg
|
||||
# in a list of curse-lines.
|
||||
|
|
|
|||
|
|
@ -67,8 +67,7 @@ class GlancesXMLRPCHandler(SimpleXMLRPCRequestHandler, object):
|
|||
if username in self.server.user_dict:
|
||||
from glances.password import GlancesPassword
|
||||
|
||||
pwd = GlancesPassword(username=username,
|
||||
config=self.config)
|
||||
pwd = GlancesPassword(username=username, config=self.config)
|
||||
return pwd.check_password(self.server.user_dict[username], password)
|
||||
else:
|
||||
return False
|
||||
|
|
@ -94,10 +93,7 @@ class GlancesXMLRPCServer(SimpleXMLRPCServer, object):
|
|||
|
||||
finished = False
|
||||
|
||||
def __init__(self, bind_address,
|
||||
bind_port=61209,
|
||||
requestHandler=GlancesXMLRPCHandler,
|
||||
config=None):
|
||||
def __init__(self, bind_address, bind_port=61209, requestHandler=GlancesXMLRPCHandler, config=None):
|
||||
|
||||
self.bind_address = bind_address
|
||||
self.bind_port = bind_port
|
||||
|
|
@ -196,10 +192,7 @@ class GlancesServer(object):
|
|||
|
||||
# Init the XML RPC server
|
||||
try:
|
||||
self.server = GlancesXMLRPCServer(args.bind_address,
|
||||
args.port,
|
||||
requestHandler,
|
||||
config=config)
|
||||
self.server = GlancesXMLRPCServer(args.bind_address, args.port, requestHandler, config=config)
|
||||
except Exception as e:
|
||||
logger.critical("Cannot start Glances server: {}".format(e))
|
||||
sys.exit(2)
|
||||
|
|
|
|||
Loading…
Reference in New Issue