Skip to content

Commit 8c25654

Browse files
authored
Merge pull request #27 from pyexcel/dev
release v0.5.8: read cell error as #N/A
2 parents c88163a + 8443709 commit 8c25654

File tree

14 files changed

+610
-39
lines changed

14 files changed

+610
-39
lines changed

.gitignore

Lines changed: 384 additions & 12 deletions
Large diffs are not rendered by default.

.moban.d/tests/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{% extends 'tests/requirements.txt.jj2' %}
22
{%block extras %}
33
pyexcel
4+
xlrd==1.1.0
45
{%endblock%}

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ notifications:
44
email: false
55
python:
66
- pypy-5.3.1
7+
- 3.7-dev
78
- 3.6
89
- 3.5
910
- 3.4

CHANGELOG.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Change log
22
================================================================================
33

4+
0.5.8 - 22.08.2018
5+
--------------------------------------------------------------------------------
6+
7+
Added
8+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9+
10+
#. `pyexcel#151 <https://github.com/pyexcel/pyexcel/issues/151>`_, read cell
11+
error as #N/A.
12+
413
0.5.7 - 15.03.2018
514
--------------------------------------------------------------------------------
615

changelog.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: pyexcel-xls
22
organisation: pyexcel
33
releases:
4+
- changes:
5+
- action: Added
6+
details:
7+
- "`pyexcel#151`, read cell error as #N/A."
8+
date: 22.08.2018
9+
version: 0.5.8
410
- changes:
511
- action: Added
612
details:

docs/source/conf.py

Lines changed: 171 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,199 @@
44
' reads xlsx and xlsm format' +
55
''
66
)
7+
# -*- coding: utf-8 -*-
8+
#
9+
# Configuration file for the Sphinx documentation builder.
10+
#
11+
# This file does only contain a selection of the most common options. For a
12+
# full list see the documentation:
13+
# http://www.sphinx-doc.org/en/master/config
14+
15+
# -- Path setup --------------------------------------------------------------
16+
17+
# If extensions (or modules to document with autodoc) are in another directory,
18+
# add these directories to sys.path here. If the directory is relative to the
19+
# documentation root, use os.path.abspath to make it absolute, like shown here.
20+
#
21+
# import os
22+
# import sys
23+
# sys.path.insert(0, os.path.abspath('.'))
24+
25+
# -- Project information -----------------------------------------------------
26+
27+
project = u'pyexcel-xls'
28+
copyright = u'2015-2018 Onni Software Ltd.'
29+
author = u'C.W.'
30+
31+
# The short X.Y version
32+
version = u'0.5.8'
33+
# The full version, including alpha/beta/rc tags
34+
release = u'0.5.8'
35+
36+
37+
# -- General configuration ---------------------------------------------------
38+
39+
# If your documentation needs a minimal Sphinx version, state it here.
40+
#
41+
# needs_sphinx = '1.0'
42+
43+
# Add any Sphinx extension module names here, as strings. They can be
44+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
45+
# ones.
746
extensions = [
847
'sphinx.ext.autodoc',
948
'sphinx.ext.doctest',
1049
'sphinx.ext.intersphinx',
1150
'sphinx.ext.viewcode',
1251
]
13-
intersphinx_mapping = {
14-
'pyexcel': ('http://pyexcel.readthedocs.io/en/latest/', None),
15-
}
52+
53+
# Add any paths that contain templates here, relative to this directory.
1654
templates_path = ['_templates']
55+
56+
# The suffix(es) of source filenames.
57+
# You can specify multiple suffix as a list of string:
58+
#
59+
# source_suffix = ['.rst', '.md']
1760
source_suffix = '.rst'
61+
62+
# The master toctree document.
1863
master_doc = 'index'
1964

20-
project = u'pyexcel-xls'
21-
copyright = u'2015-2018 Onni Software Ltd.'
22-
version = '0.5.7'
23-
release = '0.5.7'
65+
# The language for content autogenerated by Sphinx. Refer to documentation
66+
# for a list of supported languages.
67+
#
68+
# This is also used if you do content translation via gettext catalogs.
69+
# Usually you set "language" from the command line for these cases.
70+
language = 'en'
71+
72+
# List of patterns, relative to source directory, that match files and
73+
# directories to ignore when looking for source files.
74+
# This pattern also affects html_static_path and html_extra_path.
2475
exclude_patterns = []
76+
77+
# The name of the Pygments (syntax highlighting) style to use.
2578
pygments_style = 'sphinx'
26-
html_theme = 'default'
79+
80+
81+
# -- Options for HTML output -------------------------------------------------
82+
83+
# The theme to use for HTML and HTML Help pages. See the documentation for
84+
# a list of builtin themes.
85+
#
86+
html_theme = 'alabaster'
87+
88+
# Theme options are theme-specific and customize the look and feel of a theme
89+
# further. For a list of options available for each theme, see the
90+
# documentation.
91+
#
92+
# html_theme_options = {}
93+
94+
# Add any paths that contain custom static files (such as style sheets) here,
95+
# relative to this directory. They are copied after the builtin static files,
96+
# so a file named "default.css" will overwrite the builtin "default.css".
2797
html_static_path = ['_static']
98+
99+
# Custom sidebar templates, must be a dictionary that maps document names
100+
# to template names.
101+
#
102+
# The default sidebars (for documents that don't match any pattern) are
103+
# defined by theme itself. Builtin themes are using these templates by
104+
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
105+
# 'searchbox.html']``.
106+
#
107+
# html_sidebars = {}
108+
109+
110+
# -- Options for HTMLHelp output ---------------------------------------------
111+
112+
# Output file base name for HTML help builder.
28113
htmlhelp_basename = 'pyexcel-xlsdoc'
29-
latex_elements = {}
114+
115+
116+
# -- Options for LaTeX output ------------------------------------------------
117+
118+
latex_elements = {
119+
# The paper size ('letterpaper' or 'a4paper').
120+
#
121+
# 'papersize': 'letterpaper',
122+
123+
# The font size ('10pt', '11pt' or '12pt').
124+
#
125+
# 'pointsize': '10pt',
126+
127+
# Additional stuff for the LaTeX preamble.
128+
#
129+
# 'preamble': '',
130+
131+
# Latex figure (float) alignment
132+
#
133+
# 'figure_align': 'htbp',
134+
}
135+
136+
# Grouping the document tree into LaTeX files. List of tuples
137+
# (source start file, target name, title,
138+
# author, documentclass [howto, manual, or own class]).
30139
latex_documents = [
31-
('index', 'pyexcel-xls.tex',
32-
'pyexcel-xls Documentation',
33-
'Onni Software Ltd.', 'manual'),
140+
(master_doc, 'pyexcel-xls.tex', u'pyexcel-xls Documentation',
141+
u'Onni Software Ltd.', 'manual'),
34142
]
143+
144+
145+
# -- Options for manual page output ------------------------------------------
146+
147+
# One entry per manual page. List of tuples
148+
# (source start file, name, description, authors, manual section).
35149
man_pages = [
36-
('index', 'pyexcel-xls',
37-
'pyexcel-xls Documentation',
38-
[u'Onni Software Ltd.'], 1)
150+
(master_doc, 'pyexcel-xls', u'pyexcel-xls Documentation',
151+
[author], 1)
39152
]
153+
154+
155+
# -- Options for Texinfo output ----------------------------------------------
156+
157+
# Grouping the document tree into Texinfo files. List of tuples
158+
# (source start file, target name, title, author,
159+
# dir menu entry, description, category)
160+
texinfo_documents = [
161+
(master_doc, 'pyexcel-xls', u'pyexcel-xls Documentation',
162+
author, 'pyexcel-xls', 'One line description of project.',
163+
'Miscellaneous'),
164+
]
165+
166+
167+
# -- Options for Epub output -------------------------------------------------
168+
169+
# Bibliographic Dublin Core info.
170+
epub_title = project
171+
172+
# The unique identifier of the text. This can be a ISBN number
173+
# or the project homepage.
174+
#
175+
# epub_identifier = ''
176+
177+
# A unique identification for the text.
178+
#
179+
# epub_uid = ''
180+
181+
# A list of files that should not be packed into the epub file.
182+
epub_exclude_files = ['search.html']
183+
184+
# -- Extension configuration -------------------------------------------------
185+
# -- Options for intersphinx extension ---------------------------------------
186+
187+
# Example configuration for intersphinx: refer to the Python standard library.
188+
intersphinx_mapping = {'https://docs.python.org/': None}
189+
# TODO: html_theme not configurable upstream
190+
html_theme = 'default'
191+
192+
# TODO: DESCRIPTION not configurable upstream
40193
texinfo_documents = [
41194
('index', 'pyexcel-xls',
42195
'pyexcel-xls Documentation',
43196
'Onni Software Ltd.', 'pyexcel-xls',
44197
DESCRIPTION,
45198
'Miscellaneous'),
46199
]
200+
intersphinx_mapping.update({
201+
'pyexcel': ('http://pyexcel.readthedocs.io/en/latest/', None),
202+
})

pyexcel-xls.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
overrides: "pyexcel.yaml"
2+
name: "pyexcel-xls"
3+
nick_name: xls
4+
version: 0.5.8
5+
current_version: 0.5.8
6+
release: 0.5.8
7+
file_type: xls
8+
dependencies:
9+
- pyexcel-io>=0.5.3
10+
- xlrd
11+
- xlwt
12+
description: A wrapper library to read, manipulate and write data in xls format. It reads xlsx and xlsm format

pyexcel_xls/xlsr.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
'file_contents', 'encoding_override', 'formatting_info',
2222
'on_demand', 'ragged_rows'
2323
]
24+
DEFAULT_ERROR_VALUE = '#N/A'
2425

2526

2627
class MergedCell(object):
@@ -93,6 +94,9 @@ def cell_value(self, row, column):
9394
elif cell_type == xlrd.XL_CELL_NUMBER and self.__auto_detect_int:
9495
if has_no_digits_in_float(value):
9596
value = int(value)
97+
elif cell_type == xlrd.XL_CELL_ERROR:
98+
value = DEFAULT_ERROR_VALUE
99+
96100
if self.__merged_cells:
97101
merged_cell = self.__merged_cells.get("%s-%s" % (row, column))
98102
if merged_cell:

setup.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Template by setupmobans
1+
#!/usr/bin/env python3
2+
3+
# Template by pypi-mobans
24
import os
35
import sys
46
import codecs
@@ -9,26 +11,24 @@
911

1012
NAME = 'pyexcel-xls'
1113
AUTHOR = 'C.W.'
12-
VERSION = '0.5.7'
14+
VERSION = '0.5.8'
1315
1416
LICENSE = 'New BSD'
1517
DESCRIPTION = (
1618
'A wrapper library to read, manipulate and write data in xls format. It' +
1719
'reads xlsx and xlsm format'
1820
)
1921
URL = 'https://github.com/pyexcel/pyexcel-xls'
20-
DOWNLOAD_URL = '%s/archive/0.5.7.tar.gz' % URL
22+
DOWNLOAD_URL = '%s/archive/0.5.8.tar.gz' % URL
2123
FILES = ['README.rst', 'CHANGELOG.rst']
2224
KEYWORDS = [
2325
'xls',
2426
'xlsx',
25-
'xlsm'
26-
'python'
27+
'xlsm',
28+
'python',
2729
]
2830

2931
CLASSIFIERS = [
30-
'Topic :: Office/Business',
31-
'Topic :: Utilities',
3232
'Topic :: Software Development :: Libraries',
3333
'Programming Language :: Python',
3434
'Intended Audience :: Developers',
@@ -55,8 +55,8 @@
5555
# You do not need to read beyond this line
5656
PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi'.format(
5757
sys.executable)
58-
GS_COMMAND = ('gs pyexcel-xls v0.5.7 ' +
59-
"Find 0.5.7 in changelog for more details")
58+
GS_COMMAND = ('gs pyexcel-xls v0.5.8 ' +
59+
"Find 0.5.8 in changelog for more details")
6060
NO_GS_MESSAGE = ('Automatic github release is disabled. ' +
6161
'Please install gease to enable it.')
6262
UPLOAD_FAILED_MSG = (
@@ -132,7 +132,8 @@ def read_files(*files):
132132

133133
def read(afile):
134134
"""Read a file into setup"""
135-
with codecs.open(afile, 'r', 'utf-8') as opened_file:
135+
the_relative_file = os.path.join(HERE, afile)
136+
with codecs.open(the_relative_file, 'r', 'utf-8') as opened_file:
136137
content = filter_out_test_code(opened_file)
137138
content = "".join(list(content))
138139
return content

test.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
pip freeze
2-
nosetests --with-coverage --cover-package pyexcel_xls --cover-package tests --with-doctest --doctest-extension=.rst README.rst tests docs/source pyexcel_xls && flake8 . --exclude=.moban.d --builtins=unicode,xrange,long
2+
nosetests --with-coverage --cover-package pyexcel_xls --cover-package tests tests --with-doctest --doctest-extension=.rst README.rst docs/source pyexcel_xls && flake8 . --exclude=.moban.d,docs --builtins=unicode,xrange,long

test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
pip freeze
2-
nosetests --with-coverage --cover-package pyexcel_xls --cover-package tests --with-doctest --doctest-extension=.rst README.rst tests docs/source pyexcel_xls && flake8 . --exclude=.moban.d --builtins=unicode,xrange,long
2+
nosetests --with-coverage --cover-package pyexcel_xls --cover-package tests tests --with-doctest --doctest-extension=.rst README.rst docs/source pyexcel_xls && flake8 . --exclude=.moban.d,docs --builtins=unicode,xrange,long

tests/fixtures/pyexcel_issue_151.xlsx

4.36 KB
Binary file not shown.

tests/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ codecov
44
coverage
55
flake8
66
pyexcel
7+
xlrd==1.1.0

tests/test_bug_fixes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ def test_issue_20():
9292
pe.get_book(url="https://github.com/pyexcel/pyexcel-xls/raw/master/tests/fixtures/file_with_an_empty_sheet.xls"); # flake8: noqa
9393

9494

95+
def test_issue_151():
96+
s = pe.get_sheet(
97+
file_name=get_fixture('pyexcel_issue_151.xlsx'),
98+
skip_hidden_row_and_column=False,
99+
library='pyexcel-xls')
100+
eq_('#N/A', s[0,0])
101+
102+
95103
@raises(NotImplementedError)
96104
def test_empty_book_pyexcel_issue_120():
97105
"""

0 commit comments

Comments
 (0)