1
0
mirror of https://github.com/HorlogeSkynet/archey4 synced 2025-07-17 04:00:11 +02:00

[BC] Removes variable annotations for compatibility against Python 3.5

We have to wait until Python 3.6 (PEP 526) to use them.
This commit is contained in:
Samuel FORESTIER
2020-11-28 19:35:59 +01:00
parent 98473772bb
commit 1853c5198d
5 changed files with 7 additions and 7 deletions

@@ -26,14 +26,14 @@ class API:
Note: For Python < 3.6, the keys order is not guaranteed.
"""
document: Dict[str, Dict[str, object]] = {
document = {
'data': {},
'meta': {
'version': self._version_to_semver_segments(__version__),
'date': datetime.now().isoformat(),
'count': len(self.entries)
}
}
} # type: Dict[str, dict]
for entry in self.entries:
document['data'][entry.name] = entry.value

@@ -60,7 +60,7 @@ class CPU(Entry):
model_names = cls._MODEL_NAME_REGEXP.findall(cpu_info)
physical_ids = cls._PHYSICAL_ID_REGEXP.findall(cpu_info)
cpus_list: List[Dict[str, int]] = []
cpus_list = [] # type: List[Dict[str, int]]
# Manually de-duplicates CPUs count.
for model_name, physical_id in zip(model_names, physical_ids):

@@ -18,7 +18,7 @@ class Disk(Entry):
# Populate an output from `df`
self._disk_dict = self._get_df_output_dict()
config_filesystems: List[str] = self.options.get('show_filesystems', ['local'])
config_filesystems = self.options.get('show_filesystems', ['local']) # type: List[str]
# See `Disk._get_df_output_dict` for the format we use in `self.value`.
if config_filesystems == ['local']:
self.value = self._get_local_filesystems()
@@ -43,7 +43,7 @@ class Disk(Entry):
device_path_regexp = re.compile(r'^\/dev\/(?:(?!loop|[rs]?vnd|lofi|dm).)+$')
# Build the dictionary
local_disk_dict: Dict[str, dict] = {}
local_disk_dict = {} # type: Dict[str, dict]
for mount_point, disk_data in self._disk_dict.items():
if (
device_path_regexp.match(disk_data['device_path'])

@@ -27,7 +27,7 @@ class Output:
"""
def __init__(self, **kwargs):
# Fetches passed arguments.
self._format_to_json = kwargs.get('format_to_json')
self._format_to_json = kwargs.get('format_to_json') # type: int
try:
# If set, force the distribution to `preferred_distribution` argument.

@@ -13,7 +13,7 @@ class Singleton(AbstractBaseMetaClass):
... whereas it is effectively loaded only once.
You cannot instantiate this meta-class directly.
"""
_instances: Dict[Type['Singleton'], object] = {}
_instances = {} # type: Dict[Type['Singleton'], object]
def __call__(cls, *args, **kwargs):
if cls not in cls._instances: