From fe649aa78cd8a4fd1775f6cb9c74c7002779f24b Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Sat, 20 Jan 2024 10:45:46 -0500 Subject: [PATCH] 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 --- src/pybind/mgr/orchestrator/_interface.py | 4 ++-- src/pybind/mgr/orchestrator/module.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index 5bde317d19e..81aa66964ee 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 8c496b777c5..a7d86cbe2e5 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())) -- 2.39.5