From: John Mulligan Date: Sat, 20 Jan 2024 15:45:46 +0000 (-0500) Subject: pybind/mgr/orchestrator: fix yaml representer return type X-Git-Tag: v19.3.0~130^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fe649aa78cd8a4fd1775f6cb9c74c7002779f24b;p=ceph.git pybind/mgr/orchestrator: fix yaml representer return type Found using mypy 0.990. The `yaml_representer` function returns a Node type, not Any. Newer versions of mypy understand this and complain. Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index 5bde317d19e6..81aa66964eea 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -1277,7 +1277,7 @@ class DaemonDescription(object): return DaemonDescription.from_json(self.to_json()) @staticmethod - def yaml_representer(dumper: 'yaml.SafeDumper', data: 'DaemonDescription') -> Any: + def yaml_representer(dumper: 'yaml.Dumper', data: 'DaemonDescription') -> yaml.Node: return dumper.represent_dict(cast(Mapping, data.to_json().items())) @@ -1410,7 +1410,7 @@ class ServiceDescription(object): return cls(spec=spec, events=events, **c_status) @staticmethod - def yaml_representer(dumper: 'yaml.SafeDumper', data: 'ServiceDescription') -> Any: + def yaml_representer(dumper: 'yaml.Dumper', data: 'ServiceDescription') -> yaml.Node: return dumper.represent_dict(cast(Mapping, data.to_json().items())) diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 8c496b777c5e..a7d86cbe2e5e 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -129,7 +129,7 @@ class HostDetails: return _cls @staticmethod - def yaml_representer(dumper: 'yaml.SafeDumper', data: 'HostDetails') -> Any: + def yaml_representer(dumper: 'yaml.Dumper', data: 'HostDetails') -> yaml.Node: return dumper.represent_dict(cast(Mapping, data.to_json().items()))