ó
}\c        
   @   s›  d  d l  Z  d  d l Z d  d l Z d  d l Z d d l m Z d d l m Z m Z m	 Z	 m
 Z
 m Z m Z m Z m Z m Z m Z d d l m Z m Z d d l Td d l m Z m Z d d l m Z d d	 l m Z m Z m Z d d
 l m Z e j  j! d ƒ rd  d l" Z" n  y d  d l# Z# d Z$ Wn e% k
 rHd Z$ n Xe$ Z& d e j( d e& d d e) e) e) d „	 Z* e j( e) d „ Z+ e j( d „ Z, d S(   iÿÿÿÿNi   (   t   timemachine(
   t   XL_CELL_BLANKt   XL_CELL_BOOLEANt   XL_CELL_DATEt   XL_CELL_EMPTYt   XL_CELL_ERRORt   XL_CELL_NUMBERt   XL_CELL_TEXTt	   XLRDErrort   biff_text_from_numt   error_text_from_code(   t   Bookt   colname(   t   *(   t   __VERSION__t   __version__(   t
   empty_cell(   t   XLDateErrort   xldate_as_datetimet   xldate_as_tuple(   t   X12Bookt
   IronPythoni    c	         C   sÙ  d }	 | r | |	  }
 n9 t  j j |  ƒ }  t |  d ƒ  } | j |	 ƒ }
 Wd QX|
 d k rƒ| r t j t j | ƒ ƒ } n t j |  ƒ } t	 g  | j
 ƒ  D] } t j | ƒ | f ^ qž ƒ } | rè | j d ƒ t j | | ƒ n  d | k r>d d l m } | j | | d	 | d
 | d | d | d | d | ƒ} | Sd | k rYt d ƒ ‚ n  d | k rtt d ƒ ‚ n  t d ƒ ‚ n  d d l m } | j d |  d	 | d
 | d | d | d | d | d | d | ƒ 	} | S(   sÉ  
    Open a spreadsheet file for data extraction.

    :param filename: The path to the spreadsheet file to be opened.

    :param logfile: An open file to which messages and diagnostics are written.

    :param verbosity: Increases the volume of trace material written to the
                      logfile.

    :param use_mmap:

      Whether to use the mmap module is determined heuristically.
      Use this arg to override the result.

      Current heuristic: mmap is used if it exists.

    :param file_contents:

      A string or an :class:`mmap.mmap` object or some other behave-alike
      object. If ``file_contents`` is supplied, ``filename`` will not be used,
      except (possibly) in messages.

    :param encoding_override:

      Used to overcome missing or bad codepage information
      in older-version files. See :doc:`unicode`.

    :param formatting_info:

      The default is ``False``, which saves memory.
      In this case, "Blank" cells, which are those with their own formatting
      information but no data, are treated as empty by ignoring the file's
      ``BLANK`` and ``MULBLANK`` records.
      This cuts off any bottom or right "margin" of rows of empty or blank
      cells.
      Only :meth:`~xlrd.sheet.Sheet.cell_value` and
      :meth:`~xlrd.sheet.Sheet.cell_type` are available.

      When ``True``, formatting information will be read from the spreadsheet
      file. This provides all cells, including empty and blank cells.
      Formatting information is available for each cell.

      Note that this will raise a NotImplementedError when used with an
      xlsx file.

    :param on_demand:

      Governs whether sheets are all loaded initially or when demanded
      by the caller. See :doc:`on_demand`.

    :param ragged_rows:

      The default of ``False`` means all rows are padded out with empty cells so
      that all rows have the same size as found in
      :attr:`~xlrd.sheet.Sheet.ncols`.

      ``True`` means that there are no empty cells at the ends of rows.
      This can result in substantial memory savings if rows are of widely
      varying sizes. See also the :meth:`~xlrd.sheet.Sheet.row_len` method.

    :returns: An instance of the :class:`~xlrd.book.Book` class.
    i   t   rbNs   PKs   ZIP component_names:
s   xl/workbook.xmli   (   t   xlsxt   logfilet	   verbosityt   use_mmapt   formatting_infot	   on_demandt   ragged_rowss   xl/workbook.bins#   Excel 2007 xlsb file; not supporteds   content.xmls&   Openoffice.org ODS file; not supporteds.   ZIP file contents not a known type of workbook(   t   bookt   filenamet   file_contentst   encoding_override(   t   ost   patht
   expandusert   opent   readt   zipfilet   ZipFileR    t   BYTES_IOt   dictt   namelistR   t   convert_filenamet   writet   pprintt    R   t   open_workbook_2007_xmlR   R   t   open_workbook_xls(   R   R   R   R   R    R!   R   R   R   t   peekszt   peekt   ft   zft   namet   component_namesR   t   bkR   (    (    s,   lib/python2.7/site-packages/xlrd/__init__.pyt   open_workbook!   sX    I.			c         C   sU   d d l  m } t ƒ  } | j d |  d | ƒ | | j | j | j d | | ƒ d S(   s  
    For debugging: dump an XLS file's BIFF records in char & hex.

    :param filename: The path to the file to be dumped.
    :param outfile: An open file, to which the dump is written.
    :param unnumbered: If true, omit offsets (for meaningful diffs).
    i   (   t	   biff_dumpR   R   i    N(   t   biffhR:   R   t   biff2_8_loadt   memt   baset
   stream_len(   R   t   outfilet
   unnumberedR:   R8   (    (    s,   lib/python2.7/site-packages/xlrd/__init__.pyt   dump¢   s    	c         C   sO   d d l  m } t ƒ  } | j d |  d | ƒ | | j | j | j | ƒ d S(   s  
    For debugging and analysis: summarise the file's BIFF records.
    ie: produce a sorted file of ``(record_name, count)``.

    :param filename: The path to the file to be summarised.
    :param outfile: An open file, to which the summary is written.
    i   (   t   biff_count_recordsR   R   N(   R;   RC   R   R<   R=   R>   R?   (   R   R@   RC   R8   (    (    s,   lib/python2.7/site-packages/xlrd/__init__.pyt   count_records°   s    	(-   R"   R.   t   sysR'   R/   R    R;   R   R   R   R   R   R   R   R   R	   R
   R   R   R   t   formulat   infoR   R   t   sheetR   t   xldateR   R   R   R   R   t   versiont
   startswitht	   encodingst   mmapt   MMAP_AVAILABLEt   ImportErrort   USE_MMAPt   Nonet   stdoutt   FalseR9   RB   RD   (    (    (    s,   lib/python2.7/site-packages/xlrd/__init__.pyt   <module>   s<   F


y