From a0673683cf42120852bb8213da6fe5757faf5012 Mon Sep 17 00:00:00 2001 From: Adam Collard Date: Tue, 16 Aug 2022 11:07:11 +0100 Subject: [PATCH] More Python 3.10 fixes (#282) Fixes #280 --- maas/client/flesh/tabular.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/maas/client/flesh/tabular.py b/maas/client/flesh/tabular.py index 91f202cc..a59c097d 100644 --- a/maas/client/flesh/tabular.py +++ b/maas/client/flesh/tabular.py @@ -4,6 +4,7 @@ from abc import ABCMeta, abstractmethod import collections +from collections.abc import Iterable import csv import enum from io import StringIO @@ -297,9 +298,7 @@ def render(self, target, datum): elif target is RenderTarget.json: return datum elif target is RenderTarget.csv: - if isinstance(datum, collections.Iterable) and not isinstance( - datum, (str, bytes) - ): + if isinstance(datum, Iterable) and not isinstance(datum, (str, bytes)): return ",".join(datum) else: return datum @@ -308,9 +307,7 @@ def render(self, target, datum): return "" elif isinstance(datum, colorclass.Color): return datum.value_no_colors - elif isinstance(datum, collections.Iterable) and not isinstance( - datum, (str, bytes) - ): + elif isinstance(datum, Iterable) and not isinstance(datum, (str, bytes)): return "\n".join(datum) else: return str(datum) @@ -319,9 +316,7 @@ def render(self, target, datum): return "" elif isinstance(datum, colorclass.Color): return datum - elif isinstance(datum, collections.Iterable) and not isinstance( - datum, (str, bytes) - ): + elif isinstance(datum, Iterable) and not isinstance(datum, (str, bytes)): return "\n".join(datum) else: return str(datum)