σ
ίΘ[c           @` sq   d  d l  m Z m Z m Z m Z d  d l m Z d  d l Z d d l	 m
 Z
 d g Z d e f d     YZ d S(	   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literals(   t   OrderedDictNi   (   t
   isiterableu   FlagCollectiont   FlagCollectionc           B` s    e  Z d  Z d   Z d   Z RS(   uβ  
    The purpose of this class is to provide a dictionary for
    containing arrays of flags for the `NDData` class. Flags should be
    stored in Numpy arrays that have the same dimensions as the parent
    data, so the `FlagCollection` class adds shape checking to an
    ordered dictionary class.

    The `FlagCollection` should be initialized like an
    `~collections.OrderedDict`, but with the addition of a ``shape=``
    keyword argument used to pass the NDData shape.
    c         O` sb   d | k r? | j  d  |  _ t |  j  sK t d   qK n t d   t j |  | |  d  S(   Nu   shapeu1   FlagCollection shape should be an iterable objectu?   FlagCollection should be initialized with the shape of the data(   t   popt   shapeR   t
   ValueErrort	   ExceptionR   t   __init__(   t   selft   argst   kwargs(    (    s=   lib/python2.7/site-packages/astropy/nddata/flag_collection.pyR      s    c         K` sn   t  | t j  r^ | j |  j k r= t j |  | | |  qj t d j | j |  j    n t d   d  S(   Nu3   flags array shape {0} does not match data shape {1}u&   flags should be given as a Numpy array(	   t
   isinstancet   npt   ndarrayR   R   t   __setitem__R	   t   formatt	   TypeError(   R   t   itemt   valueR   (    (    s=   lib/python2.7/site-packages/astropy/nddata/flag_collection.pyR   )   s    	(   t   __name__t
   __module__t   __doc__R   R   (    (    (    s=   lib/python2.7/site-packages/astropy/nddata/flag_collection.pyR      s   	(   t
   __future__R    R   R   R   t   collectionsR   t   numpyR   t
   utils.miscR   t   __all__R   (    (    (    s=   lib/python2.7/site-packages/astropy/nddata/flag_collection.pyt   <module>   s
   "	