

def attach_image(self, filename=DEFAULT_IMAGE_FILENAME, image_link=None):
    'Attach an image to the JSON respresentation.'
    if (image_link is None):
        for (image_link, image_filename) in self.asset['images'].iteritems():
            if (image_filename == filename):
                return image_link
        index = len(filename.asset['images'])
        image_link = ('file%03i' % index)
    self.asset['images'][image_link] = filename
    return image_link

dataset/ETHPy150Open turbulenz/turbulenz_tools/turbulenz_tools/tools/asset2json.py JsonAsset.attach_image/VarMisuse@67/105 `self`->`filename`