# Path: slicer_cli_web/models/parser.py
# def parse_xml_desc(item, desc, user):
#     return _parse_xml_desc(item, user, desc['xml'])
# 
# def parse_yaml_desc(item, desc, user):
#     data = yaml.safe_load(desc['yaml'])
# 
#     return _parse_json_desc(item, user, data)
# 
# def parse_json_desc(item, desc, user):
#     data = json.loads(desc['json'])
# 
#     return _parse_json_desc(item, user, data)


from girder.constants import AccessType
from girder.models.folder import Folder
from girder.models.item import Item
from girder.models.file import File
from .parser import parse_xml_desc, parse_yaml_desc, parse_json_desc
            digest = docker_image.attrs['RepoDigests'][0]

        labels['digest'] = digest
        folderModel.setMetadata(tag, labels)

        folderModel.setMetadata(tag, dict(slicerCLIType='tag'))

        return DockerImageItem(image, tag, user)

    @staticmethod
    def _syncItems(image, cli_dict, user):
        folderModel = Folder()
        itemModel = Item()

        children = folderModel.childItems(image.tagFolder, filters={'meta.slicerCLIType': 'task'})
        existingItems = {item['name']: item for item in children}

        for cli, desc in cli_dict.items():
            item = itemModel.createItem(cli, user, image.tagFolder,
                                        'Slicer CLI generated CLI command item',
                                        reuseExisting=True)
            meta_data = dict(slicerCLIType='task', type=desc.get('type', 'Unknown'))

            # copy some things from the image to be independent
            meta_data['image'] = image.name
            meta_data['digest'] = image.digest if image.name != image.digest else None

            desc_type = desc.get('desc-type', 'xml')

            if desc_type == 'xml':

# Path: slicer_cli_web/models/parser.py
# def parse_xml_desc(item, desc, user):
#     return _parse_xml_desc(item, user, desc['xml'])
# 
# def parse_yaml_desc(item, desc, user):
#     data = yaml.safe_load(desc['yaml'])
# 
#     return _parse_json_desc(item, user, data)
# 
# def parse_json_desc(item, desc, user):
#     data = json.loads(desc['json'])
# 
#     return _parse_json_desc(item, user, data)


# Path: slicer_cli_web/models/docker_image.py
from girder.constants import AccessType
from girder.models.folder import Folder
from girder.models.item import Item
from girder.models.file import File
from .parser import parse_xml_desc, parse_yaml_desc, parse_json_desc

            digest = docker_image.attrs['RepoDigests'][0]

        labels['digest'] = digest
        folderModel.setMetadata(tag, labels)

        folderModel.setMetadata(tag, dict(slicerCLIType='tag'))

        return DockerImageItem(image, tag, user)

    @staticmethod
    def _syncItems(image, cli_dict, user):
        folderModel = Folder()
        itemModel = Item()

        children = folderModel.childItems(image.tagFolder, filters={'meta.slicerCLIType': 'task'})
        existingItems = {item['name']: item for item in children}

        for cli, desc in cli_dict.items():
            item = itemModel.createItem(cli, user, image.tagFolder,
                                        'Slicer CLI generated CLI command item',
                                        reuseExisting=True)
            meta_data = dict(slicerCLIType='task', type=desc.get('type', 'Unknown'))

            # copy some things from the image to be independent
            meta_data['image'] = image.name
            meta_data['digest'] = image.digest if image.name != image.digest else None

            desc_type = desc.get('desc-type', 'xml')

            if desc_type == 'xml':

                meta_data.update(parse_xml_desc(item, desc, user))