mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-28 22:55:55 +03:00
Remove unused imports and fix a bare except statement
This commit is contained in:
parent
3daf08c80f
commit
50a7ca7dee
@ -21,12 +21,11 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from glances.compat import range, u
|
from glances.compat import range
|
||||||
from glances.logger import logger
|
from glances.logger import logger
|
||||||
|
|
||||||
# Use the built-in version of scandir/walk if possible, otherwise
|
# Use the built-in version of scandir/walk if possible, otherwise
|
||||||
# use the scandir module version
|
# use the scandir module version
|
||||||
|
|
||||||
scandir_tag = True
|
scandir_tag = True
|
||||||
try:
|
try:
|
||||||
# For Python 3.5 or higher
|
# For Python 3.5 or higher
|
||||||
@ -35,7 +34,7 @@ except ImportError:
|
|||||||
# For others...
|
# For others...
|
||||||
try:
|
try:
|
||||||
from scandir import scandir
|
from scandir import scandir
|
||||||
except Exception as e:
|
except ImportError:
|
||||||
scandir_tag = False
|
scandir_tag = False
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,10 +19,8 @@
|
|||||||
|
|
||||||
"""Folder plugin."""
|
"""Folder plugin."""
|
||||||
|
|
||||||
from glances.compat import u
|
|
||||||
from glances.folder_list import FolderList as glancesFolderList
|
from glances.folder_list import FolderList as glancesFolderList
|
||||||
from glances.plugins.glances_plugin import GlancesPlugin
|
from glances.plugins.glances_plugin import GlancesPlugin
|
||||||
from glances.logger import logger
|
|
||||||
|
|
||||||
|
|
||||||
class Plugin(GlancesPlugin):
|
class Plugin(GlancesPlugin):
|
||||||
@ -116,7 +114,7 @@ class Plugin(GlancesPlugin):
|
|||||||
ret.append(self.curse_add_line(msg))
|
ret.append(self.curse_add_line(msg))
|
||||||
try:
|
try:
|
||||||
msg = '{0:>6}'.format(self.auto_unit(i['size']))
|
msg = '{0:>6}'.format(self.auto_unit(i['size']))
|
||||||
except:
|
except TypeError:
|
||||||
msg = '{0:>6}'.format('?')
|
msg = '{0:>6}'.format('?')
|
||||||
ret.append(self.curse_add_line(msg, self.get_alert(i)))
|
ret.append(self.curse_add_line(msg, self.get_alert(i)))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user