Coverage for pandalone\xlref\_xlrd.py : 99%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
#!/usr/bin/env python # -*- coding: UTF-8 -*- # # Copyright 2014 European Commission (JRC); # Licensed under the EUPL (the 'Licence'); # You may not use this work except in compliance with the Licence. # You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl Implements the *xlrd* backend of :term:`xl-ref` that reads in-file Excel-spreadsheets.
Prefer accessing the public members from the parent module. """
XL_CELL_BLANK, XL_CELL_ERROR, XL_CELL_BOOLEAN, XL_CELL_NUMBER)
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences else: _xlrd_0_9_3 = False
""" Parse a xl-xcell.
:param xlrd.Cell xcell: an excel xcell :type xcell: xlrd.sheet.Cell
:param epoch1904: Which date system was in force when this file was last saved. False => 1900 system (the Excel for Windows default). True => 1904 system (the Excel for Macintosh default). :type epoch1904: bool
:return: formatted xcell value :rtype: int, float, datetime.datetime, bool, None, str, datetime.time, float('nan')
Examples::
>>> import xlrd >>> from xlrd.sheet import Cell >>> _parse_cell(Cell(xlrd.XL_CELL_NUMBER, 1.2)) 1.2
>>> _parse_cell(Cell(xlrd.XL_CELL_DATE, 1.2)) datetime.datetime(1900, 1, 1, 4, 48)
>>> _parse_cell(Cell(xlrd.XL_CELL_TEXT, 'hi')) 'hi' """
# GH5394 - Excel 'numbers' are always floats # it's a minimal perf hit and less suprising # Use the newer xlrd datetime handling.
# Excel doesn't distinguish between dates and time, so we treat # dates on the epoch as times only. Also, Excel supports 1900 and # 1904 epochs. else: # Use the xlrd <= 0.9.2 date handling. else: # date
(xcell.ctype, xcell.value))
""" Wraps it into :class:`_Spreadsheet`.
:param xlrd.Sheet_sheet: """
"""See super-method. """
"""See super-method. """
|