Skip to content

Commit 7519dbd

Browse files
authored
Merge pull request #27 from athena-luka/master
fix collections.Sequence deprecation without removing Python 2 support
2 parents 3a441f3 + 7180316 commit 7519dbd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tgt/core.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@
1919
from __future__ import division
2020

2121
import bisect
22-
import collections
2322
import warnings
2423
import copy
2524
import math
2625
import operator
2726
import re
27+
try:
28+
from collections.abc import Sequence
29+
except ImportError:
30+
from collections import Sequence
2831

2932

3033
__all__ = [
@@ -57,7 +60,7 @@ def add_tier(self, tier):
5760

5861
def add_tiers(self, tiers):
5962
'''Add a sequence of tiers.'''
60-
if isinstance(tiers, collections.Sequence):
63+
if isinstance(tiers, Sequence):
6164
for tier in tiers:
6265
self.add_tier(tier)
6366
else:

0 commit comments

Comments
 (0)