Skip to content

release v0.5.8: read cell error as #N/A #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
396 changes: 384 additions & 12 deletions .gitignore

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .moban.d/tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends 'tests/requirements.txt.jj2' %}
{%block extras %}
pyexcel
xlrd==1.1.0
{%endblock%}
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ notifications:
email: false
python:
- pypy-5.3.1
- 3.7-dev
- 3.6
- 3.5
- 3.4
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Change log
================================================================================

0.5.8 - 22.08.2018
--------------------------------------------------------------------------------

Added
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. `pyexcel#151 <https://github.com/pyexcel/pyexcel/issues/151>`_, read cell
error as #N/A.

0.5.7 - 15.03.2018
--------------------------------------------------------------------------------

Expand Down
6 changes: 6 additions & 0 deletions changelog.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: pyexcel-xls
organisation: pyexcel
releases:
- changes:
- action: Added
details:
- "`pyexcel#151`, read cell error as #N/A."
date: 22.08.2018
version: 0.5.8
- changes:
- action: Added
details:
Expand Down
186 changes: 171 additions & 15 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,199 @@
' reads xlsx and xlsm format' +
''
)
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))

# -- Project information -----------------------------------------------------

project = u'pyexcel-xls'
copyright = u'2015-2018 Onni Software Ltd.'
author = u'C.W.'

# The short X.Y version
version = u'0.5.8'
# The full version, including alpha/beta/rc tags
release = u'0.5.8'


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
]
intersphinx_mapping = {
'pyexcel': ('http://pyexcel.readthedocs.io/en/latest/', None),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

project = u'pyexcel-xls'
copyright = u'2015-2018 Onni Software Ltd.'
version = '0.5.7'
release = '0.5.7'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
html_theme = 'default'


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}


# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'pyexcel-xlsdoc'
latex_elements = {}


# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'pyexcel-xls.tex',
'pyexcel-xls Documentation',
'Onni Software Ltd.', 'manual'),
(master_doc, 'pyexcel-xls.tex', u'pyexcel-xls Documentation',
u'Onni Software Ltd.', 'manual'),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'pyexcel-xls',
'pyexcel-xls Documentation',
[u'Onni Software Ltd.'], 1)
(master_doc, 'pyexcel-xls', u'pyexcel-xls Documentation',
[author], 1)
]


# -- Options for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'pyexcel-xls', u'pyexcel-xls Documentation',
author, 'pyexcel-xls', 'One line description of project.',
'Miscellaneous'),
]


# -- Options for Epub output -------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = project

# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''

# A unique identification for the text.
#
# epub_uid = ''

# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']

# -- Extension configuration -------------------------------------------------
# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
# TODO: html_theme not configurable upstream
html_theme = 'default'

# TODO: DESCRIPTION not configurable upstream
texinfo_documents = [
('index', 'pyexcel-xls',
'pyexcel-xls Documentation',
'Onni Software Ltd.', 'pyexcel-xls',
DESCRIPTION,
'Miscellaneous'),
]
intersphinx_mapping.update({
'pyexcel': ('http://pyexcel.readthedocs.io/en/latest/', None),
})
12 changes: 12 additions & 0 deletions pyexcel-xls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
overrides: "pyexcel.yaml"
name: "pyexcel-xls"
nick_name: xls
version: 0.5.8
current_version: 0.5.8
release: 0.5.8
file_type: xls
dependencies:
- pyexcel-io>=0.5.3
- xlrd
- xlwt
description: A wrapper library to read, manipulate and write data in xls format. It reads xlsx and xlsm format
4 changes: 4 additions & 0 deletions pyexcel_xls/xlsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'file_contents', 'encoding_override', 'formatting_info',
'on_demand', 'ragged_rows'
]
DEFAULT_ERROR_VALUE = '#N/A'


class MergedCell(object):
Expand Down Expand Up @@ -93,6 +94,9 @@ def cell_value(self, row, column):
elif cell_type == xlrd.XL_CELL_NUMBER and self.__auto_detect_int:
if has_no_digits_in_float(value):
value = int(value)
elif cell_type == xlrd.XL_CELL_ERROR:
value = DEFAULT_ERROR_VALUE

if self.__merged_cells:
merged_cell = self.__merged_cells.get("%s-%s" % (row, column))
if merged_cell:
Expand Down
21 changes: 11 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Template by setupmobans
#!/usr/bin/env python3

# Template by pypi-mobans
import os
import sys
import codecs
Expand All @@ -9,26 +11,24 @@

NAME = 'pyexcel-xls'
AUTHOR = 'C.W.'
VERSION = '0.5.7'
VERSION = '0.5.8'
EMAIL = '[email protected]'
LICENSE = 'New BSD'
DESCRIPTION = (
'A wrapper library to read, manipulate and write data in xls format. It' +
'reads xlsx and xlsm format'
)
URL = 'https://github.com/pyexcel/pyexcel-xls'
DOWNLOAD_URL = '%s/archive/0.5.7.tar.gz' % URL
DOWNLOAD_URL = '%s/archive/0.5.8.tar.gz' % URL
FILES = ['README.rst', 'CHANGELOG.rst']
KEYWORDS = [
'xls',
'xlsx',
'xlsm'
'python'
'xlsm',
'python',
]

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

def read(afile):
"""Read a file into setup"""
with codecs.open(afile, 'r', 'utf-8') as opened_file:
the_relative_file = os.path.join(HERE, afile)
with codecs.open(the_relative_file, 'r', 'utf-8') as opened_file:
content = filter_out_test_code(opened_file)
content = "".join(list(content))
return content
Expand Down
2 changes: 1 addition & 1 deletion test.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pip freeze
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
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
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pip freeze
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
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
Binary file added tests/fixtures/pyexcel_issue_151.xlsx
Binary file not shown.
1 change: 1 addition & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ codecov
coverage
flake8
pyexcel
xlrd==1.1.0
8 changes: 8 additions & 0 deletions tests/test_bug_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ def test_issue_20():
pe.get_book(url="https://github.com/pyexcel/pyexcel-xls/raw/master/tests/fixtures/file_with_an_empty_sheet.xls"); # flake8: noqa


def test_issue_151():
s = pe.get_sheet(
file_name=get_fixture('pyexcel_issue_151.xlsx'),
skip_hidden_row_and_column=False,
library='pyexcel-xls')
eq_('#N/A', s[0,0])


@raises(NotImplementedError)
def test_empty_book_pyexcel_issue_120():
"""
Expand Down