
|อW  ใ               @   s  d  Z  d d l m Z Gd d   d e  Z Gd d   d e  Z Gd d   d e  Z Gd	 d
   d
 e  Z Gd d   d e e  Z Gd d   d e  Z Gd d   d e  Z	 Gd d   d e  Z
 Gd d   d e  Z Gd d   d e
 e e	 e  Z d S)zMapping Interfaces
้    )ฺ	Interfacec               @   s"   e  Z d  Z d Z d d   Z d S)ฺIItemMappingz%Simplest readable mapping object
    c             C   s   d S)z^Get a value for a key

        A KeyError is raised if there is no value for the key.
        Nฉ )ฺkeyr   r   ๚?/usr/lib/python3/dist-packages/zope/interface/common/mapping.pyฺ__getitem__   s    zIItemMapping.__getitem__N)ฺ__name__ฺ
__module__ฺ__qualname__ฺ__doc__r   r   r   r   r   r      s   r   c               @   s1   e  Z d  Z d Z d d d  Z d d   Z d S)ฺIReadMappingzBasic mapping interface
    Nc             C   s   d S)zaGet a value for a key

        The default is returned if there is no value for the key.
        Nr   )r   ฺdefaultr   r   r   ฺget!   s    zIReadMapping.getc             C   s   d S)z$Tell if a key exists in the mapping.Nr   )r   r   r   r   ฺ__contains__'   s    zIReadMapping.__contains__)r   r	   r
   r   r   r   r   r   r   r   r      s   r   c               @   s.   e  Z d  Z d Z d d   Z d d   Z d S)ฺIWriteMappingz!Mapping methods for changing datac             C   s   d S)z.Delete a value from the mapping using the key.Nr   )r   r   r   r   ฺ__delitem__.   s    zIWriteMapping.__delitem__c             C   s   d S)zSet a new item in the mapping.Nr   )r   ฺvaluer   r   r   ฺ__setitem__1   s    zIWriteMapping.__setitem__N)r   r	   r
   r   r   r   r   r   r   r   r   +   s   r   c               @   sR   e  Z d  Z d Z d d   Z d d   Z d d   Z d d	   Z d
 d   Z d S)ฺIEnumerableMappingz3Mapping objects whose items can be enumerated.
    c               C   s   d S)z/Return the keys of the mapping object.
        Nr   r   r   r   r   ฺkeys9   s    zIEnumerableMapping.keysc               C   s   d S)z?Return an iterator for the keys of the mapping object.
        Nr   r   r   r   r   ฺ__iter__=   s    zIEnumerableMapping.__iter__c               C   s   d S)z1Return the values of the mapping object.
        Nr   r   r   r   r   ฺvaluesA   s    zIEnumerableMapping.valuesc               C   s   d S)z0Return the items of the mapping object.
        Nr   r   r   r   r   ฺitemsE   s    zIEnumerableMapping.itemsc               C   s   d S)z$Return the number of items.
        Nr   r   r   r   r   ฺ__len__I   s    zIEnumerableMapping.__len__N)	r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   5   s   r   c               @   s   e  Z d  Z d Z d S)ฺIMappingz Simple mapping interface N)r   r	   r
   r   r   r   r   r   r   M   s   r   c               @   s4   e  Z d  Z d d   Z d d   Z d d   Z d S)ฺIIterableMappingc               C   s   d S)z)iterate over keys; equivalent to __iter__Nr   r   r   r   r   ฺiterkeysR   s    zIIterableMapping.iterkeysc               C   s   d S)ziterate over valuesNr   r   r   r   r   ฺ
itervaluesU   s    zIIterableMapping.itervaluesc               C   s   d S)ziterate over itemsNr   r   r   r   r   ฺ	iteritemsX   s    zIIterableMapping.iteritemsN)r   r	   r
   r   r   r   r   r   r   r   r   P   s   r   c               @   s   e  Z d  Z d d   Z d S)ฺIClonableMappingc               C   s   d S)zreturn copy of dictNr   r   r   r   r   ฺcopy]   s    zIClonableMapping.copyN)r   r	   r
   r    r   r   r   r   r   [   s   r   c               @   s   e  Z d  Z d d   Z d S)ฺIExtendedReadMappingc             C   s   d S)z?Tell if a key exists in the mapping; equivalent to __contains__Nr   )r   r   r   r   ฺhas_keyb   s    zIExtendedReadMapping.has_keyN)r   r	   r
   r"   r   r   r   r   r!   `   s   r!   c               @   sO   e  Z d  Z d d   Z d d   Z d d d  Z d d	   Z d
 d   Z d S)ฺIExtendedWriteMappingc               C   s   d S)zdelete all itemsNr   r   r   r   r   ฺclearg   s    zIExtendedWriteMapping.clearc             C   s   d S)z0 Update D from E: for k in E.keys(): D[k] = E[k]Nr   )ฺdr   r   r   ฺupdatej   s    zIExtendedWriteMapping.updateNc             C   s   d S)z@D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in DNr   )r   r   r   r   r   ฺ
setdefaultm   s    z IExtendedWriteMapping.setdefaultc             G   s   d S)zโremove specified key and return the corresponding value
        *args may contain a single default value, or may not be supplied.
        If key is not found, default is returned if given, otherwise 
        KeyError is raisedNr   )ฺkฺargsr   r   r   ฺpopp   s    zIExtendedWriteMapping.popc               C   s   d S)zeremove and return some (key, value) pair as a
        2-tuple; but raise KeyError if mapping is emptyNr   r   r   r   r   ฺpopitemv   s    zIExtendedWriteMapping.popitem)r   r	   r
   r$   r&   r'   r*   r+   r   r   r   r   r#   e   s
   r#   c               @   s   e  Z d  Z d Z d S)ฺIFullMappingz Full mapping interface N)r   r	   r
   r   r   r   r   r   r,   z   s   r,   N)r   Zzope.interfacer   r   r   r   r   r   r   r   r!   r#   r,   r   r   r   r   ฺ<module>   s   
