__init__.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # Copyright 2008-2009 Canonical Ltd. All rights reserved.
  2. # This file is part of wadllib.
  3. #
  4. # wadllib is free software: you can redistribute it and/or modify it under the
  5. # terms of the GNU Lesser General Public License as published by the Free
  6. # Software Foundation, version 3 of the License.
  7. #
  8. # wadllib is distributed in the hope that it will be useful, but WITHOUT ANY
  9. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  11. # details.
  12. #
  13. # You should have received a copy of the GNU Lesser General Public
  14. # License along with wadllib. If not, see
  15. # <http://www.gnu.org/licenses/>.
  16. import sys
  17. try:
  18. import importlib.metadata as importlib_metadata
  19. except ImportError:
  20. import importlib_metadata
  21. __version__ = importlib_metadata.version("wadllib")
  22. if sys.version_info[0] >= 3:
  23. _string_types = str
  24. def _make_unicode(b):
  25. if hasattr(b, 'decode'):
  26. return b.decode()
  27. else:
  28. return str(b)
  29. else:
  30. _string_types = basestring
  31. _make_unicode = unicode