From 5e0c89e11004bc0798b0cad2bbcea0f98065afb6 Mon Sep 17 00:00:00 2001 From: Kevin PEREZ Date: Wed, 2 Nov 2022 13:05:18 +0100 Subject: [PATCH] Fix import errors on Python version >= 3.10 --- vector/base.py | 6 +++++- vector/svg.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/vector/base.py b/vector/base.py index 7fa559c..c22a295 100644 --- a/vector/base.py +++ b/vector/base.py @@ -1,6 +1,10 @@ import operator from contextlib import contextmanager -from collections import Iterable +try: + # since python 3.10 + from collections.abc import Iterable +except ImportError: + from collections import Iterable class View: def draw(self, object, offset=None, **kw): diff --git a/vector/svg.py b/vector/svg.py index be5930d..25cb673 100644 --- a/vector/svg.py +++ b/vector/svg.py @@ -2,7 +2,11 @@ from contextlib import contextmanager from . import base from math import sin, cos, radians -from collections import Iterable +try: + # since python 3.10 + from collections.abc import Iterable +except ImportError: + from collections import Iterable from urllib.parse import urlunparse, ParseResult import operator from textwrap import TextWrapper