
}\c        :   @  s
  d  Z  d d l m Z d d l Z d d l m Z d d l m Z m Z m	 Z	 m
 Z
 m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z d d l Td Z i e e	 6e e 6e e 6e e 6e e
 6Z d d d f d	 d	 d	 f d	 d d f d d	 d f d d d	 f d	 d	 d f d	 d d	 f d d	 d	 f d
 d d f d d
 d f d d d
 f d
 d
 d f d
 d d
 f d d
 d
 f d d d f d
 d
 d
 f d d d	 f d d d f d	 d	 d f d d	 d	 f d d d f d	 d
 d
 f d d d f d d d	 f d d d
 f d	 d d	 f d	 d	 d f d d	 d	 f d
 d d
 f d
 d d f d d
 d
 f d d d	 f d d d	 f d d	 d	 f d d	 d f d	 d	 d f d d d	 f d	 d d f d d d	 f d d d f d d d	 f d d d f d d d f d	 d d f d	 d d f d	 d d f d d d f d d d f d d d f d d d f d d d f d d d f d d d f d d d f d d d f d d d f f8 Z e d  Z d d d f d	 d	 d	 f d	 d d f d d	 d f d d d	 f d	 d	 d f d	 d d	 f d d	 d	 f d
 d d f d d
 d f d d d
 f d
 d
 d f d
 d d
 f d d
 d
 f d d d f d
 d
 d
 f d d d	 f d d d f d	 d	 d f d d	 d	 f d d d f d	 d
 d
 f d d d f d d d	 f d d d
 f d	 d d	 f d	 d	 d f d d	 d	 f d
 d d
 f d
 d d f d d
 d
 f d d d	 f d d d	 f d d	 d	 f d d	 d f d	 d	 d f d d d	 f d	 d d f d d d	 f d	 d d f d d d	 f d d d f d d d f d	 d d f d	 d d f d	 d d f d d d f d d d f d d d f d d d f d d d f d d d f d d d f d d d f d d d f d d d f f8 Z i e d 6e d 6e d 6e d 6e d 6e d 6e d 6e d 6Z d d d d d d  d! d" d# d$ g
 Z d%   Z  d d&  Z! d' e" f d(     YZ# d) e e# f d*     YZ$ d+   Z% d,   Z& d- e e# f d.     YZ' i$ d/ d 6d0 d 6d1 d2 6d3 d4 6d5 d6 6d7 d8 6d9 d: 6d; d< 6d= d> 6d? d@ 6dA dB 6dC dD 6dE dF 6dG dH 6dI dJ 6dK dL 6dM d 6dN dO 6dP dQ 6dR dS 6dT d 6dU d 6dV dW 6dX dY 6dZ d[ 6d\ d] 6d^ d 6d_ d` 6da db 6dc dd 6de df 6dg d 6dh di 6dj dk 6dl dm 6dn do 6Z( d d e f d dH e	 f dJ dW e f dp dq e f dY df e	 f d dk e f dm dm e	 f do do e
 f d dr e f ds dt e	 f du d e	 f dv dw e f g Z) i  Z* x? e) D]7 \ Z+ Z, Z- x% e. e+ e, d  D] Z/ e- e* e/ <qWqW[+ [, [- [/ e0 dx  Z1 i  Z2 x" e1 e1 j3   D] Z4 d8 e2 e4 <q	W[4 [1 i  Z5 x e0 dy  D] Z4 d e5 e4 <q>	Wi d8 e0 d0  6d8 e0 dz  6d8 e0 d{  6Z6 i d e0 dC  6d e0 dl  6d e0 d/  6d e0 d|  6d e0 d}  6d e0 dn  6Z7 e j8 d~  j9 Z: d   Z; e d  Z< d   Z= d   Z> d   Z? d   Z@ d   ZA d   ZB d   ZC d   ZD d e e# f d     YZE d e e# f d     YZF d e e# f d     YZG d e e# f d     YZH d e f d     YZI d S(   s$   
Module for formatting information.
i(   t   print_functionN(   t   unpacki   (   t   FDTt   FGEt   FNUt   FTXt   FUNt   XL_CELL_DATEt   XL_CELL_NUMBERt   XL_CELL_TEXTt	   XL_FORMATt
   XL_FORMAT2t
   BaseObjectt	   XLRDErrort   fprintft   unpack_stringt   unpack_unicodet   upkbitst   upkbitsL(   t   *i    i   i   i   i   i3   if   i   i   i   i   iP   iF   i2   i-   i(   i   i   i   t   Normalt	   RowLevel_t	   ColLevel_t   Commat   Currencyt   Percents	   Comma [0]s   Currency [0]t	   Hyperlinks   Followed Hyperlinkc         C  s   i  |  _  i  |  _ |  j s d  Sx% t d  D] } t | |  j  | <q, Wt |  j } t |  } x) t |  D] } | | |  j  | d <qm Wd  |  j  | d <d  |  j  | d d <d  |  j  d <d  |  j  d <d  S(   Ni   i   iQ   i  (	   t
   colour_mapt   colour_indexes_usedt   formatting_infot   xranget   excel_default_palette_b8t   default_palettet   biff_versiont   lent   None(   t   bookt   it   dpalt   ndpal(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   initialise_colour_mapi   s    			c   
      C  s   d } d } x |  j    D] \ } } | d k r7 q n  d } x3 t | |  D]" \ } }	 | | |	 | |	 7} qM W| | k  r | } | } | d k r Pq q q Wd r | r t d | | |  | | f  n  | S(   s   
    General purpose function. Uses Euclidean distance.
    So far used only for pre-BIFF8 ``WINDOW2`` record.
    Doesn't have to be fast.
    Doesn't have to be fancy.
    i   i   i    s:   nearest_colour_index for %r is %r -> %r; best_metric is %di   i   N(   t   itemsR#   t   zipt   print(
   R   t   rgbt   debugt   best_metrict   best_colourxt   colourxt   cand_rgbt   metrict   v1t   v2(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   nearest_colour_index   s"    t	   EqNeAttrsc           B  s    e  Z d  Z d   Z d   Z RS(   s   
    This mixin class exists solely so that :class:`Format`, :class:`Font`, and
    :class:`XF` objects can be compared by value of their attributes.
    c         C  s   |  j  | j  k S(   N(   t   __dict__(   t   selft   other(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   __eq__   s    c         C  s   |  j  | j  k S(   N(   R7   (   R8   R9   (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   __ne__   s    (   t   __name__t
   __module__t   __doc__R:   R;   (    (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyR6      s   	t   Fontc           B  sn   e  Z d  Z d Z d Z d Z d Z d Z d Z d Z	 d Z
 e d  Z d Z d Z d Z d Z d Z d Z RS(   s   
    An Excel "font" contains the details of not only what is normally
    considered a font, but also several other display attributes.
    Items correspond to those in the Excel UI's Format -> Cells -> Font tab.

    .. versionadded:: 0.6.1
    i    t    i  (   R<   R=   R>   t   boldt   character_sett   colour_indext
   escapementt   familyt
   font_indext   heightt   italict   UNICODE_LITERALt   namet
   struck_outt   underline_typet
   underlinedt   weightt   outlinet   shadow(    (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyR?      s    
c         C  s.   |  j  s d  St d |  d |  j d _ d  S(   Ns   <Hi    i(   R   R   t	   font_listRC   (   R$   t   data(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   handle_efont   s    	c      	   C  s  |  j  s d  S|  j s# |  j   n  t p5 |  j d k } |  j } t |  j  } | d k r t   } t	 d  | _
 | | _ |  j j |  | d 7} n  t   } | | _ |  j j |  | d k rt d | d d ! \ | _ } | _ | _ | _ | _ | _ | _ | d @| _ | d @d ?| _ | d @d ?| _ | d	 @d
 ?| _ | d @d ?| _ | d @d ?| _ | d k rt | d d d | _
 q{t | d |  j d d | _
 n| d k rt d | d d ! \ | _ } | _ | d @| _ | d @d ?| _ | d @d ?| _ | d	 @d
 ?| _ | d @d ?| _ | d @d ?| _ t | d |  j d d | _
 d d g | j | _ d | _ | j | _ d | _ d | _ n t d | d d ! \ | _ } d | _ | d @| _ | d @d ?| _ | d @d ?| _ | d	 @d
 ?| _ d | _ d | _ t | d |  j d d | _
 d d g | j | _ d | _ | j | _ d | _ d | _ | r| j |  j d d | j d d n  d  S(   Ni   i   s
   Dummy Fonti   i2   s	   <HHHHHBBBi    i   i   i   i   i    i   iP   i   t   lenleni   s   <HHHi   i  i  s   <HHi  t   headers   --- handle_font: font[%d] ---t   footers   -------------------(   R   t   encodingt   derive_encodingt   DEBUGt	   verbosityR!   R"   RQ   R?   RI   RJ   RF   t   appendR   RG   RC   RN   RD   RL   RE   RB   RA   RH   RM   RK   RO   RP   R   R   t   dumpt   logfile(   R$   RR   t   blaht   bvt   kt   ft   option_flags(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   handle_font  sx    							C!%									t   Formatc           B  s/   e  Z d  Z d Z e Z e d  Z d   Z RS(   s\   
    "Number format" information from a ``FORMAT`` record.

    .. versionadded:: 0.6.1
    i    R@   c         C  s   | |  _  | |  _ | |  _ d  S(   N(   t
   format_keyt   typet
   format_str(   R8   Re   t   tyRg   (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   __init__d  s    		(	   R<   R=   R>   Re   R   Rf   RI   Rg   Ri   (    (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyRd   L  s
   t   Generalt   0s   0.00i   s   #,##0i   s   #,##0.00i   s   $#,##0_);($#,##0)i   s   $#,##0_);[Red]($#,##0)i   s   $#,##0.00_);($#,##0.00)i   s   $#,##0.00_);[Red]($#,##0.00)i   s   0%i	   s   0.00%i
   s   0.00E+00i   s   # ?/?i   s   # ??/??i   s   m/d/yyi   s   d-mmm-yyi   s   d-mmms   mmm-yyi   s
   h:mm AM/PMi   s   h:mm:ss AM/PMi   s   h:mms   h:mm:sss   m/d/yy h:mmi   s   #,##0_);(#,##0)i%   s   #,##0_);[Red](#,##0)i&   s   #,##0.00_);(#,##0.00)i'   s   #,##0.00_);[Red](#,##0.00)s'   _(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)i)   s*   _($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)i*   s/   _(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)i+   s2   _($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)i,   s   mm:sss	   [h]:mm:ssi.   s   mm:ss.0i/   s   ##0.0E+0i0   t   @i1   i   i$   i:   i;   i>   iC   iG   iQ   t   ymdhss   $-+/(): t   #t   ?t   GENERALt   generals	   \[[^]]*\]c   	      C  s(  d } d } x | D] } | d k rw | t  d  k r@ d } q | t  d  k r[ d } q | t k rj q | | 7} n? | d k r | t  d  k r d } q n | d k r d } n  d | k o d k n s t  q W|  j d k rt d t |  d	 |  j n  t d |  } | t k r*t	 Sd } d
 } d } d } } x] | D]U } | t
 k rp| t
 | 7} qM| t k r| t | 7} qM| | k rMd } qMqMW| r| rt S| r| rt	 S| r|  j rt |  j d | | |  qn( | s|  j rt |  j d |  qn  | | k S(   Ni    R@   t   "i   s   \_*i   i   s+   is_date_format_string: reduced format is %st   filet   ;s7   WARNING *** is_date_format: ambiguous d=%d n=%d fmt=%r
s/   WARNING *** format %r produces constant result
(   RI   t   skip_char_dictt   AssertionErrorRZ   R+   t   REPRR]   t   fmt_bracketed_subt   non_date_formatst   Falset   date_char_dictt   num_char_dictt   TrueR   (	   R$   t   fmtt   statet   st   ct	   separatort   got_sept
   date_countt	   num_count(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   is_date_format_string  s`    
			& 
				c         C  sF  d } |  j  } | t k r- t | d  } n  |  j sC |  j   n  d } | d k rr t d | d d ! d } n |  j } | d k r d } n  |  j d 7_ | d k r t | d  } n t | | |  j d d } | p |  j	 d	 k } | rt
 |  j d
 |  j | | |  n  |  j |  }	 t t g |	 }
 | d k pI| d k  st j | t  } | t k } |  j	 rd | k  od k  n r| |	 Ard } t
 |  j d | |  qn  | d k rt
 |  j d |
 | |	 |  n  t | |
 |  } | r%| j |  j d d |  j d f n  | |  j | <|  j j |  d  S(   Ni    i   i   i2   s   <Hi   iP   RT   i   s)   FORMAT: count=%d fmtkey=0x%04x (%d) s=%r
i   sH   WARNING *** Conflict between std format key %d and its format string %r
s2   ty: %d; is_date_c: %r; is_date_s: %r; fmt_strg: %rRU   s   --- handle_format [%d] ---(   R!   R   t   minRW   RX   R   t   actualfmtcountR   R   RZ   R   R]   R   R   R   t   std_format_code_typest   getR   Rd   R\   t
   format_mapt   format_listR[   (   R8   RR   t   rectypeRY   R_   t   strpost   fmtkeyt   unistrgR^   t	   is_date_sRh   t   std_tyt	   is_date_ct   fmtobj(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   handle_format
  sR    					/		c         C  s  |  j  s d  St p |  j d k } t d | d   \ } d |  j d k } t s` |  j d k r | | k r t |  j d | |  n | r t |  j d |  n  d	 | } d
 | d } t |  } d
 } | | k o | | k n st d | | f   n  t | | |   }	 |  j	 g  k s,t
  x t |  D] }
 |	 |
 } | d @} | d ?d @} | d ?d @} |  j d |
 } | | | f } |  j	 j |  | |  j d |
 <| r9| | k rt d |
 | | f d |  j qq9q9Wd  S(   Ni   s   <Hi   i8   i2   i   s9   NOTE *** Expected %d colours in PALETTE record, found %d
s   PALETTE record with %d colours
s   <xx%dii   s0   PALETTE record: expected size %d, actual size %di   i   s   %2d: %r -> %rRs   (   i   i8   (   R   RY   RZ   R   R!   R   R]   R"   R   t   palette_recordRv   R   R   R[   R+   (   R$   RR   R^   t	   n_colourst   expected_n_coloursR~   t   expected_sizet   actual_sizet	   tolerancet   coloursR%   R   t   redt   greent   bluet   old_rgbt   new_rgb(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   handle_palette>  s@    	!		
 

c         C  s   x |  j  D] } | j d k r% q
 n  | j } | d k r@ q
 n  | |  j k r_ d |  j | <q
 |  j r
 t d t |  j  d |  j t	 |  j d | j | j
 |  q
 q
 W|  j d k r t |  j j    } t d | d |  j n  d  S(   Ni   i  i   s   Size of colour table:Rs   s2   *** Font #%d (%r): colour index 0x%04x is unknown
s   
Colour indexes used:
%r
(   RQ   RF   RC   R   R   RZ   R+   R"   R]   R   RJ   t   sortedt   keys(   R$   t   fontt   cxt   used(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   palette_epilogueb  s    		c   
      C  s  |  j  s d  St p |  j d k } |  j } t d | d   \ } } } | d @} | d k r d |  j k r d } d } d } d }	 d	 } n"| d
 @r d } t | }	 d | k o d k n r|	 t | d  7}	 qn d } d } d } | d k rqy t | d d d }	 Wqt	 k
 rmt
 d | | | | f d |  j t
 d t | d  d |  j   qXn t | d |  j d d }	 | r|	 rt
 d d |  j n  | | f |  j |	 <| rt |  j d | | | | |	  n  d  S(   Ni   s   <HBBi   i  s       R   i   i    i   i   iP   RT   s6   STYLE: built_in=%d xf_index=%d built_in_id=%d level=%dRs   s
   raw bytes:s7   WARNING *** A user-defined style has a zero-length names?   STYLE: built_in=%d xf_index=%d built_in_id=%d level=%d name=%r
(   R   RY   RZ   R!   R   t   style_name_mapt   built_in_style_namest   strR   t   UnicodeDecodeErrorR+   R]   t   reprR   RW   R   (
   R$   RR   R^   R_   t   flag_and_xfxt   built_in_idt   levelt   xf_indext   built_inRJ   (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   handle_stylev  sF    		
	

 
c         C  s   t  | j j    } x | D] \ } } t | d  rJ t |  | |  q | j d  d k r | |  j k r d |  j | <q n  | j j	 } t
 d | | | | f d |  j q q Wd  S(   NR\   RC   i    i   s&   *** xf #%d : %s.%s =  0x%04x (unknown)Rs   (   R   R7   R)   t   hasattrt   check_colour_indexes_in_objt   findR   R   t	   __class__R<   R+   R]   (   R$   t   objt
   orig_indext   alistt   attrt   nobjt   oname(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyR     s    c         C  se   x^ t  j   D]P } | |  j k r t  | } t j |  } t | | |  } | |  j | <q q Wd  S(   N(   R   R   R   t   std_format_stringsR   Rd   (   R$   t   xRh   t   fmt_strR   (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   fill_in_standard_formats  s    
c   "      C  s	  t  p |  j d k } |  j } t   } t   | _ d | j _ d | j _ d | j _ t	   | _
 d | j
 _ d | j
 _ d | j
 _ d | j
 _ t   | _ t   | _ | d k r |  j r t |   n  | d k rbd } t | | d d ! \
 | _ | _ } } | j _ } }	 }
 } } t | j | dx dy f  t | | dz d{ d| f  t | j | d} d~ d f  t | j | d d d f  |	 d	 ?} d d d d  d! d" g } x: | D]2 } d# | d$ } t | | | d @ | d L} qWt | j
 |
 d d d d d d d d f  t | j
 | d d d d f  t | j | d  t | j | d d f  n| d k rdG } t | | d d ! \ | _ | _ } } } }
 } t | j | d d f  t | | d d d f  t | j | d d d f  | d @} d dH dI dJ g | | j _ | d	 ?} d d d d  d! d" g } x: | D]2 } d# | d$ } t | | | d @ | d L} qBWt | j |
 d d d f  t | j
 |
 d d f  t | j
 | d d d d d d f  nK| dT k r9dU } t | | d d* ! \ | _ | _ } } }	 } } t | j | d d f  t | | d d d f  t | j | d d d f  | d @d ?} d dH dI dJ g | | j _ |	 d	 ?} d d d d  d! d" g } x: | D]2 } d# | d$ } t | | | d @ | d L} qWt | j | d d d f  t | j
 | d d d d d d d d f  n| d2 k rdd } t | | d d* ! \ | _ | _ } }	 } } } t | j | d d f  t | | d d f  t | j | d d f  t | | d  |	 d	 ?} d d d d  d! d" g } x: | D]2 } d# | d$ } t | | | d @ | d L} qWt | j | d d d f  t | j
 | d d d d d d d d f  d	 | j _ d | j _ n| d? k rt de |  \ | _ } } | dW @| _ t | j | d d f  t | j | d  xs d d d d f D]_ \ } } | | @r-d \ } } n d \ } } t | j
 | dm |  t | j
 | dn |  qW| j } | dg @rdo | _ n	 d | _ dR | _ d | _ d | _  d	 | j _ d | j _ d d d d  d! d" g } x? | D]$ } d# | d$ } t | | d  qWn t! dp |   t" |  j#  | _$ |  j# j% |  |  j d 7_ | r}| j& |  j' dq dr | j$ ds dt n  y! |  j( | j } t) | j* }  Wn t+ k
 rt, }  n X|  |  j- | j$ <|  j. r-	|  j r	| j/ r	| j  du k r	dv }! t0 |  j' |! | j$ | j   n  t1 |  | | j$  n  | j |  j( k r	dw }! |  j rs	t0 |  j' |! | j$ | j | j  n  d | _ n  d  S(   Ni   i    i2   iP   s   <HHHBBBBIiHi   i   t   cell_lockedi   t   formula_hiddeni   t   is_stylei   t   lotus_123_prefixi  t   parent_style_indexi   t	   hor_alignt   text_wrappedip   t
   vert_aligni   t   indent_leveli   t   shrink_to_fiti   i   t   text_directiont   formatR   t	   alignmentt   bordert
   backgroundt
   protectiont   _t   _flagt   left_line_stylei   t   right_line_stylei   t   top_line_stylei   i   t   bottom_line_stylei   t   left_colour_indexi   i  ?t   right_colour_indexi   i   @t	   diag_downi   I       t   diag_upi   t   top_colour_indexi?  t   bottom_colour_indexi   i  t   diag_colour_indexi   i  t   diag_line_stylei   I       t   fill_patternt   pattern_colour_indext   background_colour_indexs   <HHHBBIii   iZ   i   i  ? i   i  i   I       i8   i  i	   i   i(   s   <BBHBBHIi0   i?   i  i   i   i   i   i   i   i   i   i   i   I       s   <BBBBHHIs   <BxBBi@   i   t   leftt   righti    t   topt   bottomt   _colour_indext   _line_stylei   s   programmer stuff-up: bv=%dRU   s   --- handle_xf: xf[%d] ---RV   t    i  sN   WARNING *** XF[%d] is a style XF but parent_style_index is 0x%04x, not 0x0fff
s9   WARNING *** XF[%d] unknown (raw) format key (%d, 0x%04x)
(   i    i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   i  R   (   i    i   R   (   i   i   R   (   i   ip   R   (   i    i   R   (   i   i   R   (   i   i   R   (   i    i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   i  ?R   (   i   i   @R   (   i   I       R   (   i    i   R   (   i   i?  R   (   i   i  R   (   i   i  R   (   i   I       R   (   (   i   I       R   (   i    i   R   (   i   i?  R   (   i    i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   i  R   (   i    i   R   (   i   i   R   (   i   ip   R   (   i    i   R   (   i   i?  R   (   i   i  ? R   (   i   i  R   (   i   I       R   (   i    i   R   (   i   i8   R   (   i   i  R   (   i	   i   R   (   i   i   R   (   i   i  ?R   (   i    i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   i  R   (   i    i   R   (   i   i   R   (   i   i0   R   (   i    i?   R   (   i   i  R   (   i   i   R   (   i    i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   I       R   (   i    i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i    i   R   (   i   i   R   (   i   i  R   (   (   i   i  R   (   i    i?   R   (   i   i  R   (   i   i   R   (   i    i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   i   R   (   i   I       R   (   i   i@   R   (   i   i   R   (   i    i   R   (   (   i    i   R   (   i   R   (   i   R   (   i    R   (   i@   R   (   i   i   (   i    i    (2   RY   RZ   R!   t   XFt   XFAlignmentR   R   R   R   t   XFBorderR   R   R   R   R   t   XFBackgroundR   t   XFProtectionR   t   xfcountR   R   RF   Re   t   rotationR   t   setattrR   R   R   R   R   R   R   R"   t   xf_listR   R[   R\   R]   R   t   _cellty_from_fmttyRf   t   KeyErrorR   t   _xf_index_to_xl_type_mapR   R   R   R   ("   R8   RR   R^   R_   t   xft
   unpack_fmtt   pkd_type_part
   pkd_align1t
   pkd_align2t   pkd_usedt   pkd_brdbkg1t   pkd_brdbkg2t   pkd_brdbkg3t   regt
   attr_stemst	   attr_stemR   t   pkd_orient_usedt   orientationt   pkd_align_orientt
   pkd_bkg_34t
   pkd_brd_34t   pkd_type_prott   pkd_align_part
   format_etct
   halign_etct   maskt   sideRC   t
   line_stylet   bgR~   t   celltyt   msg(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt	   handle_xf  s   		@
	



	

1
	



	

1
	


	
1
	

	
	



	
						

	!	c   
      C  s  d |  _  t |  j  } t p* |  j d k } t p? |  j d k } | r[ t |  j d  n  d   } xEt |  D]7} |  j | } y! |  j | j	 } t
 | j } Wn t k
 r t } n X| |  j | j <|  j s qq n  | j r qq n  d | j k o| k  n sC| r7t |  j d | j | j | j  n  d | _ n  |  j d k rq | r| j | j k rt |  j d | j | j  q|  j | j j st |  j d	 | j | j  qn  | r| j | j k rt |  j d
 | j | j  n  |  j | j }	 | j r8|	 j r8| r8| |  | |	 d  q8n  | j rk|	 j rk| rk| |  | |	 d  qkn  | j r|	 j r| r| |  | |	 d  qn  | j r|	 j r| r| |  | |	 d  qn  | j rK|	 j rK| rK| j	 |	 j	 k rKt |  j d | j | j	 |	 j |	 j	 |  j | j	 j |  j |	 j	 j  qKn  | j r|	 j r| r| j |	 j k rt |  j d | j | j |	 j |	 j  qqqq qq Wd  S(   Ni   i   s   xf_epilogue called ...
c         S  sD   t  | |  t  | |  k r@ t |  j d | j | j |  n  d  S(   Ns(   NOTE !!! XF[%d] parent[%d] %s different
(   t   getattrR   R]   R   (   t   book_argt   xf_argt
   parent_argR   (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt
   check_same  s    	i    s:   WARNING *** XF[%d]: is_style=%d but parent_style_index=%d
i   s/   NOTE !!! XF[%d]: parent_style_index is also %d
s>   NOTE !!! XF[%d]: parent_style_index is %d; style flag not set
s9   NOTE !!! XF[%d]: parent_style_index is %d; out of order?
R   R   R   R   s4   NOTE !!! XF[%d] fmtk=%d, parent[%d] fmtk=%r
%r / %r
s.   NOTE !!! XF[%d] fontx=%d, parent[%d] fontx=%r
(   t   _xf_epilogue_doneR"   R   RY   RZ   R   R]   R   R   Re   R   Rf   R   R	   R   R   R   R   R   R!   t   _alignment_flagt   _background_flagt   _border_flagt   _protection_flagt   _format_flagRg   t
   _font_flagRF   (
   R8   t   num_xfsR^   t   blah1R  t   xfxR   R~   R  t   parent(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   xf_epilogue  s    		
						    		c      	   C  s_   t  |   d |  _ t t t t t t t t	 t
 f	 } x$ | D] } t |  j | j |  q; Wd  S(   Ni    (   R(   R  Rc   RS   R   R   R   R   R   R  R"  R   R   R<   (   R$   t   methodst   method(    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   initialise_book>  s    
		R   c           B  sV   e  Z d  Z d Z d Z d Z d Z d Z d Z d Z	 d Z
 d Z d Z d Z d Z RS(   so  
    A collection of the border-related attributes of an ``XF`` record.
    Items correspond to those in the Excel UI's Format -> Cells -> Border tab.

    An explanations of "colour index" is given in :ref:`palette`.

    There are five line style attributes; possible values and the
    associated meanings are::

      0 = No line,
      1 = Thin,
      2 = Medium,
      3 = Dashed,
      4 = Dotted,
      5 = Thick,
      6 = Double,
      7 = Hair,
      8 = Medium dashed,
      9 = Thin dash-dotted,
      10 = Medium dash-dotted,
      11 = Thin dash-dot-dotted,
      12 = Medium dash-dot-dotted,
      13 = Slanted medium dash-dotted.

    The line styles 8 to 13 appear in BIFF8 files (Excel 97 and later) only.
    For pictures of the line styles, refer to OOo docs s3.10 (p22)
    "Line Styles for Cell Borders (BIFF3-BIFF8)".</p>

    .. versionadded:: 0.6.1
    i    (   R<   R=   R>   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyR   O  s   R   c           B  s    e  Z d  Z d Z d Z d Z RS(   s  
    A collection of the background-related attributes of an ``XF`` record.
    Items correspond to those in the Excel UI's Format -> Cells -> Patterns tab.

    An explanations of "colour index" is given in :ref:`palette`.

    .. versionadded:: 0.6.1
    i    (   R<   R=   R>   R   R   R   (    (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyR     s   R   c           B  s8   e  Z d  Z d Z d Z d Z d Z d Z d Z d Z	 RS(   s   
    A collection of the alignment and similar attributes of an ``XF`` record.
    Items correspond to those in the Excel UI's Format -> Cells -> Alignment tab.

    .. versionadded:: 0.6.1
    i    (
   R<   R=   R>   R   R   R   R   R   R   R   (    (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyR     s   R   c           B  s   e  Z d  Z d Z d Z RS(   sd  
    A collection of the protection-related attributes of an ``XF`` record.
    Items correspond to those in the Excel UI's Format -> Cells -> Protection tab.
    Note the OOo docs include the "cell or style" bit in this bundle of
    attributes. This is incorrect; the bit is used in determining which bundles
    to use.

    .. versionadded:: 0.6.1
    i    (   R<   R=   R>   R   R   (    (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyR     s   	R   c           B  sh   e  Z d  Z d Z d Z d Z d Z d Z d Z d Z	 d Z
 d Z d Z d Z d Z d Z d Z d Z RS(   s  
    eXtended Formatting information for cells, rows, columns and styles.

    Each of the 6 flags below describes the validity of
    a specific group of attributes.

    In cell XFs:

    - ``flag==0`` means the attributes of the parent style ``XF`` are
      used, (but only if the attributes are valid there);

    - ``flag==1`` means the attributes of this ``XF`` are used.

    In style XFs:

    - ``flag==0`` means the attribute setting is valid;
    - ``flag==1`` means the attribute should be ignored.

    .. note::
      the API provides both "raw" XFs and "computed" XFs. In the latter case,
      cell XFs have had the above inheritance mechanism applied.

    .. versionadded:: 0.6.1
    i    N(   R<   R=   R>   R   R   R  R  R  R  R  R  R   RF   Re   R#   R   R   R   R   (    (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyR     s    (J   R>   t
   __future__R    t   ret   structR   t   biffhR   R   R   R   R   R   R   R	   R
   R   R   R   R   R   R   R   R   t   timemachineRY   R   t   excel_default_palette_b5t   excel_default_palette_b2R   R    R   R(   R5   t   objectR6   R?   RS   Rc   Rd   R   t   fmt_code_rangesR   t   lot   hiRh   R   R   RI   t
   date_charsR{   t   uppert   _cRu   R|   Ry   t   compilet   subRx   R   R   R   R   R   R   R   R  R"  R%  R   R   R   R   R   (    (    (    s.   lib/python2.7/site-packages/xlrd/formatting.pyt   <module>	   s:  p

00000000000006
00000000000006
		X		I
	?4	$		+			 =	I	C"