
k4Vdc           @  s  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 e e k	 r e Z n  y
 e Z Wn e Z n Xe j d  j d k r d Z nN e 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)e Z n Xe Z e j d d k  rLd Z n e 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 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 d- ZJ d. ZK d/ ZL d0 ZM d1 ZN d2 ZO d3 ZP d4 ZQ d5 ZR d6 ZS d7 ZT d8 ZU d9 ZV d: ZW d; ZX d< ZY i  ZZ x@ e[ e\   j]    D]) \ Z^ Z_ e^ d  d= k re^ eZ e_ <n  qWd> Z` d Za d' Zb d1 Zc d? Zd d@ Ze dA   Zf e e k rQdB   Zg n	 dC   Zg d dD  Zh d dE  Zi dF   Zj dG   Zk dH el f dI     YZm dJ e jn f dK     YZo dL el f dM     YZp dN el f dO     YZq er dP k res e jt  d k r.eu dQ e e e f  eu dR  e jv   n  e Zw xe jt d D]Zx ex dS k rde" e  qBn  ex dT k r|e Zw qBn  eq ex  Zy eu dU d7  eu ex  eu dU d7  ey jz   xMey j{   D]?Z| e| d  d dV k reu e| dW  ey j} e| dX e Z~ e e~ j]    Z~ x e~ D] \ Z Z e e e e f  r]es e  dY k rZe dY  Z n  n  e e e  rx{ d d d d d d d d d  d" dZ d# d$ d% d& d' d( d) d* d+ d, d- d. d/ d0 d1 d2 f D]" Z e e e  k rd[ Z Pn  qWn  eu d\ e e  qWn  qWew reu d]  x ey j{   D]{ Z| eu dU e d^ j e|   dU d_ d` ey j e|  Z e e- k reu da ey j e|   ey j e|  n eu db e  q%Weu   n  eu dc  xF ey j D]; Z e e k	 reu dd e j e j   e j   f  n  qWeu   ey j   Z e j   eu   ey j   Z eu de e  ey j df  reu dg  eu dh ey j df   eu di ey j df   ey j dj  reu dk  n  n  eu dl  ey j rx. ey j D]# \ Z Z eu dm e jr e f  qWn
 eu dn  qBWn  d S(o   i(   t   print_functions   Philippe Lagadecs
   2015-01-25s   0.42bNt   Li   t   It   is>   Need to fix a bug with 32 bit arrays, please contact author...i    i   s   utf-8c         C  s   t  |   d  S(   N(   t   print(   t   msg(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   debug_printN  s    c         C  s   d  S(   N(    (   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt
   debug_passR  s    c         C  s   |  a  |  r t a n t a d S(   sl   
    Set debug mode on or off, to control display of debugging messages.
    :param mode: True or False
    N(   t
   DEBUG_MODER   t   debugR   (   t
   debug_mode(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   set_debug_modeY  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@   iA   iB   iC   iD   iE   iF   iG   iH   i   t   VT_s$   00020900-0000-0000-C000-000000000046i(   i   c         C  s   t  |  d  r4 |  j t t   } |  j d  nR t |  t  rh t |   t k rh |  t t   } n t |  d  j t t   } | t k r t	 St
 Sd S(   sH  
    Test if a file is an OLE container (according to the magic bytes in its header).

    :param filename: string-like or file-like object, OLE file to parse

        - if filename is a string smaller than 1536 bytes, it is the path
          of the file to open. (bytes or unicode string)
        - if filename is a string longer than 1535 bytes, it is parsed
          as the content of an OLE file in memory. (bytes type only)
        - if filename is a file-like object (with read and seek methods),
          it is parsed as-is.

    :returns: True if OLE, False otherwise.
    t   readi    t   rbN(   t   hasattrR   t   lent   MAGICt   seekt
   isinstancet   bytest   MINIMAL_OLEFILE_SIZEt   opent   Truet   False(   t   filenamet   header(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt	   isOleFile  s    !c         C  s
   t  |   S(   N(   t   ord(   t   c(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   i8  s    c         C  s   |  j  t k r |  S|  d S(   Ni    (   t	   __class__t   int(   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR     s    c         C  s   t  j d |  | | d ! d S(   s   
    Converts a 2-bytes (16 bits) string to an integer.

    c: string containing bytes to convert
    o: offset of bytes to convert in string
    s   <Hi   i    (   t   structt   unpack(   R   t   o(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   i16  s    c         C  s   t  j d |  | | d ! d S(   s   
    Converts a 4-bytes (32 bits) string to an integer.

    c: string containing bytes to convert
    o: offset of bytes to convert in string
    s   <Ii   i    (   R!   R"   (   R   R#   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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   s    t    s   %08X-%04X-%04X-%02X%02X-s   %02Xi   i    i   i   (   R   t   AssertionErrort   stripR%   R$   t   tuplet   mapR   (   t   clsid(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   _clsid  s    'c         C  s6   t  j  d d d d d d  } | t  j d |  d  S(   sD   
    convert FILETIME (64 bits int) to Python datetime.datetime
    iA  i   i    t   microsecondsi
   (   t   datetimet	   timedelta(   t   filetimet   _FILETIME_null_date(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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   sP  
    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:
    - https://msdn.microsoft.com/en-us/library/dd942545.aspx
    - https://msdn.microsoft.com/en-us/library/dd925819%28v=office.12%29.aspx
    - https://msdn.microsoft.com/en-us/library/windows/desktop/aa380376%28v=vs.85%29.aspx
    - https://msdn.microsoft.com/en-us/library/aa372045.aspx
    - http://sedna-soft.de/articles/summary-information-stream/
    - http://poi.apache.org/apidocs/org/apache/poi/hpsf/SummaryInformation.html

    References for DocumentSummaryInformation stream:
    - https://msdn.microsoft.com/en-us/library/dd945671%28v=office.12%29.aspx
    - https://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   NoneR4   R5   R6   R7   R8   R9   R:   R;   R<   R=   R>   R?   R@   RA   RB   RC   RD   RE   RF   RG   RH   RI   R   RJ   RK   RL   RM   RN   RO   RP   RQ   RR   RS   RT   RU   RV   RW   RX   RY   RZ   R[   R\   R]   R^   R_   R`   Ra   (   t   self(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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   setattrRb   t   existst   getpropertiesR   t   rangeR   t   get(   Rc   t   olefilet   attribt   propsR   t   value(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   parse_propertiesv  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   Rg   t   getattrt   reprRh   (   Rc   t   propRq   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   dump  s    

(   t   __name__t
   __module__t   __doc__Rg   Rh   Rd   Rr   Rv   (    (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR3     s   		7	 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  sU  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 | | d @} 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(   s  
        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 sectorI    s)   incorrect last sector index in OLE streamR&   s   len(data)=%d, size=%ds%   OLE stream size is less than declaredN(   R	   R   Rt   R   R   t   IOErrort
   ENDOFCHAINRl   R   R   t   appendt
   IndexErrort   joint   sizet   iot   BytesIORd   (   Rc   t   fpt   sectR   t   offsett
   sectorsizet   fatt   filesizet   unknown_sizet
   nb_sectorst   dataR   t   sector_data(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyRd     sl    
)

(+ 
(   Rw   Rx   Ry   Rd   (    (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyRz     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  } | j |  |  _ 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   sidRn   t   kidst	   kids_dictR   t   usedR!   R"   R   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_INCORRECTt   _decode_utf16_strt   nameR	   Rt   R   t   DEFECT_UNSURER   t   longR,   R+   t   DEFECT_POTENTIALt   minisectorcutoffR   t   _check_duplicate_stream(
   Rc   t   entryR   Rn   R   t
   namelengthR+   t   sizeLowt   sizeHight   minifat(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyRd   H  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   Rt   R   R   t   NOSTREAMt   append_kidsR   t   sort(   Rc   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   build_storage_tree  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)

        :param 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   Rn   t
   direntriesR   t   DEFECT_FATALt   _load_direntryR	   R   Rt   R   R   R   R   R   t   lowerR   R   R   R}   R   R   R   (   Rc   t	   child_sidt   childt
   name_lower(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR     s(    $,
	
	c         C  s   |  j  | j  k S(   s   Compare entries by name(   R   (   Rc   t   other(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   __eq__  s    c         C  s   |  j  | j  k  S(   s   Compare entries by name(   R   (   Rc   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   __lt__  s    c         C  s   |  j  |  S(   N(   R   (   Rc   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   __ne__  s    c         C  s   |  j  |  p |  j |  S(   N(   R   R   (   Rc   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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   Rt   R   R   R   R   R   R   R+   R   Rv   (   Rc   t   tabt   TYPESt   kid(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyRv     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   Rb   R2   (   Rc   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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   Rb   R2   (   Rc   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   getctime  s    	(   Rw   Rx   Ry   R   t   DIRENTRY_SIZER!   t   calcsizeR'   Rd   R   R   R   R   R   R   Rv   R   R   (    (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR   *  s   	_		+					t	   OleFileIOc           B  sa  e  Z d  Z d$ e e e e d  Z e d  Z	 d d  Z
 e d  Z d   Z e d  Z d d	  Z d d
  Z d   Z d   Z d   Z d   Z d   Z d 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$ 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`   t  |  | |  _ g  |  _ | |  _ | |  _ d |  _ d |  _ | r\ |  j | d | n  d S(   s  
        Constructor for the OleFileIO class.

        :param filename: file to open.

            - if filename is a string smaller than 1536 bytes, it is the path
              of the file to open. (bytes or unicode string)
            - if filename is a string longer than 1535 bytes, it is parsed
              as the content of an OLE file in memory. (bytes type only)
            - if filename is a file-like object (with read, seek and tell methods),
              it is parsed as-is.

        :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)

        :param write_mode: bool, if True the file is opened in read/write mode instead
            of read-only by default.

        :param debug: bool, set debug mode

        :param path_encoding: None or str, name of the codec to use for path
            names (streams and storages), or None for Unicode.
            Unicode by default on Python 3+, UTF-8 on Python 2.x.
            (new in olefile 0.42, was hardcoded to Latin-1 until olefile v0.41)
        t
   write_modeN(	   R   t   _raise_defects_levelt   parsing_issuesR   t   path_encodingRb   t	   _filesizeR   R   (   Rc   R   t   raise_defectsR   R	   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyRd   E  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}   (   Rc   t   defect_levelt   messaget   exception_type(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR   n  s    t   replacec         C  s6   | j  d |  } |  j r. | j |  j |  S| Sd S(   s  
        Decode a string encoded in UTF-16 LE format, as found in the OLE
        directory or in property streams. Return a string encoded
        according to the path_encoding specified for the OleFileIO object.

        :param utf16_str: bytes string encoded in UTF-16 LE format
        :param errors: str, see python documentation for str.decode()
        :return: str, encoded according to path_encoding
        s   UTF-16LEN(   t   decodeR   t   encode(   Rc   t	   utf16_strt   errorst   unicode_str(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR     s    
	c   	      C  s  | |  _  t | d  r$ | |  _ n` t | t  rZ t |  t k rZ t j |  |  _ n* |  j  rl d } n d } 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 d0 k r|  j t, d  n  t d |  j  |  j d k r|  j t d  n  d |  j |  _- t d |  j-  |  j- d1 k r|  j t, d  n  |  j d k r|  j- d k s4|  j d k rG|  j- d k rG|  j t, d  n  d |  j |  _. t d |  j.  |  j. d2 k r|  j t, d  n  |  j  d k s|  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 rR|  j t/ d%  n  t d& |  j&  |  j& d k r|  j t, d'  n  t d( |  j'  t d) |  j(  t d* |  j)  t d+ |  j*  | |  j- d, |  j- d, |  _0 t d- |  j0  t1 | d d. ! |  _ |  j- |  _2 |  j. |  _3 |  j& |  _4 |  j5 |  j$  |  j( r_|  j5 |  j'  n  |  j* r{|  j5 |  j)  n  |  j6 |  |  j7 |  j$  d |  _9 |  j' |  _: d S(3   s  
        Open an OLE2 file in read-only or read/write mode.
        Read and parse the header, FAT and directory.

        :param filename: string-like or file-like object, OLE file to parse

            - if filename is a string smaller than 1536 bytes, it is the path
              of the file to open. (bytes or unicode string)
            - if filename is a string longer than 1535 bytes, it is parsed
              as the content of an OLE file in memory. (bytes type only)
            - if filename is a file-like object (with read, seek and tell methods),
              it is parsed as-is.

        :param write_mode: bool, if True the file is opened in read/write mode instead
            of read-only by default. (ignored if filename is not a path)
        R   s   r+bR   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(   incorrect MiniSectorCutoff in OLE headers   MiniFatStart     = %Xs   csectMiniFat     = %ds   sectDifStart     = %Xs   csectDif         = %di   s!   Number of sectors in the file: %di   i  (   i   i   (   i   i   (   i@   (;   R   R   R   R   R   R   R   R   R   R   R   t   ost   SEEK_ENDt   tellR   t   _used_streams_fatt   _used_streams_minifatR   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   loaddirectoryRb   t
   ministreamt   minifatsect(	   Rc   R   R   t   modeR   R   t
   fmt_headert   header_sizet   header1(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR     s    	!					"'
~			c         C  s   |  j  j   d S(   s@   
        close the OLE file, to release the file object
        N(   R   t   close(   Rc   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR   n  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(   sg  
        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: int, index of first sector of the stream in FAT
        :param minifat: bool, 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}   (   Rc   t
   first_sectR   t   used_streams(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR   t  s    		i    c         C  sd  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]v } | | k r Pn  | | }
 |
 d @} | | k r| | } n# |
 | d k r7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:I    s       --->(   R   R   R|   R   R   R   R   Rl   (   Rc   R   t
   firstindext   VPLt   fatnamest   nbsectt   nlinesR   t   lR   R   t   auxR   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   dumpfat  s:    



	
c         C  s4  t  s
 d Sd } t j t |  } t j d k r> | j   n  t |  } | | d | } t d d d x( t |  D] } t d | d d qy 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   t   bigi   R   R   R   s   %8Xs   %8X:(	   R   t   arrayt   UINT32t   syst	   byteordert   byteswapR   R   Rl   (   Rc   t   sectorR  R  R   R  R  R   R  R   R   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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)
        R	  (   R
  R  R  R  R  (   Rc   R   t   a(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt
   sect2array  s    c         C  s   t  | t j  r | } n |  j |  } |  j |  xz | D]r } | d @} t d |  | t k st | t k r t d  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.
        I    s
   isect = %Xs   found end of sector chain(	   R   R
  R  R  R	   R|   R   t   getsectR   (   Rc   R   t   fat1t   isectt   st   nextfat(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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
 } |  j d | d
 | } t  d |  |  j | k rt d   n  |  j
 } x| t |  D]n } t  d | | f  |  j |  } |  j |  } |  j |  |  j | |   | | } 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   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   R   R{   t	   iterrangeR  R  R  R|   R   R  (	   Rc   R   R   t   nb_difat_sectorst   nb_difatt   isect_difatR   t   sector_difatt   difat(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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  (   Rc   t   stream_sizet   nb_minisectorst	   used_sizeR  (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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: int, 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   (   Rc   R   R  (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR  a  s    s    c         C  s  t  | t  s t d   n  t  | t  s@ t |  d k rO t d   n  y |  j j |  j | d  Wn< t d | |  j | d |  j f  |  j	 t
 d  n Xt |  |  j k  r | | |  j t |  7} n$ t |  |  j k  rt d   n  |  j j |  d S(   s   
        Write given sector to file on disk.

        :param sect: int, sector index
        :param data: bytes, sector data
        :param padding: single byte, padding character if data < sector size
        s'   write_sect: data must be a bytes stringi   s4   write_sect: padding must be a bytes string of 1 chars+   write_sect(): sect=%X, seek=%d, filesize=%ds   OLE sector index out of ranges   Data is larger than sector sizeN(   R   R   t	   TypeErrorR   R   R   R   R	   R   R   R   t
   ValueErrort   write(   Rc   R   R   t   padding(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt
   write_sect  s    "c         C  s|   |  j  |  |  _ |  j j d } t d |  j j | f  d g | |  _ |  j d  } |  j d |  _ |  j j   d S(   s]   
        Load the directory.

        :param sect: sector index of directory stream.
        i   s&   loaddirectory: size=%d, max_entries=%di    N(	   R!  t   directory_fpR   R	   Rb   R   R   R   R   (   Rc   R   t   max_entriest
   root_entry(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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(   sZ  
        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   Rb   R   R+  R   R   R   (   Rc   R   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR     s    !	c         C  s   |  j  j   d S(   s5   
        Dump directory (for debugging only)
        N(   R   Rv   (   Rc   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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
 d |  j d | d | d d d	 |  j d
 |  j d |  j j  St
 d |  j d | d | d |  j d	 |  j d
 |  j d |  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  R   R   R   R   i    R   R   R   N(   R	   t   strR   R   R%  R   R   R   R!  R   Rz   R   R   R   R   R   R   (   Rc   t   startR   R  t   size_ministream(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR!    s"    
	
	c         C  s   | | j  g } x | j D] } | j t k ro | rS | j | d | j  g  n  |  j | | | | |  q | j t k r | r | j | d | j  g  q q |  j t d  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   sI   The directory tree contains an entry which is not a stream nor a storage.N(	   R   R   R   R   R}   t   _listR   R   R   (   Rc   t   filest   prefixt   nodet   streamst   storagesR   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR2    s    !c         C  s&   g  } |  j  | g  |  j | |  | S(   sm  
        Return a list of streams and/or storages 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)
        :returns: list of stream and/or storage paths
        (   R2  R   (   Rc   R6  R7  R3  (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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'
            - or a list of storage filenames, path to the desired stream/storage.
              Example: ['storage_1', 'storage_1.2', 'stream']

        :returns: sid of requested filename
        :exception IOError: if file not found
        t   /s   file not found(	   R   t
   basestringt   splitR   R   R   R   R{   R   (   Rc   R   R5  R   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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).
        Note: filename 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'
            - or 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(   R<  R   R   R   R{   R!  R   R   (   Rc   R   R   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt
   openstreamG  s
    c   
      C  s  t  | t  s t d   n  |  j |  } |  j | } | j t k rX t d   n  | j } | t	 |  k r t
 d   n  | |  j k  r t d   n  | j } | |  j d |  j } t d |  xt |  D] } | | d k  r/| | |  j | d |  j !}	 t	 |	  |  j k st  na | | |  j }	 t d | |  j t	 |	  | |  j f  t	 |	  |  j | |  j k st  |  j | |	  y |  j | } Wq t k
 rt d   q Xq W| t k rt d	   n  d
 S(   sD  
        Write a stream to disk. For now, it is only possible to replace an
        existing stream by data of the same size.

        :param stream_name: path of stream in storage tree (except root entry), either:

            - a string using Unix path syntax, for example:
              'storage_1/storage_1.2/stream'
            - or a list of storage filenames, path to the desired stream/storage.
              Example: ['storage_1', 'storage_1.2', 'stream']

        :param data: bytes, data to be written, must be the same size as the original
            stream.
        s)   write_stream: data must be a bytes strings   this is not a streams?   write_stream: data must be the same size as the existing streams2   Writing a stream in MiniFAT is not implemented yeti   s   nb_sectors = %dsF   write_stream: size=%d sectorsize=%d data_sector=%d size%%sectorsize=%ds,   incorrect OLE FAT, sector index out of ranges)   incorrect last sector index in OLE streamN(   R   R   R&  R<  R   R   R   R{   R   R   R'  R   t   NotImplementedErrorR   R   R	   Rl   R'   R*  R   R~   R|   (
   Rc   t   stream_nameR   R   R   R   R   R   R   t   data_sector(    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   write_stream\  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(   R<  R   R   R   (   Rc   R   R   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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
        (   R<  R   R   (   Rc   R   R   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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
        (   R<  R   R   (   Rc   R   R   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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.
        Note: filename is case-insensitive.

        :param filename: path of stream in storage tree. (see openstream for syntax)
        :returns: True if object exist, else False.
        N(   R<  R   R   (   Rc   R   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyRj     s
    	c         C  sA   |  j  |  } |  j | } | j t k r: t d   n  | j S(   s2  
        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(   R<  R   R   R   R&  R   (   Rc   R   R   R   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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   (   Rc   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-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  } nq| 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  } |  j | | 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 r;t | | d | d ! } n} | t% k rv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)
        R9  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   s    R&   i   i    s8   Converting property #%d to python datetime, value=%d=%fsi iA  s   timedelta days=%di
   i@B i  R-   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*   ((   Rb   R   R/  R   R=  R   R,   R   R%   t   BaseExceptionRt   R   R   Rl   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_LPWSTRR   t   VT_FILETIMER   t   floatR.   R/   t   VT_UI1R   t   VT_CLSIDt   VT_CFt   VT_BOOLt   bool(   Rc   R   Re   Rf   t
   streampathR   R   R  R+   t   fmtidt	   num_propst   excR   t   typeR   t   idR   Rq   t   countR1   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyRk     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
        (   R3   t   metadataRr   (   Rc   (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   get_metadata  s    N((   Rw   Rx   Ry   Rb   R   R   t   DEFAULT_PATH_ENCODINGRd   R{   R   R   R   R   R   R  R  R  R  R   R%  R  R*  R   R   R.  R!  R   R2  R8  R<  R=  RA  RB  R   R   Rj   RC  RD  Rk   R`  (    (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyR   '  sB   (	%			J	"		#		#			<						t   __main__s   olefile version %s %s - %ss@  
Launched from the command line, this script parses OLE files and prints info.

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

Options:
-d : debug mode (displays a lot of debug information, for developers only)
-c : check all streams (for debugging purposes)

For more information, see http://www.decalage.info/olefile
s   -ds   -ct   -s   s   : propertiesRe   i2   i   s   (binary data)s      s   
Checking streams...R9  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: %sRb   (   t
   __future__R    t
   __author__t   __date__t   __version__R   R  R!   R
  t   os.pathR   R.   R/  R   R    R   t   xrangeR  Rl   t   itemsizeR  R'  R:  t	   NameErrorR   t   KEEP_UNICODE_NAMESt   version_infoRa  Rb   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_NULLRF  RH  t   VT_R4t   VT_R8t   VT_CYt   VT_DATERM  t   VT_DISPATCHRJ  RV  t
   VT_VARIANTt
   VT_UNKNOWNt
   VT_DECIMALt   VT_I1RS  RG  RK  t   VT_I8t   VT_UI8RI  RL  t   VT_VOIDt
   VT_HRESULTt   VT_PTRt   VT_SAFEARRAYt	   VT_CARRAYt   VT_USERDEFINEDRN  RP  RQ  RO  t	   VT_STREAMt
   VT_STORAGEt   VT_STREAMED_OBJECTt   VT_STORED_OBJECTt   VT_BLOB_OBJECTRU  RT  t	   VT_VECTORt   VTt   listt   varst   itemst   keywordt   vart
   WORD_CLSIDR   R   R   R   R   R   R   R$   R%   R,   R2   t   objectR3   R   Rz   R   R   Rw   R   t   argvR   t   exitt   check_streamsR   t   oleR.  R8  t
   streamnameRk   Rp   t   sortedt   kt   vR   R   R   Rt   R   RB  t   st_typeRC  R=  R   R   R   R   R   R`  t   metaRv   RD  R   Rj   R   t   exctypeR   (    (    (    s[   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/PIL/OleFileIO.pyt   <module>   sn  		

			
					                                "
	!	

		    r


3+
%

!


	