当前位置: 首页>>代码示例>>Python>>正文


Python Image.fromJson方法代码示例

本文整理汇总了Python中Image.Image.fromJson方法的典型用法代码示例。如果您正苦于以下问题:Python Image.fromJson方法的具体用法?Python Image.fromJson怎么用?Python Image.fromJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Image.Image的用法示例。


在下文中一共展示了Image.fromJson方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getImage

# 需要导入模块: from Image import Image [as 别名]
# 或者: from Image.Image import fromJson [as 别名]
    def getImage(self, name):
        """ returns an Image for the given name, or None if not found """
        retVal = None

        img_data = self.client.inspect_image(name)

        if img_data:
            retVal = Image.fromJson(img_data)
            retVal.tags = [ name if isinstance(name, ImageTag) else ImageTag.parse(name) ]

        return retVal
开发者ID:autosportlabs,项目名称:docker-sync,代码行数:13,代码来源:DockerSyncWrapper.py

示例2: test_fromJson

# 需要导入模块: from Image import Image [as 别名]
# 或者: from Image.Image import fromJson [as 别名]
    def test_fromJson(self):
        img = Image.fromJson({
            "id": "2e2d7133e4a578bd861e85e7195412201f765d050af78c7906841ea62eb6f7dd",
            "parent": "c79dab5561020bda9ce1b1cbe76283fc95f824cfb26a8a21a384993ed7f392bd",
            "created": "2014-10-21T08:50:44.448455269Z",
            "container": "b756100785c797b9f43d36f249b0d5688d88a1ca68df56d915cb436c4bfc7286",
            "config": {
                "Hostname": "965c252e48c3",
                "User": "",
                "Memory": 0,
                "MemorySwap": 0,
                "AttachStdin": False,
                "AttachStdout": False,
                "AttachStderr": False,
                "PortSpecs": None,
                "Tty": False,
                "OpenStdin": False,
                "StdinOnce": False,
                "Env": [
                    "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                    "DOCKER_REGISTRY_CONFIG=/docker-registry/config/config_sample.yml",
                    "SETTINGS_FLAVOR=dev",
                    "HOME=/"
                ],
                "Entrypoint": None,
                "Cmd": [ "/bin/sh", "-c", "exec", "docker-registry" ],

                "Image": "c79dab5561020bda9ce1b1cbe76283fc95f824cfb26a8a21a384993ed7f392bd",
                "Volumes": None,

                "WorkingDir": "",
            },
        })

        eq_(img.id, "2e2d7133e4a578bd861e85e7195412201f765d050af78c7906841ea62eb6f7dd")
        eq_(img.entrypoint, None)
        eq_(img.command, [ "/bin/sh", "-c", "exec", "docker-registry" ])
        eq_(img.env, {
            "DOCKER_REGISTRY_CONFIG": "/docker-registry/config/config_sample.yml",
            "SETTINGS_FLAVOR": "dev",
        })
开发者ID:ryandoherty,项目名称:docker-sync,代码行数:43,代码来源:TestImage.py


注:本文中的Image.Image.fromJson方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。