
ڙ!Xc           @  s9  d  d l  m Z d Z d Z d Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l	 Z
 d  d l Z d d d g Z e e k	 r e Z n  y
 e Z Wn e Z n Xe j d	  j d
 k r d	 Z n- e j d  j d
 k r d Z n e d   y e Wn; e k
 r;y e e f Z Wn e k
 r7e Z n Xn Xe Z e a d   Z d   Z e a 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/ d Z0 d Z1 d Z2 d
 Z3 d Z4 d Z5 d Z6 d Z7 d Z8 d Z9 d  Z: d! Z; d" Z< d# Z= d$ Z> d% Z? d& Z@ d' ZA d( ZB d) ZC d* ZD d+ ZE d, ZF d- ZG d. ZH d/ ZI d0 ZJ d1 ZK d2 ZL d3 ZM d4 ZN d5 ZO d6 ZP d7 ZQ d8 ZR d9 ZS d: ZT d; ZU d< ZV d= ZW i  ZX x@ eY eZ   j[    D]) \ Z\ Z] e\ d  d> k re\ eX e] <n  qWd? Z^ d Z_ d( Z` d2 Za d@ Zb xK eY eZ   jc    D]4 Zd ed je dA  pQed je dB  rde jf ed  n  q0WdC   Zg e e k rdD   Zh n	 dE   Zh d dF  Zi d dG  Zj dH   Zk dI dJ  Zl dK   Zm dL f  dM     YZn dN e jo f dO     YZp dP f  dQ     YZq d f  dR     YZr es dS k r5d  d l Z et e ju  d k rhev ew  ev dT  e jx   n  e Zy xe ju d D]Zz ez dU k re  e{  q|n  ez dV k re{ Zy q|n  er ez  Z| ev dW d8  ev ez  ev dW d8  e| j}   xMe| j~   D]?Z e d  d dX k r>ev e dY  e| j e dZ e{ Z e e j[    Z x e D] \ Z Z e e e e f  ret e  d[ k re d[  Z n  n  e e e  r'x{ d d d d
 d d d d  d! d# d\ d$ d% d& d' d( d) d* d+ d, d- d. d/ d0 d1 d2 d3 f D]" Z e e e  k r d] Z Pn  qWn  ev d^ e e  qTWn  qWey rev d_  x e| j~   D]{ Z ev dW e d` j e   dW da db e| j e  Z e e+ k rev dc e| j e   e| j e  n ev dd e  q_Wev   n  ev de  xF e| j D]; Z e e k	 r7ev df e j e j   e j   f  n  qWev   e| j   Z e j   ev   e| j   Z ev dg e  e| j dh  rev di  ev dj e| j dh   ev dk e| j dh   e| j dl  rev dm  n  n  ev dn  e| j r$x. e| j D]# \ Z Z ev do e js e f  qWn
 ev dp  q|Wn  d S(q   i(   t   print_functions0   Philippe Lagadec, Fredrik Lundh (Secret Labs AB)s
   2014-02-04s   0.30Nt	   OleFileIOt	   isOleFilet   MAGICt   Li   t   Is>   Need to fix a bug with 32 bit arrays, please contact author...c         C  s   t  |   d  S(   N(   t   print(   t   msg(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   debug_print  s    c         C  s   d  S(   N(    (   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt
   debug_pass!  s    c         C  s   |  a  |  r t a n t a d S(   se   
    Set debug mode on or off, to control display of debugging messages.
    mode: True or False
    N(   t
   DEBUG_MODER   t   debugR	   (   t
   debug_mode(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   set_debug_mode%  s    	s   ࡱI    I    I    I    I    i    i   i   i   i   i   i   i   i	   i
   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i@   iA   iB   iC   iD   iE   iF   iG   iH   i   t   VT_s$   00020900-0000-0000-C000-000000000046i(   t   STGTY_t   DEFECT_c         C  s<   t  |  d  } | j t t   } | t k r4 t St Sd S(   s   
    Test if file is an OLE container (according to its header).
    
    :param filename: file name or path (str, unicode)
    :returns: True if OLE, False otherwise.
    t   rbN(   t   opent   readt   lenR   t   Truet   False(   t   filenamet   ft   header(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR   s  s
    c         C  s
   t  |   S(   N(   t   ord(   t   c(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   i8  s    c         C  s   |  j  t k r |  S|  d S(   Ni    (   t	   __class__t   int(   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR     s    c         C  s$   t  |  |  t  |  | d  d >BS(   s   
    Converts a 2-bytes (16 bits) string to an integer.

    :param c: string containing bytes to convert
    :param o: offset of bytes to convert in string
    i   i   (   R   (   R   t   o(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   i16  s    c         C  sP   t  |  |  t  |  | d  d >Bt  |  | d  d >Bt  |  | d  d >BS(   s   
    Converts a 4-bytes (32 bits) string to an integer.

    :param c: string containing bytes to convert
    :param o: offset of bytes to convert in string
    i   i   i   i   i   i   (   R   (   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   i32  s    
c         C  sy   t  |   d k s t  |  j d  s+ d Sd d d t |  d  t |  d  t |  d  f t t t |  d	 d !  S(
   s^   
    Converts a CLSID to a human-readable string.

    :param clsid: string of length 16.
    i   t    t    s   %08X-%04X-%04X-%02X%02X-s   %02Xi   i    i   i   (   R   t   AssertionErrort   stripR!   R    t   tuplet   mapR   (   t   clsid(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   _clsid  s    't   replacec         C  sV   y< |  j  d |  } t t k	 s' t r+ | S| j d |  SWn t d   n Xd S(   s   
    Map unicode string to Latin 1. (Python with Unicode support)

    :param s: UTF-16LE unicode string to convert to Latin-1
    :param errors: 'replace', 'ignore' or 'strict'.
    s   UTF-16LEt   latin_1s   incorrect Unicode nameN(   t   decodet   bytest   strt   KEEP_UNICODE_NAMESt   encodet   IOError(   t   st   errorst   u(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   _unicode  s    	c         C  s6   t  j  d d d d d d  } | t  j d |  d  S(   sL   
        convert FILETIME (64 bits int) to Python datetime.datetime
        iA  i   i    t   microsecondsi
   (   t   datetimet	   timedelta(   t   filetimet   _FILETIME_null_date(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   filetime2datetime  s    t   OleMetadatac           B  s   e  Z d  Z d d d d d d d d d	 d
 d d d d d d d d d g Z d d d d d d d d d d d d d  d! d" d# d$ d% d& d' d( d) d* d+ d, d- d. d/ g Z d0   Z d1   Z d2   Z RS(3   sA  
    class to parse and store metadata from standard properties of OLE files.

    Available attributes:
    codepage, title, subject, author, keywords, comments, template,
    last_saved_by, revision_number, total_edit_time, last_printed, create_time,
    last_saved_time, num_pages, num_words, num_chars, thumbnail,
    creating_application, security, codepage_doc, category, presentation_target,
    bytes, lines, paragraphs, slides, notes, hidden_slides, mm_clips,
    scale_crop, heading_pairs, titles_of_parts, manager, company, links_dirty,
    chars_with_spaces, unused, shared_doc, link_base, hlinks, hlinks_changed,
    version, dig_sig, content_type, content_status, language, doc_version

    Note: an attribute is set to None when not present in the properties of the
    OLE file.

    References for SummaryInformation stream:
    - http://msdn.microsoft.com/en-us/library/dd942545.aspx
    - http://msdn.microsoft.com/en-us/library/dd925819%28v=office.12%29.aspx
    - http://msdn.microsoft.com/en-us/library/windows/desktop/aa380376%28v=vs.85%29.aspx
    - http://msdn.microsoft.com/en-us/library/aa372045.aspx
    - http://sedna-soft.de/summary-information-stream/
    - http://poi.apache.org/apidocs/org/apache/poi/hpsf/SummaryInformation.html

    References for DocumentSummaryInformation stream:
    - http://msdn.microsoft.com/en-us/library/dd945671%28v=office.12%29.aspx
    - http://msdn.microsoft.com/en-us/library/windows/desktop/aa380374%28v=vs.85%29.aspx
    - http://poi.apache.org/apidocs/org/apache/poi/hpsf/DocumentSummaryInformation.html

    new in version 0.25
    t   codepaget   titlet   subjectt   authort   keywordst   commentst   templatet   last_saved_byt   revision_numbert   total_edit_timet   last_printedt   create_timet   last_saved_timet	   num_pagest	   num_wordst	   num_charst	   thumbnailt   creating_applicationt   securityt   codepage_doct   categoryt   presentation_targetR-   t   linest
   paragraphst   slidest   notest   hidden_slidest   mm_clipst
   scale_cropt   heading_pairst   titles_of_partst   managert   companyt   links_dirtyt   chars_with_spacest   unusedt
   shared_doct	   link_baset   hlinkst   hlinks_changedt   versiont   dig_sigt   content_typet   content_statust   languaget   doc_versionc         C  s  d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _	 d |  _
 d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _  d |  _! d |  _" d |  _# d |  _$ d |  _% d |  _& d |  _' d |  _( d |  _) d |  _* d |  _+ d |  _, d |  _- d |  _. d |  _/ d S(   s_   
        Constructor for OleMetadata
        All attributes are set to None by default
        N(0   t   NoneR=   R>   R?   R@   RA   RB   RC   RD   RE   RF   RG   RH   RI   RJ   RK   RL   RM   RN   RO   RP   RQ   RR   R-   RS   RT   RU   RV   RW   RX   RY   RZ   R[   R\   R]   R^   R_   R`   Ra   Rb   Rc   Rd   Re   Rf   Rg   Rh   Ri   Rj   (   t   self(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   __init__  s^    																																														c         C  s   x( |  j  |  j D] } t |  | d  q W| j d  r | j d d t d d g } xM t t |  j    D]3 } | j	 | d d  } t |  |  j  | |  qn Wn  | j d  r| j d d t } xM t t |  j   D]3 } | j	 | d d  } t |  |  j | |  q Wn  d S(   s3  
        Parse standard properties of an OLE file, from the streams
        "SummaryInformation" and "DocumentSummaryInformation",
        if present.
        Properties are converted to strings, integers or python datetime objects.
        If a property is not present, its value is set to None.
        s   SummaryInformationt   convert_timet   no_conversioni
   i   s   DocumentSummaryInformationN(
   t   SUMMARY_ATTRIBSt   DOCSUM_ATTRIBSt   setattrRk   t   existst   getpropertiesR   t   rangeR   t   get(   Rl   t   olefilet   attribt   propst   it   value(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   parse_propertiesH  s    		c         C  s   t  d  x: |  j D]/ } t |  |  } t  d | t |  f  q Wt  d  x: |  j D]/ } t |  |  } t  d | t |  f  q[ Wd S(   s<   
        Dump all metadata, for debugging purposes.
        s*   Properties from SummaryInformation stream:s   - %s: %ss2   Properties from DocumentSummaryInformation stream:N(   R   Rp   t   getattrt   reprRq   (   Rl   t   propR{   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   dumph  s    

(   t   __name__t
   __module__t   __doc__Rp   Rq   Rm   R|   R   (    (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR<     s   		8	 t
   _OleStreamc           B  s   e  Z d  Z d   Z RS(   s  
    OLE2 Stream

    Returns a read-only file object which can be used to read
    the contents of a OLE stream (instance of the BytesIO class).
    To open a stream, use the openstream method in the OleFile class.

    This function can be used with either ordinary streams,
    or ministreams, depending on the offset, sectorsize, and
    fat table arguments.

    Attributes:
        - size: actual size of data stream, after it was opened.
    c      
   C  sQ  t  d  t  d | | | | | t |  t |  f  t } | d k rn t |  | } t } t  d  n  | | d | }	 t  d |	  |	 t |  k r t d   n  g  }
 | d k r | t k r t  d	  t d
   n  xt |	  D]} | t k r(| rPq(t  d  t d   n  | d k  sF| t |  k rt  d | | t |  f  t  d | |	 f  t d   n  y | j | | |  Wn2 t  d | | | | | f  t d   n X| j	 |  } t |  | k rk| t |  d k rkt  d | t |  | | | | t |  f  t  d | | | t |   t d   n  |
 j
 |  y | | } Wq t k
 rt d   q Xq W| t k rt d   n  d j |
  }
 t |
  | k r|
 |  }
 | |  _ n> | rt |
  |  _ n& t  d t |
  | f  t d   t j j |  |
  d S(   sC  
        Constructor for _OleStream class.

        :param fp        : file object, the OLE container or the MiniFAT stream
        :param sect      : sector index of first sector in the stream
        :param size      : total size of the stream
        :param offset    : offset in bytes for the first FAT or MiniFAT sector
        :param sectorsize: size of one sector
        :param fat       : array/list of sector indexes (FAT or MiniFAT)
        :param filesize  : size of OLE file (for debugging)
        :returns    : a BytesIO instance containing the OLE stream
        s   _OleStream.__init__:sE     sect=%d (%X), size=%d, offset=%d, sectorsize=%d, len(fat)=%d, fp=%sis     stream with UNKNOWN SIZEi   s   nb_sectors = %ds(   malformed OLE document, stream too largei    s!   size == 0 and sect != ENDOFCHAIN:s+   incorrect OLE sector index for empty streams$   sect=ENDOFCHAIN before expected sizes   incomplete OLE streams   sect=%d (%X) / len(fat)=%ds   i=%d / nb_sectors=%ds,   incorrect OLE FAT, sector index out of ranges   sect=%d, seek=%d, filesize=%ds   OLE sector index out of ranges9   sect=%d / len(fat)=%d, seek=%d / filesize=%d, len read=%ds   seek+len(read)=%ds   incomplete OLE sectors)   incorrect last sector index in OLE streamR#   s   len(data)=%d, size=%ds%   OLE stream size is less than declaredN(   R   R   R~   R   R   R1   t
   ENDOFCHAINRu   t   seekR   t   appendt
   IndexErrort   joint   sizet   iot   BytesIORm   (   Rl   t   fpt   sectR   t   offsett
   sectorsizet   fatt   filesizet   unknown_sizet
   nb_sectorst   dataRz   t   sector_data(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyRm     sl    
)

(+ 
(   R   R   R   Rm   (    (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR   x  s   t   _OleDirectoryEntryc           B  s   e  Z d  Z d Z d Z e j e  e k s3 t  d   Z d   Z	 d   Z
 d   Z d   Z d   Z d	   Z d
 d  Z d   Z d   Z RS(   s   
    OLE2 Directory Entry
    s   <64sHBBIII16sIQQIIIi   c   
      C  s  | |  _  | |  _ g  |  _ i  |  _ t |  _ t j t j	 |  \ } } |  _
 |  _ |  _ |  _ |  _ } |  _ |  _ |  _ |  _ } } |  j
 t t t t g k r | j t d  n  |  j
 t k r | d k r | j t d  n  | d k r|  j
 t k r| j t d  n  | d k r6| j t d  d } n  | | d  } t |  |  _ t d |  j  t |  j  f  t d	 |  j
  t d
 |  j  t d |  j |  j |  j f  | j d k r| d k r| d k rt d | j | | | f  | j t d  n  | |  _ n | t  |  d >|  _ t d |  j | | f  t! |  |  _" |  j
 t k r|  j d k r| j t# d  n  |  j
 t t f k r|  j d k r|  j | j$ k  r|  j
 t k rt% }	 n t }	 | j& |  j |	  n  d S(   sJ  
        Constructor for an _OleDirectoryEntry object.
        Parses a 128-bytes entry from the OLE Directory stream.

        :param entry  : string (must be 128 bytes long)
        :param sid    : index of this directory entry in the OLE file directory
        :param olefile: OleFileIO containing this directory entry
        s   unhandled OLE storage typei    s   duplicate OLE root entrys   incorrect OLE root entryi@   s   incorrect DirEntry name lengthi   s   DirEntry SID=%d: %ss    - type: %ds    - sect: %ds%    - SID left: %d, right: %d, child: %di   I    s+   sectorsize=%d, sizeLow=%d, sizeHigh=%d (%X)s   incorrect OLE stream sizei    s%    - size: %d (sizeLow=%d, sizeHigh=%d)s   OLE storage with size>0N('   t   sidRw   t   kidst	   kids_dictR   t   usedt   structt   unpackR   t   STRUCT_DIRENTRYt
   entry_typet   colort   sid_leftt	   sid_rightt	   sid_childt   dwUserFlagst
   createTimet
   modifyTimet
   isectStartt
   STGTY_ROOTt   STGTY_STORAGEt   STGTY_STREAMt   STGTY_EMPTYt   _raise_defectt   DEFECT_INCORRECTR5   t   nameR   R~   R   t   DEFECT_UNSURER   t   longR)   R(   t   DEFECT_POTENTIALt   minisectorcutoffR   t   _check_duplicate_stream(
   Rl   t   entryR   Rw   R   t
   namelengthR(   t   sizeLowt   sizeHight   minifat(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyRm     sN    						Z	 $	c         C  sY   t  d |  j t |  j  |  j f  |  j t k rU |  j |  j  |  j j   n  d S(   s   
        Read and build the red-black tree attached to this _OleDirectoryEntry
        object, if it is a storage.
        Note that this method builds a tree of all subentries, so it should
        only be called for the root object once.
        s.   build_storage_tree: SID=%d - %s - sid_child=%dN(	   R   R   R~   R   R   t   NOSTREAMt   append_kidsR   t   sort(   Rl   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   build_storage_treex  s
     	c         C  s5  | t  k r d S| d k  s4 | t |  j j  k rJ |  j j t d  n  |  j j |  } t d | j t	 | j
  | j | j | j f  |  j | j  | j
 j   } | |  j k r |  j j t d  n  |  j j |  | |  j | <| j r|  j j t d  n  t | _ |  j | j  | j   d S(   s+  
        Walk through red-black tree of children of this directory entry to add
        all of them to the kids list. (recursive method)

        child_sid : index of child directory entry to use, or None when called
                    first time for the root. (only used during recursion)
        Ni    s   OLE DirEntry index out of rangesH   append_kids: child_sid=%d - %s - sid_left=%d, sid_right=%d, sid_child=%ds!   Duplicate filename in OLE storages#   OLE Entry referenced more than once(   R   R   Rw   t
   direntriesR   t   DEFECT_FATALt   _load_direntryR   R   R~   R   R   R   R   R   t   lowerR   R   R   R   R   R   R   (   Rl   t	   child_sidt   childt
   name_lower(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR     s(    $,
	
	c         C  s   |  j  | j  k S(   s   Compare entries by name(   R   (   Rl   t   other(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   __eq__  s    c         C  s   |  j  | j  k  S(   s   Compare entries by name(   R   (   Rl   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   __lt__  s    c         C  s   |  j  |  S(   N(   R   (   Rl   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   __ne__  s    c         C  s   |  j  |  p |  j |  S(   N(   R   R   (   Rl   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   __le__  s    i    c         C  s   d d d d d d g } t  d | t |  j  | |  j d d |  j t t f k rq t  |  j d	 d d n  t    |  j t t f k r |  j r t  d | d
 |  j  n  x" |  j	 D] } | j
 | d  q Wd S(   sA   Dump this entry, and all its subentries (for debug purposes only)s	   (invalid)s	   (storage)s   (stream)s   (lockbytes)s
   (property)s   (root)t    t   endR-   s   {%s}i   N(   R   R~   R   R   R   R   R   R   R(   R   R   (   Rl   t   tabt   TYPESt   kid(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR     s    +c         C  s    |  j  d k r d St |  j   S(   s   
        Return modification time of a directory entry.

        :returns: None if modification time is null, a python datetime object
        otherwise (UTC timezone)

        new in version 0.26
        i    N(   R   Rk   R;   (   Rl   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   getmtime  s    	c         C  s    |  j  d k r d St |  j   S(   s   
        Return creation time of a directory entry.

        :returns: None if modification time is null, a python datetime object
        otherwise (UTC timezone)

        new in version 0.26
        i    N(   R   Rk   R;   (   Rl   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   getctime  s    	(   R   R   R   R   t   DIRENTRY_SIZER   t   calcsizeR$   Rm   R   R   R   R   R   R   R   R   R   (    (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR     s   	^		,						c           B  s4  e  Z d  Z d e d  Z e d  Z d   Z d   Z	 e
 d  Z d d  Z d d  Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d e
 d  Z e e
 d  Z e e
 d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! e
 d d  Z" d   Z# RS(    s  
    OLE container object

    This class encapsulates the interface to an OLE 2 structured
    storage file.  Use the :py:meth:`~PIL.OleFileIO.OleFileIO.listdir` and
    :py:meth:`~PIL.OleFileIO.OleFileIO.openstream` methods to
    access the contents of this file.

    Object names are given as a list of strings, one for each subentry
    level.  The root entry should be omitted.  For example, the following
    code extracts all image streams from a Microsoft Image Composer file::

        ole = OleFileIO("fan.mic")

        for entry in ole.listdir():
            if entry[1:2] == "Image":
                fin = ole.openstream(entry)
                fout = open(entry[0:1], "wb")
                while True:
                    s = fin.read(8192)
                    if not s:
                        break
                    fout.write(s)

    You can use the viewer application provided with the Python Imaging
    Library to view the resulting files (which happens to be standard
    TIFF files).
    c         C  s,   | |  _  g  |  _ | r( |  j |  n  d S(   s>  
        Constructor for OleFileIO class.

        :param filename: file to open.
        :param raise_defects: minimal level for defects to be raised as exceptions.
        (use DEFECT_FATAL for a typical application, DEFECT_INCORRECT for a
        security-oriented application, see source code for details)
        N(   t   _raise_defects_levelt   parsing_issuesR   (   Rl   R   t   raise_defects(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyRm     s    
		c         C  s8   | |  j  k r | |   n |  j j | | f  d S(   s  
        This method should be called for any defect found during file parsing.
        It may raise an IOError exception according to the minimal level chosen
        for the OleFileIO object.

        :param defect_level: defect level, possible values are:
            DEFECT_UNSURE    : a case which looks weird, but not sure it's a defect
            DEFECT_POTENTIAL : a potential defect
            DEFECT_INCORRECT : an error according to specifications, but parsing can go on
            DEFECT_FATAL     : an error which cannot be ignored, parsing is impossible
        :param message: string describing the defect, used with raised exception.
        :param exception_type: exception class to be raised, IOError by default
        N(   R   R   R   (   Rl   t   defect_levelt   messaget   exception_type(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR   -  s    c         C  s/  t  | d  r | |  _ n t | d  |  _ |  j j d t j  z |  j j   } Wd |  j j d  X| |  _ g  |  _ g  |  _	 |  j j
 d  } t |  d k s | d  t k r |  j t d  n  d } t j |  } t d	 | | d- f  | |  } t j | |  \ |  _ |  _ |  _ |  _ |  _ |  _ |  _ |  _ |  _ |  _ |  _ |  _ |  _ |  _  |  _! |  _" |  _# |  _$ t t j | |   |  j t k r|  j t d  n  |  j t% d  k r|  j t& d  n  t d |  j  t d |  j  |  j d. k r%|  j t& d  n  t d |  j  |  j d k rX|  j t d  n  d |  j |  _' t d |  j'  |  j' d/ k r|  j t& d  n  |  j d k r|  j' d k s|  j d k r|  j' d k r|  j t& d  n  d |  j |  _( t d |  j(  |  j( d0 k r-|  j t& d  n  |  j d k sK|  j d k r^|  j t& d  n  t d |  j  |  j' d k r|  j d k r|  j t& d   n  t d! |  j  t d" |  j  t d# |  j  |  j d k r|  j t) d$  n  t d% |  j   t d& |  j!  t d' |  j"  t d( |  j#  t d) |  j$  | |  j' d* |  j' d* |  _* t d+ |  j*  t+ | d d, ! } |  j' |  _, |  j( |  _- |  j  |  _. |  j/ |  j  |  j" r|  j/ |  j!  n  |  j$ r|  j/ |  j#  n  |  j0 |  |  j1 |  j  d |  _3 |  j! |  _4 d S(1   s   
        Open an OLE2 file.
        Reads the header, FAT and directory.

        :param filename: string-like or file-like object
        R   R   i    Ni   i   s#   not an OLE2 structured storage files   <8s16sHHHHHHLLLLLLLLLLs   fmt_header size = %d, +FAT = %dim   i   s   incorrect OLE signaturei   s   incorrect CLSID in OLE headers   MinorVersion = %ds   DllVersion   = %di   s"   incorrect DllVersion in OLE headers   ByteOrder    = %Xi  s!   incorrect ByteOrder in OLE headeri   s   SectorSize   = %di   s"   incorrect SectorSize in OLE headers2   SectorSize does not match DllVersion in OLE headers   MiniSectorSize   = %di@   s&   incorrect MiniSectorSize in OLE headers.   incorrect OLE header (non-null reserved bytes)s   csectDir     = %ds    incorrect csectDir in OLE headers   csectFat     = %ds   sectDirStart = %Xs   signature    = %ds"   incorrect OLE header (signature>0)s   MiniSectorCutoff = %ds   MiniFatStart     = %Xs   csectMiniFat     = %ds   sectDifStart     = %Xs   csectDif         = %di   s!   Number of sectors in the file: %di   i  (   i   i   (   i   i   (   i@   (5   t   hasattrR   R   R   t   ost   SEEK_ENDt   tellt	   _filesizet   _used_streams_fatt   _used_streams_minifatR   R   R   R   R   R   R   R   R   t   SigR(   t   MinorVersiont
   DllVersiont	   ByteOrdert   SectorShiftt   MiniSectorShiftt   Reservedt	   Reserved1t   csectDirt   csectFatt   sectDirStartt	   signaturet   MiniSectorCutofft   MiniFatStartt   csectMiniFatt   sectDifStartt   csectDift	   bytearrayR   t
   SectorSizet   MiniSectorSizeR   t   nb_sectR)   R   t   minisectorsizeR   R   t   loadfatt   loaddirectoryRk   t
   ministreamt   minifatsect(   Rl   R   R   R   t
   fmt_headert   header_sizet   header1R(   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR   C  s    	
			"'
~			c         C  s   |  j  j   d S(   s@   
        close the OLE file, to release the file object
        N(   R   t   close(   Rl   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR     s    c         C  s   | r  t  d |  |  j } n3 t  d |  | t t t t f k rJ d S|  j } | | k rr |  j t d  n | j	 |  d S(   s[  
        Checks if a stream has not been already referenced elsewhere.
        This method should only be called once for each known stream, and only
        if stream size is not null.
        :param first_sect: index of first sector of the stream in FAT
        :param minifat: if True, stream is located in the MiniFAT, else in the FAT
        s+   _check_duplicate_stream: sect=%d in MiniFATs'   _check_duplicate_stream: sect=%d in FATNs   Stream referenced twice(
   R   R   t   DIFSECTt   FATSECTR   t   FREESECTR   R   R   R   (   Rl   t
   first_sectR   t   used_streams(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR     s    	i    c         C  sZ  t  s
 d Sd } i d t 6d t 6d t 6d t 6} t |  } | | d | } t d d	 d
 x( t |  D] } t d | d	 d
 qm Wt   x t |  D] } | | }	 t d | |	 d	 d
 x t |	 |	 |  D]l } | | k r Pn  | | }
 |
 | k r| |
 } n# |
 | d k r-d } n
 d |
 } t | d	 d
 q Wt   q Wd S(   sC   Displays a part of FAT in human-readable form for debugging purposeNi   s   ..free..s   [ END. ]s   FATSECT s   DIFSECT i   t   indexR   R   s   %8Xs   %8X:s       --->(   R
   R   R   R   R   R   R   Ru   (   Rl   R   t
   firstindext   VPLt   fatnamest   nbsectt   nlinesRz   t   lR  R   t   nom(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   dumpfat  s8    


	
c         C  s  t  s
 d Sd } t j t |  } t |  } | | d | } t d d d x( t |  D] } t d | d d q] Wt   x t |  D] } | | }	 t d | |	 d d xO t |	 |	 |  D]: } | | k r Pn  | | }
 d |
 } t | d d q Wt   q Wd S(	   sB   Displays a sector in a human-readable form, for debugging purpose.Ni   i   R  R   R   s   %8Xs   %8X:(   R
   t   arrayt   UINT32R   R   Ru   (   Rl   t   sectorR  R  R   R  R  Rz   R  R  R   R	  (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   dumpsect<  s(    


c         C  s2   t  j  t |  } t j d k r. | j   n  | S(   s   
        convert a sector to an array of 32 bits unsigned integers,
        swapping bytes on big endian CPUs such as PowerPC (old Macs)
        t   big(   R  R  t   syst	   byteordert   byteswap(   Rl   R   t   a(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt
   sect2arrayS  s    c         C  s   t  | t j  r | } n |  j |  } |  j |  xX | D]P } | t k s\ | t k r` Pn  |  j |  } |  j |  } |  j | |  _ q> W| S(   s   
        Adds the indexes of the given sector to the FAT
        
        :param sect: string containing the first FAT sector, or array of long integers
        :returns: index of last FAT sector.
        (   t
   isinstanceR  R  R  R   R   t   getsectR   (   Rl   R   t   fat1t   isectR2   t   nextfat(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   loadfat_sect_  s    	c         C  s	  | d d !} t  d t |  t |  d f  t j t  |  _ |  j |  |  j d k r|  j d k r |  j t	 d  n  |  j
 |  j k r |  j t d  n  t  d	  |  j d d
 d } t  d |  |  j | k r t d   n  |  j
 } x| t |  D]n } t  d | | f  |  j |  } |  j |  } |  j |  |  j | d   | d } t  d |  qW| t t g k rt d   qn  t |  j  |  j k rt  d t |  j  |  j f  |  j |  j  |  _ n  t  d  |  j |  j  d S(   s%   
        Load the FAT table.
        iL   i   s   len(sect)=%d, so %d integersi   i    im   s#   incorrect DIFAT, not enough sectorss)   incorrect DIFAT, first index out of ranges   DIFAT analysis...i~   i   s   nb_difat = %ds   incorrect DIFATs   DIFAT block %d, sector %Xs   next DIFAT sector: %Xs   incorrect end of DIFATs!   len(fat)=%d, shrunk to nb_sect=%ds   
FAT:N(   R   R   R  R  R   R  R   R   R   R   R   R   R   R1   t	   iterrangeR  R  R  R   R   R
  (   Rl   R   R   t   nb_difatt   isect_difatRz   t   sector_difatt   difat(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR   }  s<    $

	
 
c         C  s  |  j  |  j } |  j j |  j d |  j } | d } t d |  j |  j  | | | f  | | k rz |  j t d  n  |  j	 |  j | d t
 j   } |  j |  |  _ t d t |  j  | f  |  j |  |  _ t d t |  j   t d  |  j |  j  d	 S(
   s)   
        Load the MiniFAT table.
        i   i   sa   loadminifat(): minifatsect=%d, nb FAT sectors=%d, used_size=%d, stream_size=%d, nb MiniSectors=%ds%   OLE MiniStream is larger than MiniFATt	   force_FATs$   MiniFAT shrunk from %d to %d sectorss   loadminifat(): len=%ds	   
MiniFAT:N(   R   R   t   rootR   R   R   R   R   R   t   _openR   R   R  R   R   R
  (   Rl   t   stream_sizet   nb_minisectorst	   used_sizeR2   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   loadminifat  s    
!
c         C  s   y |  j  j |  j | d  Wn< t d | |  j | d |  j f  |  j t d  n X|  j  j |  j  } t |  |  j k r t d | t |  |  j f  |  j t d  n  | S(   s   
        Read given sector from file on disk.
        
        :param sect: sector index
        :returns: a string containing the sector data.
        i   s(   getsect(): sect=%X, seek=%d, filesize=%ds   OLE sector index out of ranges*   getsect(): sect=%X, read=%d, sectorsize=%ds   incomplete OLE sector(	   R   R   R   R   R   R   R   R   R   (   Rl   R   R  (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR    s    c         C  s|   |  j  |  |  _ |  j j d } t d |  j j | f  d g | |  _ |  j d  } |  j d |  _ |  j j   d S(   se   
        Load the directory.
        
        :param sect: sector index of directory stream.
        i   s&   loaddirectory: size=%d, max_entries=%di    N(	   R"  t   directory_fpR   R   Rk   R   R   R!  R   (   Rl   R   t   max_entriest
   root_entry(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR      s    c         C  s   | d k  s! | t  |  j  k r4 |  j t d  n  |  j | d k	 rb |  j t d  |  j | S|  j j | d  |  j j d  } t	 | | |   |  j | <|  j | S(   sY  
        Load a directory entry from the directory.
        This method should only be called once for each storage/stream when
        loading the directory.

        :param sid: index of storage/stream in the directory.
        :returns: a _OleDirectoryEntry object
        :exception IOError: if the entry has always been referenced.
        i    s    OLE directory index out of ranges'   double reference for OLE stream/storagei   N(
   R   R   R   R   Rk   R   R'  R   R   R   (   Rl   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR   $  s    !	c         C  s   |  j  j   d S(   s5   
        Dump directory (for debugging only)
        N(   R!  R   (   Rl   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   dumpdirectory=  s    ic         C  s   t  d | | t |  f  | |  j k  r | r |  j s |  j   |  j j } t  d |  j j | f  |  j |  j j | d t	 |  _ n  t
 |  j | | d |  j |  j |  j j  St
 |  j | | d |  j |  j |  j  Sd S(   s  
        Open a stream, either in FAT or MiniFAT according to its size.
        (openstream helper)

        :param start: index of first sector
        :param size: size of stream (or nothing if size is unknown)
        :param force_FAT: if False (default), stream will be opened in FAT or MiniFAT
                   according to size. If True, it will always be opened in FAT.
        s0   OleFileIO.open(): sect=%d, size=%d, force_FAT=%ss$   Opening MiniStream: sect=%d, size=%dR   i    i   N(   R   R.   R   R   R&  R!  R   R   R"  R   R   R   R   R   R   R   R   (   Rl   t   startR   R   t   size_ministream(    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR"  D  s    
	
c         C  s   | | j  g } x~ | j D]s } | j ri | rM | j | d | j  g  n  |  j | | | | |  q | r | j | d | j  g  q q Wd S(   s  
        (listdir helper)
        :param files: list of files to fill in
        :param prefix: current location in storage tree (list of names)
        :param node: current node (_OleDirectoryEntry object)
        :param streams: bool, include streams if True (True by default) - new in v0.26
        :param storages: bool, include storages if True (False by default) - new in v0.26
        (note: the root storage is never included)
        i   N(   R   R   R   t   _list(   Rl   t   filest   prefixt   nodet   streamst   storagesR   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR-  f  s    
	c         C  s&   g  } |  j  | g  |  j | |  | S(   s'  
        Return a list of streams stored in this file

        :param streams: bool, include streams if True (True by default) - new in v0.26
        :param storages: bool, include storages if True (False by default) - new in v0.26
            (note: the root storage is never included)
        (   R-  R!  (   Rl   R1  R2  R.  (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   listdir  s    c         C  s   t  | t  r! | j d  } n  |  j } xS | D]K } x< | j D]% } | j j   | j   k rA PqA qA Wt d   | } q1 W| j S(   s(  
        Returns directory entry of given filename. (openstream helper)
        Note: this method is case-insensitive.

        :param filename: path of stream in storage tree (except root entry), either:
        
            - a string using Unix path syntax, for example:
              'storage_1/storage_1.2/stream'
            - a list of storage filenames, path to the desired stream/storage.
              Example: ['storage_1', 'storage_1.2', 'stream']
        :returns: sid of requested filename
        raise IOError if file not found
        t   /s   file not found(	   R  t
   basestringt   splitR!  R   R   R   R1   R   (   Rl   R   R0  R   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   _find  s    	
c         C  sP   |  j  |  } |  j | } | j t k r: t d   n  |  j | j | j  S(   s"  
        Open a stream as a read-only file object (BytesIO).

        :param filename: path of stream in storage tree (except root entry), either:
        
            - a string using Unix path syntax, for example:
              'storage_1/storage_1.2/stream'
            - a list of storage filenames, path to the desired stream/storage.
              Example: ['storage_1', 'storage_1.2', 'stream']
              
        :returns: file object (read-only)
        :exception IOError: if filename not found, or if this is not a stream.
        s   this file is not a stream(   R7  R   R   R   R1   R"  R   R   (   Rl   R   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt
   openstream  s
    c         C  s6   y' |  j  |  } |  j | } | j SWn t SXd S(   s  
        Test if given filename exists as a stream or a storage in the OLE
        container, and return its type.

        :param filename: path of stream in storage tree. (see openstream for syntax)
        :returns: False if object does not exist, its entry type (>0) otherwise:
        
            - STGTY_STREAM: a stream
            - STGTY_STORAGE: a storage
            - STGTY_ROOT: the root entry
        N(   R7  R   R   R   (   Rl   R   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   get_type  s    c         C  s&   |  j  |  } |  j | } | j   S(   s9  
        Return modification time of a stream/storage.

        :param filename: path of stream/storage in storage tree. (see openstream for
            syntax)
        :returns: None if modification time is null, a python datetime object
            otherwise (UTC timezone)

        new in version 0.26
        (   R7  R   R   (   Rl   R   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR     s    c         C  s&   |  j  |  } |  j | } | j   S(   s1  
        Return creation time of a stream/storage.

        :param filename: path of stream/storage in storage tree. (see openstream for
            syntax)
        :returns: None if creation time is null, a python datetime object
            otherwise (UTC timezone)

        new in version 0.26
        (   R7  R   R   (   Rl   R   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR     s    c         C  s&   y |  j  |  } t SWn t SXd S(   s   
        Test if given filename exists as a stream or a storage in the OLE
        container.

        :param filename: path of stream in storage tree. (see openstream for syntax)
        :returns: True if object exist, else False.
        N(   R7  R   R   (   Rl   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyRs     s
    c         C  sA   |  j  |  } |  j | } | j t k r: t d   n  | j S(   s1  
        Return size of a stream in the OLE container, in bytes.

        :param filename: path of stream in storage tree (see openstream for syntax)
        :returns: size in bytes (long integer)
        :exception IOError: if file not found
        :exception TypeError: if this is not a stream
        s   object is not an OLE stream(   R7  R   R   R   t	   TypeErrorR   (   Rl   R   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   get_size  s
    	c         C  s
   |  j  j S(   sp   
        Return root entry name. Should usually be 'Root Entry' or 'R' in most
        implementations.
        (   R!  R   (   Rl   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   get_rootentry_name  s    c         C  s  | d k r g  } n  | } t | t  s< d j |  } n  |  j |  } i  } y | j d  } t | d d ! } | j d  } t | d   }	 | j t | d   d | j t | j d   d  } t | d  }
 WnC t	 k
 r&} d	 t
 |  | f } |  j t | | |   | SXxt |
  D]} yd
 } t | d | d  } t | d | d  } t | |  } t d | | | f  | t k rt | | d  } | d k r| d } qn| t k rt | | d  } n| t t t f k rt | | d  } n| t t f k rGt | | d  } nn| t t f k rt | | d  } | | d | d | d !} | j d d  } n| t k rt | | d  } | | d | d | !} n| t k rt | | d  } t | | d | d | d ! } n| t k rt t | | d   t t | | d   d >} | r| | k rt d | | t |  d f  t  j  d d d d
 d
 d
  } t d | d!  | t  j! d | d  } q| d } n | t" k rt# | | d  } n | t$ k r8t | | d | d ! } n} | t% k rst | | d  } | | d | d | !} nB | t& k rt' t | | d   } n d } t d | | f  | | | <Wq4t	 k
 r} d | t
 |  | f } |  j t | | |   q4Xq4W| S("   s  
        Return properties described in substream.

        :param filename: path of stream in storage tree (see openstream for syntax)
        :param convert_time: bool, if True timestamps will be converted to Python datetime
        :param no_conversion: None or list of int, timestamps not to be converted
            (for example total editing time is not a real timestamp)
        :returns: a dictionary of values indexed by id (integer)
        R4  i   i   i   i   i   s   ****i   s6   Error while parsing properties header in stream %s: %si    i   s!   property id=%d: type=%d offset=%Xi   i   i   R"   R#   i   i    s8   Converting property #%d to python datetime, value=%d=%fsi iA  s   timedelta days=%di
   i@B i  R6   s5   property id=%d: type=%d not implemented in parser yets3   Error while parsing property id %d in stream %s: %sNi I ha   I i*   ((   Rk   R  R.   R   R8  R   R)   R   R!   t   BaseExceptionR~   R   R   Ru   R   t   VT_I2R    t   VT_UI2t   VT_I4t   VT_INTt   VT_ERRORt   VT_UI4t   VT_UINTt   VT_BSTRt   VT_LPSTRR*   t   VT_BLOBt	   VT_LPWSTRR5   t   VT_FILETIMER   t   floatR7   R8   t   VT_UI1R   t   VT_CLSIDt   VT_CFt   VT_BOOLt   bool(   Rl   R   Rn   Ro   t
   streampathR   R   R2   R(   t   fmtidt	   num_propst   excR   t   typeRz   t   idR   R{   t   countR:   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyRt     s    	&&4!c         C  s#   t    |  _ |  j j |   |  j S(   s   
        Parse standard properties streams, return an OleMetadata object
        containing all the available metadata.
        (also stored in the metadata attribute of the OleFileIO object)

        new in version 0.25
        (   R<   t   metadataR|   (   Rl   (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   get_metadata  s    N($   R   R   R   Rk   R   Rm   R1   R   R   R   R   R   R
  R  R  R  R   R&  R  R   R   R*  R"  R   R-  R3  R7  R8  R9  R   R   Rs   R;  R<  Rt   RX  (    (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyR     s:   		%			G	"		$		"								t   __main__s  
Launched from command line, this script parses OLE files and prints info.

Usage: OleFileIO_PL.py [-d] [-c] <file> [file2 ...]

Options:
-d : debug mode (display a lot of debug information, for developers only)
-c : check all streams (for debugging purposes)
s   -ds   -ct   -s   s   : propertiesRn   i2   i   s   (binary data)s      s   
Checking streams...R4  R   R   s   size %ds   NOT a stream : type=%ds5   Modification/Creation times of all directory entries:s   - %s: mtime=%s ctime=%ss   Root entry name: "%s"t   worddocuments   This is a Word document.s   type of stream 'WordDocument':s   size :s
   macros/vbas%   This document may contain VBA macros.s(   
Non-fatal issues raised during parsing:s   - %s: %sRk   (   t
   __future__R    t
   __author__t   __date__t   __version__R   R  R   R  t   os.pathR   R7   t   __all__R.   R-   R   R   t   xrangeR  Ru   t   itemsizeR  t
   ValueErrorR5  t	   NameErrort   unicodeR   R/   R
   R   R	   R   R   R   t
   MAXREGSECTR   R   R   R   t	   MAXREGSIDR   R   R   R   t   STGTY_LOCKBYTESt   STGTY_PROPERTYR   t   VT_EMPTYt   VT_NULLR>  R@  t   VT_R4t   VT_R8t   VT_CYt   VT_DATERE  t   VT_DISPATCHRB  RN  t
   VT_VARIANTt
   VT_UNKNOWNt
   VT_DECIMALt   VT_I1RK  R?  RC  t   VT_I8t   VT_UI8RA  RD  t   VT_VOIDt
   VT_HRESULTt   VT_PTRt   VT_SAFEARRAYt	   VT_CARRAYt   VT_USERDEFINEDRF  RH  RI  RG  t	   VT_STREAMt
   VT_STORAGEt   VT_STREAMED_OBJECTt   VT_STORED_OBJECTt   VT_BLOB_OBJECTRM  RL  t	   VT_VECTORt   VTt   listt   varst   itemst   keywordt   vart
   WORD_CLSIDR   R   R   R   t   keyst   keyt
   startswithR   R   R   R    R!   R)   R5   R;   R<   R   R   R   R   R   R   t   argvR   R   t   exitt   check_streamsR   R   t   oleR*  R3  t
   streamnameRt   Ry   t   sortedt   kt   vR  R   R   R~   R   R9  t   st_typeR;  R8  R   R   Rk   R   R   R   RX  t   metaR   R<  R!  Rs   R   t   exctypeR   (    (    (    s1   /usr/lib/python2.7/dist-packages/PIL/OleFileIO.pyt   <module>    sn  0	

					                                "		
		    



3+
%

!


	