ó
è?F[c           @   s   d  e  f d „  ƒ  YZ d S(   t   Schemac           B   s†   e  Z d  Z d „  Z d „  Z e d
 d „ ƒ Z e d „  ƒ Z	 e d „  ƒ Z
 e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z d	 „  Z RS(   s"  
    Represents a DynamoDB schema.

    :ivar hash_key_name: The name of the hash key of the schema.
    :ivar hash_key_type: The DynamoDB type specification for the
        hash key of the schema.
    :ivar range_key_name: The name of the range key of the schema
        or None if no range key is defined.
    :ivar range_key_type: The DynamoDB type specification for the
        range key of the schema or None if no range key is defined.
    :ivar dict: The underlying Python dictionary that needs to be
        passed to Layer1 methods.
    c         C   s   | |  _  d  S(   N(   t   _dict(   t   selft   schema_dict(    (    s3   lib/python2.7/site-packages/boto/dynamodb/schema.pyt   __init__(   s    c         C   s3   |  j  r" d |  j |  j  f } n d |  j } | S(   Ns   Schema(%s:%s)s
   Schema(%s)(   t   range_key_namet   hash_key_name(   R   t   s(    (    s3   lib/python2.7/site-packages/boto/dynamodb/schema.pyt   __repr__+   s    	c         C   sk   i i | d d 6| d d 6d 6} | d k	 rR i | d d 6| d d 6| d <n  |  d ƒ } | | _ | S(   sÉ  Convenience method to create a schema object.

        Example usage::

            schema = Schema.create(hash_key=('foo', 'N'))
            schema2 = Schema.create(hash_key=('foo', 'N'),
                                    range_key=('bar', 'S'))

        :type hash_key: tuple
        :param hash_key: A tuple of (hash_key_name, hash_key_type)

        :type range_key: tuple
        :param hash_key: A tuple of (range_key_name, range_key_type)

        i    t   AttributeNamei   t   AttributeTypet   HashKeyElementt   RangeKeyElementN(   t   NoneR   (   t   clst   hash_keyt	   range_keyt   reconstructedt   instance(    (    s3   lib/python2.7/site-packages/boto/dynamodb/schema.pyt   create2   s    	c         C   s   |  j  S(   N(   R   (   R   (    (    s3   lib/python2.7/site-packages/boto/dynamodb/schema.pyt   dictR   s    c         C   s   |  j  d d S(   NR   R	   (   R   (   R   (    (    s3   lib/python2.7/site-packages/boto/dynamodb/schema.pyR   V   s    c         C   s   |  j  d d S(   NR   R
   (   R   (   R   (    (    s3   lib/python2.7/site-packages/boto/dynamodb/schema.pyt   hash_key_typeZ   s    c         C   s-   d  } d |  j k r) |  j d d } n  | S(   NR   R	   (   R   R   (   R   t   name(    (    s3   lib/python2.7/site-packages/boto/dynamodb/schema.pyR   ^   s    c         C   s-   d  } d |  j k r) |  j d d } n  | S(   NR   R
   (   R   R   (   R   t   type(    (    s3   lib/python2.7/site-packages/boto/dynamodb/schema.pyt   range_key_typee   s    c         C   sF   |  j  | j  k oE |  j | j k oE |  j | j k oE |  j | j k S(   N(   R   R   R   R   (   R   t   other(    (    s3   lib/python2.7/site-packages/boto/dynamodb/schema.pyt   __eq__l   s    N(   t   __name__t
   __module__t   __doc__R   R   t   classmethodR   R   t   propertyR   R   R   R   R   R   (    (    (    s3   lib/python2.7/site-packages/boto/dynamodb/schema.pyR       s   		N(   t   objectR    (    (    (    s3   lib/python2.7/site-packages/boto/dynamodb/schema.pyt   <module>   s    