make lint in glances/plugins/vms/__init__.py

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
This commit is contained in:
Ariel Otilibili 2024-11-09 12:57:00 +01:00
parent 776a2356b2
commit 4ad93e629d

View File

@ -9,7 +9,7 @@
"""Vms plugin."""
from copy import deepcopy
from typing import Any, Dict, List, Optional, Tuple
from typing import Any, Optional
from glances.globals import iteritems
from glances.logger import logger
@ -106,7 +106,7 @@ class PluginModel(GlancesPluginModel):
# We want to display the stat in the curse interface
self.display_curse = True
self.watchers: Dict[str, VmsExtension] = {}
self.watchers: dict[str, VmsExtension] = {}
# Init the Multipass API
self.watchers['multipass'] = VmExtension()
@ -118,7 +118,7 @@ class PluginModel(GlancesPluginModel):
"""Return the key of the list."""
return 'name'
def get_export(self) -> List[Dict]:
def get_export(self) -> list[dict]:
"""Overwrite the default export method.
- Only exports vms
@ -151,7 +151,7 @@ class PluginModel(GlancesPluginModel):
@GlancesPluginModel._check_decorator
@GlancesPluginModel._log_result_decorator
def update(self) -> List[Dict]:
def update(self) -> list[dict]:
"""Update VMs stats using the input method."""
# Connection should be ok
if not self.watchers or self.input_method != 'local':
@ -187,7 +187,7 @@ class PluginModel(GlancesPluginModel):
return True
def msg_curse(self, args=None, max_width: Optional[int] = None) -> List[str]:
def msg_curse(self, args=None, max_width: Optional[int] = None) -> list[str]:
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
@ -293,7 +293,7 @@ class PluginModel(GlancesPluginModel):
return 'INFO'
def sort_vm_stats(stats: List[Dict[str, Any]]) -> Tuple[str, List[Dict[str, Any]]]:
def sort_vm_stats(stats: list[dict[str, Any]]) -> tuple[str, list[dict[str, Any]]]:
# Make VM sort related to process sort
if glances_processes.sort_key == 'memory_percent':
sort_by = 'memory_usage'