__init__.py 695 B

12345678910111213141516171819202122232425262728293031
  1. from typing import (
  2. Dict,
  3. List,
  4. Union
  5. )
  6. JSONObject = Union[
  7. None, bool, int, float, str,
  8. List["JSONObject"],
  9. Dict[str, "JSONObject"]
  10. ]
  11. version = 2
  12. version_minor = 0
  13. version_string = f"{version}.{version_minor}"
  14. def check_serialized_version(json_object: JSONObject):
  15. stored_class = json_object["@"]["type"]
  16. stored_version = json_object["@"]["version"]
  17. if stored_version != version_string:
  18. raise ValueError(
  19. f"Unsupported metadata version ({stored_version}) in "
  20. f"stored {stored_class} object, expected version: "
  21. f"{version_string}")
  22. from . import _version
  23. __version__ = _version.get_versions()['version']