Core: Fix up python 3.10 support

Fixes #589
This commit is contained in:
Mike Auty
2021-11-17 13:41:09 +00:00
parent 23453f5d8c
commit 3cb2bf9fac
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -3,6 +3,7 @@
#
import collections
import collections.abc
import logging
import struct
from typing import Any, ClassVar, Dict, List, Iterable, Optional, Tuple, Type, Union as TUnion, overload
@@ -633,7 +634,7 @@ class Array(interfaces.objects.ObjectInterface, collections.abc.Sequence):
return self.vol.count
def write(self, value) -> None:
if not isinstance(value, collections.Sequence):
if not isinstance(value, collections.abc.Sequence):
raise TypeError("Only Sequences can be written to arrays")
self.count = len(value)
for index in range(len(value)):
+2 -1
View File
@@ -7,6 +7,7 @@ Renderers display the unified output format in some manner (be it text
or file or graphical output
"""
import collections
import collections.abc
import datetime
import logging
from typing import Any, Callable, Iterable, List, Optional, Tuple, TypeVar, Union
@@ -70,7 +71,7 @@ class TreeNode(interfaces.renderers.TreeNode):
def _validate_values(self, values: List[interfaces.renderers.BaseTypes]) -> None:
"""A function for raising exceptions if a given set of values is
invalid according to the column properties."""
if not (isinstance(values, collections.Sequence) and len(values) == len(self._treegrid.columns)):
if not (isinstance(values, collections.abc.Sequence) and len(values) == len(self._treegrid.columns)):
raise TypeError(
"Values must be a list of objects made up of simple types and number the same as the columns")
for index in range(len(self._treegrid.columns)):