osbuild: fix optional-types

Optional types were provided in places but were not always correct. Add
mypy checking and fix those that fail(ed).
This commit is contained in:
Simon de Vlieger 2022-07-06 10:54:37 +02:00 committed by Christian Kellner
parent 6e66c69608
commit 3fd864e5a9
29 changed files with 209 additions and 111 deletions

View file

@ -17,7 +17,7 @@ import hashlib
import json
import os
from typing import Dict, Optional
from typing import Dict, Optional, Any
from osbuild import host
@ -52,11 +52,11 @@ class DeviceManager:
Uses a `host.ServiceManager` to open `Device` instances.
"""
def __init__(self, mgr: host.ServiceManager, devpath: str, tree: str) -> Dict:
def __init__(self, mgr: host.ServiceManager, devpath: str, tree: str) -> None:
self.service_manager = mgr
self.devpath = devpath
self.tree = tree
self.devices = {}
self.devices: Dict[str, Dict[str, Any]] = {}
def device_relpath(self, dev: Optional[Device]) -> Optional[str]:
if dev is None: