From 6d9142579a4ad0fef058b34027d33a86e4e1f58a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 3 Dec 2021 13:26:29 +0100 Subject: [PATCH] Add debuging repr to print more nicely Otherwise you just see when you try to print this. Contributes to issue CURA-8671. --- .../src/Models/Http/CloudClusterResponse.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py b/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py index 1af3d83964..1676fe1c2e 100644 --- a/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py +++ b/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py @@ -45,3 +45,10 @@ class CloudClusterResponse(BaseModel): super().validate() if not self.cluster_id: raise ValueError("cluster_id is required on CloudCluster") + + def __repr__(self) -> str: + """ + Convenience function for printing when debugging. + :return: A human-readable representation of the data in this object. + """ + return str({k: v for k, v in self.__dict__.items() if k in {"cluster_id", "host_guid", "host_name", "status", "is_online", "host_version", "host_internal_ip", "friendly_name", "printer_type", "printer_count", "capabilities"}})