From 71803160ee0cc465b842c0f6591cb0e8a4bc188f Mon Sep 17 00:00:00 2001 From: Timon <42844075+athena-luka@users.noreply.github.com> Date: Sun, 11 Jun 2023 20:39:43 +0200 Subject: [PATCH] fix collections.Sequence deprecation without removing Python 2 support --- tgt/core.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tgt/core.py b/tgt/core.py index fb58955..5282e42 100644 --- a/tgt/core.py +++ b/tgt/core.py @@ -19,12 +19,15 @@ from __future__ import division import bisect -import collections import warnings import copy import math import operator import re +try: + from collections.abc import Sequence +except ImportError: + from collections import Sequence __all__ = [ @@ -57,7 +60,7 @@ def add_tier(self, tier): def add_tiers(self, tiers): '''Add a sequence of tiers.''' - if isinstance(tiers, collections.Sequence): + if isinstance(tiers, Sequence): for tier in tiers: self.add_tier(tier) else: