# Path: model_card_toolkit/utils/validation.py
# _SCHEMA_FILE_NAME = 'model_card.schema.json'
# _SCHEMA_VERSIONS = frozenset(('0.0.1', '0.0.2',))
# _LATEST_SCHEMA_VERSION = max(_SCHEMA_VERSIONS, key=semantic_version.Version)
# SCHEMA_VERSION_STRING = 'schema_version'
# def validate_json_schema(
#     json_dict: Dict[str, Any],
#     schema_version: Optional[str] = None) -> Dict[str, Any]:
# def _find_json_schema(schema_version: Optional[str] = None) -> Dict[str, Any]:
# def get_latest_schema_version() -> str:


import logging
import jsonschema
from typing import Any, Dict, Optional, Text
from model_card_toolkit.utils import validation
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Util functions for Model Card JSON schema."""



def update(json_dict: Optional[Dict[Text, Any]] = None) -> Dict[Text, Any]:
  """Updates a Model Card JSON dictionary to the latest schema version.

  If you have a JSON string, you can use it with this function as follows:

  ```python
  json_dict = json.loads(json_text)
  updated_json_dict = json_util.update(json_dict)
  ```

  Args:
    json_dict: A dictionary representing a Model Card JSON object.

  Returns:
    The input Model Card, converted to a JSON string of the latest schema
      version. If the input Model Card already corresponds to schema v0.0.2, it
      is returned unmodified.

  Raises:
    ValidationError: If `json_dict` does not follow the model card JSON v0.0.1
      schema.
  """
  try:

# Path: model_card_toolkit/utils/validation.py
# _SCHEMA_FILE_NAME = 'model_card.schema.json'
# _SCHEMA_VERSIONS = frozenset(('0.0.1', '0.0.2',))
# _LATEST_SCHEMA_VERSION = max(_SCHEMA_VERSIONS, key=semantic_version.Version)
# SCHEMA_VERSION_STRING = 'schema_version'
# def validate_json_schema(
#     json_dict: Dict[str, Any],
#     schema_version: Optional[str] = None) -> Dict[str, Any]:
# def _find_json_schema(schema_version: Optional[str] = None) -> Dict[str, Any]:
# def get_latest_schema_version() -> str:


# Path: model_card_toolkit/utils/json_util.py
import logging
import jsonschema
from typing import Any, Dict, Optional, Text
from model_card_toolkit.utils import validation

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Util functions for Model Card JSON schema."""



def update(json_dict: Optional[Dict[Text, Any]] = None) -> Dict[Text, Any]:
  """Updates a Model Card JSON dictionary to the latest schema version.

  If you have a JSON string, you can use it with this function as follows:

  ```python
  json_dict = json.loads(json_text)
  updated_json_dict = json_util.update(json_dict)
  ```

  Args:
    json_dict: A dictionary representing a Model Card JSON object.

  Returns:
    The input Model Card, converted to a JSON string of the latest schema
      version. If the input Model Card already corresponds to schema v0.0.2, it
      is returned unmodified.

  Raises:
    ValidationError: If `json_dict` does not follow the model card JSON v0.0.1
      schema.
  """
  try:

    validation.validate_json_schema(json_dict, "0.0.2")