|
25 | 25 | from six import string_types, text_type, PY2, PY3 |
26 | 26 |
|
27 | 27 | import _sass |
| 28 | +from sassutils._compat import collections_abc |
28 | 29 |
|
29 | 30 | __all__ = ( |
30 | 31 | 'MODES', 'OUTPUT_STYLES', 'SOURCE_COMMENTS', 'CompileError', 'SassColor', |
@@ -144,7 +145,7 @@ def from_named_function(cls, function): |
144 | 145 | def __init__(self, name, arguments, callable_): |
145 | 146 | if not isinstance(name, string_types): |
146 | 147 | raise TypeError('name must be a string, not ' + repr(name)) |
147 | | - elif not isinstance(arguments, collections.Sequence): |
| 148 | + elif not isinstance(arguments, collections_abc.Sequence): |
148 | 149 | raise TypeError('arguments must be a sequence, not ' + |
149 | 150 | repr(arguments)) |
150 | 151 | elif not callable(callable_): |
@@ -582,12 +583,15 @@ def _get_file_arg(key): |
582 | 583 | include_paths = include_paths.encode(fs_encoding) |
583 | 584 |
|
584 | 585 | custom_functions = kwargs.pop('custom_functions', ()) |
585 | | - if isinstance(custom_functions, collections.Mapping): |
| 586 | + if isinstance(custom_functions, collections_abc.Mapping): |
586 | 587 | custom_functions = [ |
587 | 588 | SassFunction.from_lambda(name, lambda_) |
588 | 589 | for name, lambda_ in custom_functions.items() |
589 | 590 | ] |
590 | | - elif isinstance(custom_functions, (collections.Set, collections.Sequence)): |
| 591 | + elif isinstance( |
| 592 | + custom_functions, |
| 593 | + (collections_abc.Set, collections_abc.Sequence), |
| 594 | + ): |
591 | 595 | custom_functions = [ |
592 | 596 | func if isinstance(func, SassFunction) |
593 | 597 | else SassFunction.from_named_function(func) |
@@ -758,7 +762,7 @@ def __new__(cls, msg): |
758 | 762 | return super(SassWarning, cls).__new__(cls, msg) |
759 | 763 |
|
760 | 764 |
|
761 | | -class SassMap(collections.Mapping): |
| 765 | +class SassMap(collections_abc.Mapping): |
762 | 766 | """Because sass maps can have mapping types as keys, we need an immutable |
763 | 767 | hashable mapping type. |
764 | 768 |
|
|
0 commit comments