diff options
author | Chris Patterson <cpatterson@microsoft.com> | 2022-02-11 23:40:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-11 22:40:45 -0600 |
commit | 0b41b359a70bbbf3a648862a9b849d60b9ff6c3b (patch) | |
tree | c53959a1e5346db352e5b5a14a47180092c3e3c4 /cloudinit/distros/__init__.py | |
parent | a62d04e081831be82b3d26c94fee5aa40d7c0802 (diff) | |
download | vyos-cloud-init-0b41b359a70bbbf3a648862a9b849d60b9ff6c3b.tar.gz vyos-cloud-init-0b41b359a70bbbf3a648862a9b849d60b9ff6c3b.zip |
sources/azure: address mypy/pyright typing complaints (#1245)
Raise runtime errors for unhandled cases which would cause other
exceptions. Ignore types for a few cases where a non-trivial
refactor would be required to prevent the warning.
Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
Diffstat (limited to 'cloudinit/distros/__init__.py')
-rwxr-xr-x | cloudinit/distros/__init__.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index a261c16e..76acd6a3 100755 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -16,7 +16,7 @@ import stat import string import urllib.parse from io import StringIO -from typing import Any, Mapping # noqa: F401 +from typing import Any, Mapping, Type from cloudinit import importer from cloudinit import log as logging @@ -26,7 +26,7 @@ from cloudinit.features import ALLOW_EC2_MIRRORS_ON_NON_AWS_INSTANCE_TYPES from cloudinit.net import activators, eni, network_state, renderers from cloudinit.net.network_state import parse_net_config_data -from .networking import LinuxNetworking +from .networking import LinuxNetworking, Networking # Used when a cloud-config module can be run on all cloud-init distibutions. # The value 'all' is surfaced in module documentation for distro support. @@ -76,9 +76,9 @@ class Distro(persistence.CloudInitPickleMixin, metaclass=abc.ABCMeta): hostname_conf_fn = "/etc/hostname" tz_zone_dir = "/usr/share/zoneinfo" init_cmd = ["service"] # systemctl, service etc - renderer_configs = {} # type: Mapping[str, Mapping[str, Any]] + renderer_configs: Mapping[str, Mapping[str, Any]] = {} _preferred_ntp_clients = None - networking_cls = LinuxNetworking + networking_cls: Type[Networking] = LinuxNetworking # This is used by self.shutdown_command(), and can be overridden in # subclasses shutdown_options_map = {"halt": "-H", "poweroff": "-P", "reboot": "-r"} @@ -91,7 +91,7 @@ class Distro(persistence.CloudInitPickleMixin, metaclass=abc.ABCMeta): self._paths = paths self._cfg = cfg self.name = name - self.networking = self.networking_cls() + self.networking: Networking = self.networking_cls() def _unpickle(self, ci_pkl_version: int) -> None: """Perform deserialization fixes for Distro.""" |