compat.py 300 B

1234567891011121314
  1. import sys
  2. PY2 = sys.version_info[0] == 2
  3. PY3 = sys.version_info[0] == 3
  4. if PY3:
  5. string_types = str, bytes
  6. else:
  7. string_types = basestring, # noqa: F821
  8. def with_metaclass(meta, *bases):
  9. """Create a base class with a metaclass."""
  10. return meta("NewBase", bases, {})