
     #e                    X    d dl mZ d dlmZmZ d dlmZ d dlmZ e G d de             Z	y)    )annotations)	UFOReader	UFOWriter)	DataStore)serdec                  l     e Zd ZdZedd       Zedd       Zed	d       Zed
d       Zd fdZ	 xZ
S )ImageSeta  Represents a mapping of POSIX filename strings to arbitrary image data.

    Note:
        Images cannot be put into subdirectories of the images folder.

    Behavior:
        ImageSet behaves like a dictionary of type ``Dict[str, bytes]``.

        >>> from ufoLib2 import Font
        >>> font = Font()
        >>> # Note: invalid PNG data for demonstration. Use the actual PNG bytes.
        >>> font.images["test.png"] = b"123"
        >>> font.images["test2.png"] = b"456"
        >>> font.images["test.png"]
        b'123'
        >>> del font.images["test.png"]
        >>> list(font.images.items())
        [('test2.png', b'456')]
    c                "    | j                         S )zAReturns a list of POSIX filename strings in the image data store.)getImageDirectoryListing)readers    :/usr/lib/python3/dist-packages/ufoLib2/objects/imageSet.pylist_contentszImageSet.list_contents   s     ..00    c                $    | j                  |      S )z4Returns the image data at filename within the store.)	readImage)r   filenames     r   	read_datazImageSet.read_data$   s     ))r   c                (    | j                  ||       y)z3Writes the image data to filename within the store.N)
writeImage)writerr   datas      r   
write_datazImageSet.write_data)   s     	(D)r   c                &    | j                  |       y)z3Remove the image data at filename within the store.N)removeImage)r   r   s     r   remove_datazImageSet.remove_data.   s     	8$r   c                D    d|v rt        d      t        | 	  ||       y )N/z>Images cannot be put into subdirectories of the images folder.)
ValueErrorsuper__setitem__)selffileNamer   	__class__s      r   r    zImageSet.__setitem__3   s+    (?P  	Hd+r   )r   r   returnz	list[str])r   r   r   strr$   bytes)r   r   r   r%   r   r&   r$   None)r   r   r   r%   r$   r'   )r"   r%   r   r&   r$   r'   )__name__
__module____qualname____doc__staticmethodr   r   r   r   r    __classcell__)r#   s   @r   r	   r	   	   sb    ( 1 1 * * * * % %, ,r   r	   N)

__future__r   fontTools.ufoLibr   r   ufoLib2.objects.miscr   ufoLib2.serder   r	    r   r   <module>r3      s,    " 1 *  .,y ., .,r   