spack/lib/spack/external/pyrsistent/_compat.py
Todd Gamblin 90592b3cbe externals: add pyrsistent for new jsonschema
Updating `jsonschema` to 3.2.0 requires `pyrsistent`. Adding just the pieces of it
that are needed for `jsonschema`.
2021-12-19 12:55:42 -08:00

32 lines
521 B
Python

from six import string_types
# enum compat
try:
from enum import Enum
except:
class Enum(object): pass
# no objects will be instances of this class
# collections compat
try:
from collections.abc import (
Container,
Hashable,
Iterable,
Mapping,
Sequence,
Set,
Sized,
)
except ImportError:
from collections import (
Container,
Hashable,
Iterable,
Mapping,
Sequence,
Set,
Sized,
)