Hello community, here is the log from the commit of package python-agate-excel for openSUSE:Factory checked in at 2019-02-27 15:10:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-agate-excel (Old) and /work/SRC/openSUSE:Factory/.python-agate-excel.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-agate-excel" Wed Feb 27 15:10:24 2019 rev:2 rq:679762 version:0.2.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-agate-excel/python-agate-excel.changes 2018-05-29 16:47:48.345685290 +0200 +++ /work/SRC/openSUSE:Factory/.python-agate-excel.new.28833/python-agate-excel.changes 2019-02-27 15:10:27.982367529 +0100 @@ -1,0 +2,8 @@ +Wed Feb 27 09:04:34 UTC 2019 - Tomáš Chvátal <[email protected]> + +- Switch to github tarball and enable tests +- Add patches from upstream git to pass the tests: + * no-column.patch + * row-offset.patch + +------------------------------------------------------------------- @@ -12 +19,0 @@ - Old: ---- agate-excel-0.2.2.tar.gz New: ---- 0.2.2.tar.gz no-column.patch row-offset.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-agate-excel.spec ++++++ --- /var/tmp/diff_new_pack.70wHxD/_old 2019-02-27 15:10:29.318367097 +0100 +++ /var/tmp/diff_new_pack.70wHxD/_new 2019-02-27 15:10:29.318367097 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-agate-excel # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,33 +12,31 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_with test Name: python-agate-excel Version: 0.2.2 Release: 0 -License: MIT Summary: Read support for Excel files (xls and xlsx) for agate -Url: http://agate-excel.readthedocs.org/ +License: MIT Group: Development/Languages/Python -Source: https://files.pythonhosted.org/packages/source/a/agate-excel/agate-excel-%{version}.tar.gz -BuildRequires: %{python_module devel} -BuildRequires: %{python_module setuptools} -BuildRequires: fdupes -BuildRequires: python-rpm-macros -%if %{with test} +URL: https://github.com/wireservice/agate-excel +Source: https://github.com/wireservice/agate-excel/archive/%{version}.tar.gz +Patch0: no-column.patch +Patch1: row-offset.patch BuildRequires: %{python_module agate >= 1.5.0} BuildRequires: %{python_module openpyxl >= 2.3.0} +BuildRequires: %{python_module setuptools} BuildRequires: %{python_module xlrd >= 0.9.4} -%endif +BuildRequires: fdupes +BuildRequires: python-rpm-macros Requires: python-agate >= 1.5.0 Requires: python-openpyxl >= 2.3.0 Requires: python-xlrd >= 0.9.4 BuildArch: noarch - %python_subpackages %description @@ -47,6 +45,8 @@ %prep %setup -q -n agate-excel-%{version} +%autopatch -p1 + sed -i -e '/^#!\//, 1d' agateexcel/*.py %build @@ -56,13 +56,10 @@ %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} -%if %{with test} %check %python_exec setup.py test -%endif %files %{python_files} -%defattr(-,root,root,-) %doc AUTHORS.rst README.rst %license COPYING %{python_sitelib}/* ++++++ agate-excel-0.2.2.tar.gz -> 0.2.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/.gitignore new/agate-excel-0.2.2/.gitignore --- old/agate-excel-0.2.2/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/agate-excel-0.2.2/.gitignore 2018-01-28 06:46:44.000000000 +0100 @@ -0,0 +1,12 @@ +.DS_Store +*.pyc +*.swp +*.swo +.tox +*.egg-info +docs/_build +dist +.coverage +build +.proof +.test.png diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/.travis.yml new/agate-excel-0.2.2/.travis.yml --- old/agate-excel-0.2.2/.travis.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/agate-excel-0.2.2/.travis.yml 2018-01-28 06:46:44.000000000 +0100 @@ -0,0 +1,12 @@ +language: python +python: + - "2.7" + - "3.3" + - "3.4" + - "3.5" +# command to install dependencies +install: + - if [[ $TRAVIS_PYTHON_VERSION == 3* ]]; then pip install -r requirements-py3.txt; else pip install -r requirements-py2.txt; fi +# command to run tests +script: nosetests tests +sudo: false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/CHANGELOG.rst new/agate-excel-0.2.2/CHANGELOG.rst --- old/agate-excel-0.2.2/CHANGELOG.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/agate-excel-0.2.2/CHANGELOG.rst 2018-01-28 06:46:44.000000000 +0100 @@ -0,0 +1,29 @@ +0.2.2 +----- + +* Add an ``encoding_override`` argument to :meth:`.Table.from_xls` to override the encoding of the input XLS file. +* Add a ``header`` argument to :meth:`.Table.from_xls` and :meth:`.Table.from_xlsx` to indicate the presence of a header row. +* Add a ``read_only`` argument to :meth:`.Table.from_xlsx` to allow disabling read-only mode for `some spreadsheets <https://openpyxl.readthedocs.io/en/default/optimized.html#worksheet-dimensions>`_. + +0.2.1 - February 28, 2017 +------------------------- + +* Overload :meth:`.Table.from_xls` and :meth:`.Table.from_xlsx` to accept and return multiple sheets. +* Add a ``skip_lines`` argument to :meth:`.Table.from_xls` and :meth:`.Table.from_xlsx` to skip rows from the top of the sheet. +* Fix bug in handling ambiguous dates in XLS. (#9) +* Fix bug in handling an empty XLS. +* Fix bug in handling non-string column names in XLSX. + +0.2.0 +----- + +* Fix bug in handling of ``None`` in boolean columns for XLS. (#11) +* Removed usage of deprecated openpyxl method ``get_sheet_by_name``. +* Remove monkeypatching. +* Upgrade required agate version to ``1.5.0``. +* Ensure columns with numbers for names (e.g. years) are parsed as strings. + +0.1.0 +----- + +* Initial version. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/PKG-INFO new/agate-excel-0.2.2/PKG-INFO --- old/agate-excel-0.2.2/PKG-INFO 2018-01-28 06:53:10.000000000 +0100 +++ new/agate-excel-0.2.2/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,51 +0,0 @@ -Metadata-Version: 1.1 -Name: agate-excel -Version: 0.2.2 -Summary: agate-excel adds read support for Excel files (xls and xlsx) to agate. -Home-page: http://agate-excel.readthedocs.org/ -Author: Christopher Groskopf -Author-email: [email protected] -License: MIT -Description: .. image:: https://travis-ci.org/wireservice/agate-excel.png - :target: https://travis-ci.org/wireservice/agate-excel - :alt: Build status - - .. image:: https://img.shields.io/pypi/v/agate-excel.svg - :target: https://pypi.python.org/pypi/agate-excel - :alt: Version - - .. image:: https://img.shields.io/pypi/l/agate-excel.svg - :target: https://pypi.python.org/pypi/agate-excel - :alt: License - - .. image:: https://img.shields.io/pypi/pyversions/agate-excel.svg - :target: https://pypi.python.org/pypi/agate-excel - :alt: Support Python versions - - agate-excel adds read support for Excel files (xls and xlsx) to `agate <https://github.com/wireservice/agate>`_. - - Important links: - - * agate http://agate.rtfd.org - * Documentation: http://agate-excel.rtfd.org - * Repository: https://github.com/wireservice/agate-excel - * Issues: https://github.com/wireservice/agate-excel/issues - -Platform: UNKNOWN -Classifier: Development Status :: 4 - Beta -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: Science/Research -Classifier: License :: OSI Approved :: MIT License -Classifier: Natural Language :: English -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Multimedia :: Graphics -Classifier: Topic :: Scientific/Engineering :: Information Analysis -Classifier: Topic :: Scientific/Engineering :: Visualization -Classifier: Topic :: Software Development :: Libraries :: Python Modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/agate_excel.egg-info/PKG-INFO new/agate-excel-0.2.2/agate_excel.egg-info/PKG-INFO --- old/agate-excel-0.2.2/agate_excel.egg-info/PKG-INFO 2018-01-28 06:53:10.000000000 +0100 +++ new/agate-excel-0.2.2/agate_excel.egg-info/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,51 +0,0 @@ -Metadata-Version: 1.1 -Name: agate-excel -Version: 0.2.2 -Summary: agate-excel adds read support for Excel files (xls and xlsx) to agate. -Home-page: http://agate-excel.readthedocs.org/ -Author: Christopher Groskopf -Author-email: [email protected] -License: MIT -Description: .. image:: https://travis-ci.org/wireservice/agate-excel.png - :target: https://travis-ci.org/wireservice/agate-excel - :alt: Build status - - .. image:: https://img.shields.io/pypi/v/agate-excel.svg - :target: https://pypi.python.org/pypi/agate-excel - :alt: Version - - .. image:: https://img.shields.io/pypi/l/agate-excel.svg - :target: https://pypi.python.org/pypi/agate-excel - :alt: License - - .. image:: https://img.shields.io/pypi/pyversions/agate-excel.svg - :target: https://pypi.python.org/pypi/agate-excel - :alt: Support Python versions - - agate-excel adds read support for Excel files (xls and xlsx) to `agate <https://github.com/wireservice/agate>`_. - - Important links: - - * agate http://agate.rtfd.org - * Documentation: http://agate-excel.rtfd.org - * Repository: https://github.com/wireservice/agate-excel - * Issues: https://github.com/wireservice/agate-excel/issues - -Platform: UNKNOWN -Classifier: Development Status :: 4 - Beta -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: Science/Research -Classifier: License :: OSI Approved :: MIT License -Classifier: Natural Language :: English -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Multimedia :: Graphics -Classifier: Topic :: Scientific/Engineering :: Information Analysis -Classifier: Topic :: Scientific/Engineering :: Visualization -Classifier: Topic :: Software Development :: Libraries :: Python Modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/agate_excel.egg-info/SOURCES.txt new/agate-excel-0.2.2/agate_excel.egg-info/SOURCES.txt --- old/agate-excel-0.2.2/agate_excel.egg-info/SOURCES.txt 2018-01-28 06:53:10.000000000 +0100 +++ new/agate-excel-0.2.2/agate_excel.egg-info/SOURCES.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -AUTHORS.rst -COPYING -MANIFEST.in -README.rst -setup.cfg -setup.py -agate_excel.egg-info/PKG-INFO -agate_excel.egg-info/SOURCES.txt -agate_excel.egg-info/dependency_links.txt -agate_excel.egg-info/requires.txt -agate_excel.egg-info/top_level.txt -agateexcel/__init__.py -agateexcel/table_xls.py -agateexcel/table_xlsx.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/agate_excel.egg-info/dependency_links.txt new/agate-excel-0.2.2/agate_excel.egg-info/dependency_links.txt --- old/agate-excel-0.2.2/agate_excel.egg-info/dependency_links.txt 2018-01-28 06:53:10.000000000 +0100 +++ new/agate-excel-0.2.2/agate_excel.egg-info/dependency_links.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/agate_excel.egg-info/requires.txt new/agate-excel-0.2.2/agate_excel.egg-info/requires.txt --- old/agate-excel-0.2.2/agate_excel.egg-info/requires.txt 2018-01-28 06:53:10.000000000 +0100 +++ new/agate-excel-0.2.2/agate_excel.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -agate>=1.5.0 -xlrd>=0.9.4 -openpyxl>=2.3.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/agate_excel.egg-info/top_level.txt new/agate-excel-0.2.2/agate_excel.egg-info/top_level.txt --- old/agate-excel-0.2.2/agate_excel.egg-info/top_level.txt 2018-01-28 06:53:10.000000000 +0100 +++ new/agate-excel-0.2.2/agate_excel.egg-info/top_level.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -agateexcel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/docs/Makefile new/agate-excel-0.2.2/docs/Makefile --- old/agate-excel-0.2.2/docs/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ new/agate-excel-0.2.2/docs/Makefile 2018-01-28 06:46:44.000000000 +0100 @@ -0,0 +1,130 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest + +help: + @echo "Please use \`make <target>' where <target> is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/agateexcel.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/agateexcel.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/agateexcel" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/agateexcel" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + make -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/docs/conf.py new/agate-excel-0.2.2/docs/conf.py --- old/agate-excel-0.2.2/docs/conf.py 1970-01-01 01:00:00.000000000 +0100 +++ new/agate-excel-0.2.2/docs/conf.py 2018-01-28 06:46:44.000000000 +0100 @@ -0,0 +1,227 @@ +# -*- coding: utf-8 -*- +# +# flake8: noqa +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import os +import sys + +# 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. +sys.path.insert(0, os.path.abspath('..')) + +# -- 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.intersphinx'] +autodoc_member_order = 'bysource' + +intersphinx_mapping = { + 'python': ('http://docs.python.org/3.5/', None), + 'agate': ('http://agate.readthedocs.org/en/latest/', None) +} + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'agate-excel' +copyright = u'2017, Christopher Groskopf' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '0.2.2' +# The full version, including alpha/beta/rc tags. +release = '0.2.2' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- 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 = 'default' + +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + +if not on_rtd: # only import and set the theme if we're building docs locally + import sphinx_rtd_theme + html_theme = 'sphinx_rtd_theme' + html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + +# 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 themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# "<project> v<release> documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# 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'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'agateexceldoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'agate-excel.tex', u'agate-excel Documentation', + u'Christopher Groskopf', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ +] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/docs/index.rst new/agate-excel-0.2.2/docs/index.rst --- old/agate-excel-0.2.2/docs/index.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/agate-excel-0.2.2/docs/index.rst 2018-01-28 06:46:44.000000000 +0100 @@ -0,0 +1,77 @@ +===================== +agate-excel |release| +===================== + +.. include:: ../README.rst + +Install +======= + +To install: + +.. code-block:: bash + + pip install agate-excel + +For details on development or supported platforms see the `agate documentation <http://agate.readthedocs.org>`_. + +Usage +===== + +agate-excel uses a monkey patching pattern to add read for xls and xlsx files support to all :class:`agate.Table <agate.table.Table>` instances. + +.. code-block:: python + + import agate + import agateexcel + +Importing agate-excel adds methods to :class:`agate.Table <agate.table.Table>`. Once you've imported it, you can create tables from both XLS and XLSX files. + +.. code-block:: python + + table = agate.Table.from_xls('examples/test.xls') + print(table) + + table = agate.Table.from_xlsx('examples/test.xlsx') + print(table) + + table = agate.Table.from_xlsx('examples/test.xlsx', sheet=1) + print(table) + + table = agate.Table.from_xlsx('examples/test.xlsx', sheet='dummy') + print(table) + + table = agate.Table.from_xlsx('examples/test.xlsx', sheet=[1, 'dummy']) + print(table) + +Both ``Table`` methods accept a :code:`sheet` argument to specify which sheet to create the table from. + +=== +API +=== + +.. autofunction:: agateexcel.table_xls.from_xls + +.. autofunction:: agateexcel.table_xlsx.from_xlsx + +Authors +======= + +.. include:: ../AUTHORS.rst + +Changelog +========= + +.. include:: ../CHANGELOG.rst + +License +======= + +.. include:: ../COPYING + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/example.py new/agate-excel-0.2.2/example.py --- old/agate-excel-0.2.2/example.py 1970-01-01 01:00:00.000000000 +0100 +++ new/agate-excel-0.2.2/example.py 2018-01-28 06:46:44.000000000 +0100 @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +import agate +import agateexcel # noqa + +table = agate.Table.from_xls('examples/test.xls') + +print(table) + +table = agate.Table.from_xlsx('examples/test.xlsx') + +print(table) +table.print_table() Binary files old/agate-excel-0.2.2/examples/test.xls and new/agate-excel-0.2.2/examples/test.xls differ Binary files old/agate-excel-0.2.2/examples/test.xlsx and new/agate-excel-0.2.2/examples/test.xlsx differ Binary files old/agate-excel-0.2.2/examples/test_ambiguous_date.xls and new/agate-excel-0.2.2/examples/test_ambiguous_date.xls differ Binary files old/agate-excel-0.2.2/examples/test_ambiguous_date.xlsx and new/agate-excel-0.2.2/examples/test_ambiguous_date.xlsx differ Binary files old/agate-excel-0.2.2/examples/test_empty.xls and new/agate-excel-0.2.2/examples/test_empty.xls differ Binary files old/agate-excel-0.2.2/examples/test_empty.xlsx and new/agate-excel-0.2.2/examples/test_empty.xlsx differ Binary files old/agate-excel-0.2.2/examples/test_numeric_column_name.xls and new/agate-excel-0.2.2/examples/test_numeric_column_name.xls differ Binary files old/agate-excel-0.2.2/examples/test_numeric_column_name.xlsx and new/agate-excel-0.2.2/examples/test_numeric_column_name.xlsx differ Binary files old/agate-excel-0.2.2/examples/test_sheets.xls and new/agate-excel-0.2.2/examples/test_sheets.xls differ Binary files old/agate-excel-0.2.2/examples/test_sheets.xlsx and new/agate-excel-0.2.2/examples/test_sheets.xlsx differ Binary files old/agate-excel-0.2.2/examples/test_skip_lines.xls and new/agate-excel-0.2.2/examples/test_skip_lines.xls differ Binary files old/agate-excel-0.2.2/examples/test_skip_lines.xlsx and new/agate-excel-0.2.2/examples/test_skip_lines.xlsx differ Binary files old/agate-excel-0.2.2/examples/test_zeros.xls and new/agate-excel-0.2.2/examples/test_zeros.xls differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/requirements-py2.txt new/agate-excel-0.2.2/requirements-py2.txt --- old/agate-excel-0.2.2/requirements-py2.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/agate-excel-0.2.2/requirements-py2.txt 2018-01-28 06:46:44.000000000 +0100 @@ -0,0 +1,10 @@ +unittest2==0.5.1 +nose>=1.1.2 +tox>=1.3 +Sphinx>=1.2.2 +sphinx_rtd_theme>=0.1.6 +wheel>=0.24.0 +ordereddict>=1.1 +xlrd>=0.9.4 +openpyxl>=2.3.0 +agate>=1.2.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/requirements-py3.txt new/agate-excel-0.2.2/requirements-py3.txt --- old/agate-excel-0.2.2/requirements-py3.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/agate-excel-0.2.2/requirements-py3.txt 2018-01-28 06:46:44.000000000 +0100 @@ -0,0 +1,8 @@ +nose>=1.1.2 +tox>=1.3 +Sphinx>=1.2.2 +sphinx_rtd_theme>=0.1.6 +wheel>=0.24.0 +xlrd>=0.9.4 +openpyxl>=2.3.0 +agate>=1.2.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/setup.cfg new/agate-excel-0.2.2/setup.cfg --- old/agate-excel-0.2.2/setup.cfg 2018-01-28 06:53:10.000000000 +0100 +++ new/agate-excel-0.2.2/setup.cfg 2018-01-28 06:46:44.000000000 +0100 @@ -1,7 +1,2 @@ [bdist_wheel] universal = 1 - -[egg_info] -tag_build = -tag_date = 0 - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/tests/test_table_xls.py new/agate-excel-0.2.2/tests/test_table_xls.py --- old/agate-excel-0.2.2/tests/test_table_xls.py 1970-01-01 01:00:00.000000000 +0100 +++ new/agate-excel-0.2.2/tests/test_table_xls.py 2018-01-28 06:46:44.000000000 +0100 @@ -0,0 +1,126 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- + +import datetime + +import agate +import agateexcel # noqa + + +class TestXLS(agate.AgateTestCase): + def setUp(self): + self.rows = ( + (1, 'a', True, '11/4/2015', '11/4/2015 12:22 PM'), + (2, u'👍', False, '11/5/2015', '11/4/2015 12:45 PM'), + (None, 'b', None, None, None), + ) + + self.column_names = [ + 'number', 'text', 'boolean', 'date', 'datetime', + ] + + self.column_types = [ + agate.Number(), agate.Text(), agate.Boolean(), + agate.Date(), agate.DateTime(), + ] + + self.table = agate.Table(self.rows, self.column_names, self.column_types) + + def test_from_xls(self): + table = agate.Table.from_xls('examples/test.xls') + + self.assertColumnNames(table, self.column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + + def test_file_like(self): + with open('examples/test.xls', 'rb') as f: + table = agate.Table.from_xls(f) + + self.assertColumnNames(table, self.column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + + def test_sheet_name(self): + table = agate.Table.from_xls('examples/test_sheets.xls', 'data') + + self.assertColumnNames(table, self.column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + + def test_sheet_index(self): + table = agate.Table.from_xls('examples/test_sheets.xls', 1) + + self.assertColumnNames(table, self.column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + + def test_sheet_multiple(self): + tables = agate.Table.from_xls('examples/test_sheets.xls', ['not this sheet', 1]) + + self.assertEqual(len(tables), 2) + + table = tables['not this sheet'] + self.assertColumnNames(table, []) + self.assertColumnTypes(table, []) + self.assertRows(table, []) + + table = tables['data'] + self.assertColumnNames(table, self.column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + + def test_skip_lines(self): + table = agate.Table.from_xls('examples/test_skip_lines.xls', skip_lines=3) + + self.assertColumnNames(table, self.column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + + def test_header(self): + table = agate.Table.from_xls('examples/test_zeros.xls', header=False) + + self.assertColumnNames(table, ('a', 'b', 'c')) + self.assertColumnTypes(table, [agate.Text, agate.Text, agate.Text]) + self.assertRows(table, [ + ['ordinal', 'binary', 'all_zero'], + ['0.0', '0.0', '0.0'], + ['1.0', '1.0', '0.0'], + ['2.0', '1.0', '0.0'], + ]) + + def test_zeros(self): + table = agate.Table.from_xls('examples/test_zeros.xls') + + self.assertColumnNames(table, ['ordinal', 'binary', 'all_zero']) + self.assertColumnTypes(table, [agate.Number, agate.Number, agate.Number]) + self.assertRows(table, [ + [0, 0, 0], + [1, 1, 0], + [2, 1, 0], + ]) + + def test_ambiguous_date(self): + table = agate.Table.from_xls('examples/test_ambiguous_date.xls') + + self.assertColumnNames(table, ['s']) + self.assertColumnTypes(table, [agate.Date]) + self.assertRows(table, [ + [datetime.date(1900, 1, 1)], + ]) + + def test_empty(self): + table = agate.Table.from_xls('examples/test_empty.xls') + + self.assertColumnNames(table, []) + self.assertColumnTypes(table, []) + self.assertRows(table, []) + + def test_numeric_column_name(self): + table = agate.Table.from_xls('examples/test_numeric_column_name.xls') + + self.assertColumnNames(table, ('Country', '2013.0', 'c')) + self.assertColumnTypes(table, [agate.Text, agate.Number, agate.Text]) + self.assertRows(table, [ + ['Canada', 35160000, 'value'], + ]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/tests/test_table_xlsx.py new/agate-excel-0.2.2/tests/test_table_xlsx.py --- old/agate-excel-0.2.2/tests/test_table_xlsx.py 1970-01-01 01:00:00.000000000 +0100 +++ new/agate-excel-0.2.2/tests/test_table_xlsx.py 2018-01-28 06:46:44.000000000 +0100 @@ -0,0 +1,115 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- + +import datetime + +import agate +import agateexcel # noqa + + +class TestXLSX(agate.AgateTestCase): + def setUp(self): + self.rows = ( + (1, 'a', True, '11/4/2015', '11/4/2015 12:22 PM'), + (2, u'👍', False, '11/5/2015', '11/4/2015 12:45 PM'), + (None, 'b', None, None, None), + ) + + self.column_names = [ + 'number', 'text', 'boolean', 'date', 'datetime', + ] + + self.column_types = [ + agate.Number(), agate.Text(), agate.Boolean(), + agate.Date(), agate.DateTime(), + ] + + self.table = agate.Table(self.rows, self.column_names, self.column_types) + + def test_from_xlsx(self): + table = agate.Table.from_xlsx('examples/test.xlsx') + + self.assertColumnNames(table, self.column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + + def test_file_like(self): + with open('examples/test.xlsx', 'rb') as f: + table = agate.Table.from_xlsx(f) + + self.assertColumnNames(table, self.column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + + def test_sheet_name(self): + table = agate.Table.from_xlsx('examples/test_sheets.xlsx', 'data') + + self.assertColumnNames(table, self.column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + + def test_sheet_index(self): + table = agate.Table.from_xlsx('examples/test_sheets.xlsx', 1) + + self.assertColumnNames(table, self.column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + + def test_sheet_multiple(self): + tables = agate.Table.from_xlsx('examples/test_sheets.xlsx', ['not this sheet', 1]) + + self.assertEqual(len(tables), 2) + + table = tables['not this sheet'] + self.assertColumnNames(table, []) + self.assertColumnTypes(table, []) + self.assertRows(table, []) + + table = tables['data'] + self.assertColumnNames(table, self.column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + + def test_skip_lines(self): + table = agate.Table.from_xlsx('examples/test_skip_lines.xlsx', skip_lines=3) + + self.assertColumnNames(table, self.column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + + def test_header(self): + table = agate.Table.from_xls('examples/test_zeros.xls', header=False) + + self.assertColumnNames(table, ('a', 'b', 'c')) + self.assertColumnTypes(table, [agate.Text, agate.Text, agate.Text]) + self.assertRows(table, [ + ['ordinal', 'binary', 'all_zero'], + ['0.0', '0.0', '0.0'], + ['1.0', '1.0', '0.0'], + ['2.0', '1.0', '0.0'], + ]) + + def test_ambiguous_date(self): + table = agate.Table.from_xlsx('examples/test_ambiguous_date.xlsx') + + self.assertColumnNames(table, ['s']) + self.assertColumnTypes(table, [agate.Date]) + self.assertRows(table, [ + [datetime.date(1899, 12, 31)], + ]) + + def test_empty(self): + table = agate.Table.from_xlsx('examples/test_empty.xlsx') + + self.assertColumnNames(table, []) + self.assertColumnTypes(table, []) + self.assertRows(table, []) + + def test_numeric_column_name(self): + table = agate.Table.from_xlsx('examples/test_numeric_column_name.xlsx') + + self.assertColumnNames(table, ['Country', '2013', 'c']) + self.assertColumnTypes(table, [agate.Text, agate.Number, agate.Text]) + self.assertRows(table, [ + ['Canada', 35160000, 'value'], + ]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agate-excel-0.2.2/tox.ini new/agate-excel-0.2.2/tox.ini --- old/agate-excel-0.2.2/tox.ini 1970-01-01 01:00:00.000000000 +0100 +++ new/agate-excel-0.2.2/tox.ini 2018-01-28 06:46:44.000000000 +0100 @@ -0,0 +1,28 @@ +[tox] +envlist = py27,py33,py34,py35,pypy + +[testenv] +deps= + nose>=1.1.2 + six>=1.6.1 +commands=nosetests + +[testenv:py27] +deps= + {[testenv]deps} + +[testenv:py33] +deps= + {[testenv]deps} + +[testenv:py34] +deps= + {[testenv:py33]deps} + +[testenv:py35] +deps= + {[testenv:py33]deps} + +[testenv:pypy] +deps= + {[testenv:py33]deps} ++++++ no-column.patch ++++++ >From 2d05fec80a844ee36e66f0395389609115a06774 Mon Sep 17 00:00:00 2001 From: Jani Mikkonen <[email protected]> Date: Fri, 30 Nov 2018 11:56:23 +0200 Subject: [PATCH] Allow passing column_names without throwing Fixes #24 --- agateexcel/table_xls.py | 5 +++++ agateexcel/table_xlsx.py | 5 +++++ tests/test_table_xls.py | 11 +++++++++++ tests/test_table_xlsx.py | 11 +++++++++++ 4 files changed, 32 insertions(+) diff --git a/agateexcel/table_xls.py b/agateexcel/table_xls.py index 19612c6..9fb9c4a 100644 --- a/agateexcel/table_xls.py +++ b/agateexcel/table_xls.py @@ -83,6 +83,11 @@ def from_xls(cls, path, sheet=None, skip_lines=0, header=True, encoding_override for i in range(len(columns[0])): rows.append([c[i] for c in columns]) + if 'column_names' in kwargs: + if not header: + column_names = kwargs.get('column_names', None) + del kwargs['column_names'] + tables[sheet.name] = agate.Table(rows, column_names, **kwargs) if multiple: diff --git a/agateexcel/table_xlsx.py b/agateexcel/table_xlsx.py index 87619e9..37afd71 100644 --- a/agateexcel/table_xlsx.py +++ b/agateexcel/table_xlsx.py @@ -82,6 +82,11 @@ def from_xlsx(cls, path, sheet=None, skip_lines=0, header=True, read_only=True, rows.append(values) + if 'column_names' in kwargs: + if not header: + column_names = kwargs.get('column_names', None) + del kwargs['column_names'] + tables[sheet.title] = agate.Table(rows, column_names, **kwargs) f.close() diff --git a/tests/test_table_xls.py b/tests/test_table_xls.py index cc7b3e8..6d02d74 100644 --- a/tests/test_table_xls.py +++ b/tests/test_table_xls.py @@ -19,6 +19,10 @@ def setUp(self): 'number', 'text', 'boolean', 'date', 'datetime', ] + self.user_provided_column_names = [ + 'alt number', 'alt text', 'alt boolean', 'alt date', 'alt datetime', + ] + self.column_types = [ agate.Number(), agate.Text(), agate.Boolean(), agate.Date(), agate.DateTime(), @@ -26,6 +30,13 @@ def setUp(self): self.table = agate.Table(self.rows, self.column_names, self.column_types) + def test_from_xls_with_column_names(self): + table = agate.Table.from_xls('examples/test.xls', header=False, skip_lines=1, column_names=self.user_provided_column_names ) + + self.assertColumnNames(table, self.user_provided_column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + def test_from_xls(self): table = agate.Table.from_xls('examples/test.xls') diff --git a/tests/test_table_xlsx.py b/tests/test_table_xlsx.py index 6dd4434..9b56b9b 100644 --- a/tests/test_table_xlsx.py +++ b/tests/test_table_xlsx.py @@ -19,6 +19,10 @@ def setUp(self): 'number', 'text', 'boolean', 'date', 'datetime', ] + self.user_provided_column_names = [ + 'number', 'text', 'boolean', 'date', 'datetime', + ] + self.column_types = [ agate.Number(), agate.Text(), agate.Boolean(), agate.Date(), agate.DateTime(), @@ -26,6 +30,13 @@ def setUp(self): self.table = agate.Table(self.rows, self.column_names, self.column_types) + def test_from_xlsx_with_column_names(self): + table = agate.Table.from_xlsx('examples/test.xlsx', header=False, skip_lines=1, column_names=self.user_provided_column_names) + + self.assertColumnNames(table, self.user_provided_column_names) + self.assertColumnTypes(table, [agate.Number, agate.Text, agate.Boolean, agate.Date, agate.DateTime]) + self.assertRows(table, [r.values() for r in self.table.rows]) + def test_from_xlsx(self): table = agate.Table.from_xlsx('examples/test.xlsx') ++++++ row-offset.patch ++++++ >From d1007ec796624be62c44a5e4aded36d5a510d19b Mon Sep 17 00:00:00 2001 From: Tim Freund <[email protected]> Date: Tue, 19 Feb 2019 15:43:29 -0500 Subject: [PATCH] Update iter_rows row_offset to min_row This fixes issue #26. Openpyxl removed row_offset in favor of min_row and max_row parameters. The rows are indexed starting at 1 rather than 0, so passing min_row=1 will retrieve all rows. --- agateexcel/table_xlsx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 agateexcel/table_xlsx.py diff --git a/agateexcel/table_xlsx.py b/agateexcel/table_xlsx.py old mode 100644 new mode 100755 index 87619e9..f1e1df8 --- a/agateexcel/table_xlsx.py +++ b/agateexcel/table_xlsx.py @@ -57,7 +57,7 @@ def from_xlsx(cls, path, sheet=None, skip_lines=0, header=True, read_only=True, column_names = None rows = [] - for i, row in enumerate(sheet.iter_rows(row_offset=skip_lines)): + for i, row in enumerate(sheet.iter_rows(min_row=skip_lines+1)): if i == 0 and header: column_names = [None if c.value is None else six.text_type(c.value) for c in row] continue
