Hello community, here is the log from the commit of package python-openpyxl for openSUSE:Factory checked in at 2019-10-10 11:47:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-openpyxl (Old) and /work/SRC/openSUSE:Factory/.python-openpyxl.new.2352 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-openpyxl" Thu Oct 10 11:47:14 2019 rev:13 rq:733341 version:2.6.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-openpyxl/python-openpyxl.changes 2019-06-17 21:35:15.202998368 +0200 +++ /work/SRC/openSUSE:Factory/.python-openpyxl.new.2352/python-openpyxl.changes 2019-10-10 11:47:15.992305164 +0200 @@ -1,0 +2,12 @@ +Thu Sep 26 07:57:23 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Update to 2.6.4: + * Cannot save workbooks with comments more than once. + * #1237 Fix 3D charts. + * #1290 Minimum for holeSize in Doughnut charts too high + * #1291 Warning for MergedCells with comments + * #1296 Pagebreaks duplicated + * #1309 Workbook has no default CellStyle + * #1330 Workbooks with comments cannot be saved multiple times + +------------------------------------------------------------------- Old: ---- openpyxl-2.6.2.tar.gz New: ---- openpyxl-2.6.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-openpyxl.spec ++++++ --- /var/tmp/diff_new_pack.yFWhDl/_old 2019-10-10 11:47:16.588303582 +0200 +++ /var/tmp/diff_new_pack.yFWhDl/_new 2019-10-10 11:47:16.592303572 +0200 @@ -18,14 +18,13 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-openpyxl -Version: 2.6.2 +Version: 2.6.4 Release: 0 Summary: A Python library to read/write Excel 2010 xlsx/xlsm files License: MIT AND Python-2.0 Group: Development/Languages/Python URL: http://openpyxl.readthedocs.org Source: https://files.pythonhosted.org/packages/source/o/openpyxl/openpyxl-%{version}.tar.gz -BuildRequires: %{python_module devel} BuildRequires: %{python_module et_xmlfile} BuildRequires: %{python_module jdcal} BuildRequires: %{python_module setuptools} ++++++ openpyxl-2.6.2.tar.gz -> openpyxl-2.6.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/AUTHORS.rst new/openpyxl-2.6.4/AUTHORS.rst --- old/openpyxl-2.6.2/AUTHORS.rst 2019-03-19 19:15:13.000000000 +0100 +++ new/openpyxl-2.6.4/AUTHORS.rst 2019-09-20 17:54:53.000000000 +0200 @@ -44,6 +44,7 @@ * JarekPS * Jean Pierre Huart * Jeff Holman +* John Woltman IV * Jonathan Peirce * Joseph Tate * Josh Haywood @@ -65,6 +66,7 @@ * Paul Van Der Linden * Philip Roche * ramn_se +* René Neumann * Rick Rankin * Samuel Loretan * Sergey Pikhovkin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/PKG-INFO new/openpyxl-2.6.4/PKG-INFO --- old/openpyxl-2.6.2/PKG-INFO 2019-03-29 15:30:36.000000000 +0100 +++ new/openpyxl-2.6.4/PKG-INFO 2019-09-25 16:16:12.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: openpyxl -Version: 2.6.2 +Version: 2.6.4 Summary: A Python library to read/write Excel 2010 xlsx/xlsm files Home-page: https://openpyxl.readthedocs.io Author: See AUTHORS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/_constants.py new/openpyxl-2.6.4/openpyxl/_constants.py --- old/openpyxl-2.6.2/openpyxl/_constants.py 2019-03-29 15:29:44.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/_constants.py 2019-09-23 16:31:11.000000000 +0200 @@ -9,4 +9,4 @@ __license__ = "MIT/Expat" __maintainer_email__ = "openpyxl-us...@googlegroups.com" __url__ = "https://openpyxl.readthedocs.io" -__version__ = "2.6.2" +__version__ = "2.6.4" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/cell/cell.py new/openpyxl-2.6.4/openpyxl/cell/cell.py --- old/openpyxl-2.6.2/openpyxl/cell/cell.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/cell/cell.py 2019-09-20 17:54:53.000000000 +0200 @@ -90,6 +90,23 @@ VALID_TYPES = (TYPE_STRING, TYPE_FORMULA, TYPE_NUMERIC, TYPE_BOOL, TYPE_NULL, TYPE_INLINE, TYPE_ERROR, TYPE_FORMULA_CACHE_STRING) + +_TYPES = {int:'n', float:'n', unicode:'s', basestring:'s', bool:'b'} + + +def get_type(t, value): + if isinstance(value, NUMERIC_TYPES): + dt = 'n' + elif isinstance(value, STRING_TYPES): + dt = 's' + elif isinstance(value, TIME_TYPES): + dt = 'd' + else: + return + _TYPES[t] = dt + return dt + + class Cell(StyleableObject): """Describes cell associated properties. @@ -192,18 +209,24 @@ self.data_type = "n" t = type(value) + try: + dt = _TYPES[t] + except KeyError: + dt = get_type(t, value) - if t in NUMERIC_TYPES: + if dt is not None: + self.data_type = dt + + if dt == 'n' or dt == 'b': pass - elif t in TIME_TYPES: + elif dt == 'd': if not is_date_format(self.number_format): self.number_format = TIME_FORMATS[t] self.data_type = "d" - elif t in STRING_TYPES: + elif dt == "s": value = self.check_string(value) - self.data_type = 's' if len(value) > 1 and value.startswith("="): self.data_type = 'f' elif value in ERROR_CODES: @@ -211,9 +234,6 @@ elif self.guess_types: # deprecated value = self._infer_value(value) - elif t is bool: - self.data_type = 'b' - elif value is not None: raise ValueError("Cannot convert {0!r} to Excel".format(value)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/cell/read_only.py new/openpyxl-2.6.4/openpyxl/cell/read_only.py --- old/openpyxl-2.6.2/openpyxl/cell/read_only.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/cell/read_only.py 2019-09-23 16:31:11.000000000 +0200 @@ -5,7 +5,7 @@ from openpyxl.utils import get_column_letter from openpyxl.utils.datetime import from_excel from openpyxl.styles import is_date_format -from openpyxl.styles.numbers import BUILTIN_FORMATS +from openpyxl.styles.numbers import BUILTIN_FORMATS, BUILTIN_FORMATS_MAX_SIZE class ReadOnlyCell(object): @@ -59,10 +59,11 @@ @property def number_format(self): _id = self.style_array.numFmtId - if _id < 164: + if _id < BUILTIN_FORMATS_MAX_SIZE: return BUILTIN_FORMATS.get(_id, "General") else: - return self.parent.parent._number_formats[_id - 164] + return self.parent.parent._number_formats[ + _id - BUILTIN_FORMATS_MAX_SIZE] @property def font(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/chart/_3d.py new/openpyxl-2.6.4/openpyxl/chart/_3d.py --- old/openpyxl-2.6.2/openpyxl/chart/_3d.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/chart/_3d.py 2019-09-20 17:54:53.000000000 +0200 @@ -78,6 +78,8 @@ Base class for 3D charts """ + tagname = "ChartBase" + view3D = Typed(expected_type=View3D, allow_none=True) floor = Typed(expected_type=Surface, allow_none=True) sideWall = Typed(expected_type=Surface, allow_none=True) @@ -87,7 +89,7 @@ view3D=None, floor=None, sideWall=None, - backWall=None + backWall=None, ): if view3D is None: view3D = View3D() @@ -101,3 +103,4 @@ if backWall is None: backWall = Surface() self.backWall = backWall + super(_3DBase, self).__init__() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/chart/_chart.py new/openpyxl-2.6.4/openpyxl/chart/_chart.py --- old/openpyxl-2.6.2/openpyxl/chart/_chart.py 2019-03-29 15:29:44.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/chart/_chart.py 2019-09-20 17:54:53.000000000 +0200 @@ -85,6 +85,7 @@ self.pivotFormats = () self.visible_cells_only = True self.idx_base = 0 + super(ChartBase, self).__init__() def __hash__(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/chart/chartspace.py new/openpyxl-2.6.4/openpyxl/chart/chartspace.py --- old/openpyxl-2.6.2/openpyxl/chart/chartspace.py 2019-03-29 15:29:44.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/chart/chartspace.py 2019-09-20 17:54:53.000000000 +0200 @@ -6,44 +6,30 @@ Will probably need to call this indirectly """ -from openpyxl.compat import unicode - from openpyxl.descriptors.serialisable import Serialisable from openpyxl.descriptors import ( - Bool, - Float, Typed, - MinMax, - Integer, - NoneSet, String, Alias, - Sequence, - Typed, ) from openpyxl.descriptors.excel import ( - Percentage, ExtensionList, Relation ) from openpyxl.descriptors.nested import ( NestedBool, NestedNoneSet, - NestedInteger, NestedString, NestedMinMax, - NestedText, ) from openpyxl.descriptors.sequence import NestedSequence from openpyxl.xml.constants import CHART_NS from openpyxl.drawing.colors import ColorMapping -from .text import Text, RichText +from .text import RichText from .shapes import GraphicalProperties from .legend import Legend -from .marker import PictureOptions, Marker -from .label import DataLabel -from ._3d import _3DBase, View3D +from ._3d import _3DBase from .plotarea import PlotArea from .title import Title from .pivot import ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/chart/label.py new/openpyxl-2.6.4/openpyxl/chart/label.py --- old/openpyxl-2.6.2/openpyxl/chart/label.py 2019-03-07 17:58:26.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/chart/label.py 2019-09-23 16:31:11.000000000 +0200 @@ -2,14 +2,9 @@ from openpyxl.descriptors.serialisable import Serialisable from openpyxl.descriptors import ( - Typed, - String, - Integer, - Bool, - Set, - Float, Sequence, - Alias + Alias, + Typed ) from openpyxl.descriptors.excel import ExtensionList from openpyxl.descriptors.nested import ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/chart/line_chart.py new/openpyxl-2.6.4/openpyxl/chart/line_chart.py --- old/openpyxl-2.6.2/openpyxl/chart/line_chart.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/chart/line_chart.py 2019-09-23 16:31:11.000000000 +0200 @@ -1,6 +1,5 @@ from __future__ import absolute_import #Autogenerated schema -from openpyxl.descriptors.serialisable import Serialisable from openpyxl.descriptors import ( Typed, Sequence, @@ -10,7 +9,6 @@ from openpyxl.descriptors.nested import ( NestedSet, NestedBool, - NestedMinMax, ) from ._chart import ChartBase diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/chart/pie_chart.py new/openpyxl-2.6.4/openpyxl/chart/pie_chart.py --- old/openpyxl-2.6.2/openpyxl/chart/pie_chart.py 2019-03-07 17:58:26.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/chart/pie_chart.py 2019-09-20 17:54:53.000000000 +0200 @@ -95,7 +95,7 @@ dLbls = _PieChartBase.dLbls firstSliceAng = NestedMinMax(min=0, max=360) - holeSize = NestedMinMax(min=10, max=90, allow_none=True) + holeSize = NestedMinMax(min=1, max=90, allow_none=True) extLst = Typed(expected_type=ExtensionList, allow_none=True) __elements__ = _PieChartBase.__elements__ + ('firstSliceAng', 'holeSize') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/chart/plotarea.py new/openpyxl-2.6.4/openpyxl/chart/plotarea.py --- old/openpyxl-2.6.2/openpyxl/chart/plotarea.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/chart/plotarea.py 2019-09-20 17:54:53.000000000 +0200 @@ -3,7 +3,6 @@ from openpyxl.descriptors.serialisable import Serialisable from openpyxl.descriptors import ( - Sequence, Typed, Alias, ) @@ -16,13 +15,9 @@ ) from openpyxl.descriptors.nested import ( NestedBool, - NestedNoneSet, - NestedInteger, - NestedString, - NestedMinMax, - NestedText, ) +from ._3d import _3DBase from .area_chart import AreaChart, AreaChart3D from .bar_chart import BarChart, BarChart3D from .bubble_chart import BubbleChart @@ -153,9 +148,11 @@ continue for axId in chart.axId: - if not axId: + axis = axes.get(axId) + if axis is None and isinstance(chart, _3DBase): + # Series Axis can be optional + chart.z_axis = None continue - axis = axes[axId] if axis.tagname in ("catAx", "dateAx"): chart.x_axis = axis elif axis.tagname == "valAx": diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/chart/reader.py new/openpyxl-2.6.4/openpyxl/chart/reader.py --- old/openpyxl-2.6.2/openpyxl/chart/reader.py 2019-03-29 15:29:44.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/chart/reader.py 2019-09-20 17:54:54.000000000 +0200 @@ -5,17 +5,6 @@ Read a chart """ -from .chartspace import ChartSpace, PlotArea -from openpyxl.xml.functions import fromstring - -_types = ('areaChart', 'area3DChart', 'lineChart', 'line3DChart', - 'stockChart', 'radarChart', 'scatterChart', 'pieChart', 'pie3DChart', - 'doughnutChart', 'barChart', 'bar3DChart', 'ofPieChart', 'surfaceChart', - 'surface3DChart', 'bubbleChart',) - -_axes = ('valAx', 'catAx', 'dateAx', 'serAx',) - - def read_chart(chartspace): cs = chartspace plot = cs.chart.plotArea diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/conftest.py new/openpyxl-2.6.4/openpyxl/conftest.py --- old/openpyxl-2.6.2/openpyxl/conftest.py 2019-03-19 19:15:13.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/conftest.py 2019-09-20 17:54:54.000000000 +0200 @@ -1,6 +1,7 @@ # Copyright (c) 2010-2019 openpyxl import pytest +import platform ### Markers ### @@ -40,3 +41,7 @@ from openpyxl import PANDAS if not PANDAS: pytest.skip("Pandas must be installed") + elif item.get_closest_marker("no_pypy"): + if platform.python_implementation() == "PyPy": + pytest.skip("Skipping pypy") + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/drawing/geometry.py new/openpyxl-2.6.4/openpyxl/drawing/geometry.py --- old/openpyxl-2.6.2/openpyxl/drawing/geometry.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/drawing/geometry.py 2019-09-20 17:54:54.000000000 +0200 @@ -475,7 +475,7 @@ gdLst = Typed(expected_type=GeomGuideList, allow_none=True) ahLst = Typed(expected_type=AdjustHandleList, allow_none=True) cxnLst = Typed(expected_type=ConnectionSiteList, allow_none=True) - rect = Typed(expected_type=GeomRect, allow_none=True) + #rect = Typed(expected_type=GeomRect, allow_none=True) pathLst = Typed(expected_type=Path2DList, ) def __init__(self, @@ -490,7 +490,7 @@ self.gdLst = gdLst self.ahLst = ahLst self.cxnLst = cxnLst - self.rect = rect + self.rect = None self.pathLst = pathLst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/drawing/spreadsheet_drawing.py new/openpyxl-2.6.4/openpyxl/drawing/spreadsheet_drawing.py --- old/openpyxl-2.6.2/openpyxl/drawing/spreadsheet_drawing.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/drawing/spreadsheet_drawing.py 2019-09-20 17:54:54.000000000 +0200 @@ -221,7 +221,7 @@ """ anchor = obj.anchor if not isinstance(anchor, _AnchorBase): - row, col = coordinate_to_tuple(anchor) + row, col = coordinate_to_tuple(anchor.upper()) anchor = OneCellAnchor() anchor._from.row = row -1 anchor._from.col = col -1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/packaging/core.py new/openpyxl-2.6.4/openpyxl/packaging/core.py --- old/openpyxl-2.6.2/openpyxl/packaging/core.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/packaging/core.py 2019-09-20 17:54:54.000000000 +0200 @@ -16,7 +16,7 @@ ) from openpyxl.descriptors.serialisable import Serialisable from openpyxl.descriptors.nested import NestedText -from openpyxl.xml.functions import (Element, tostring) +from openpyxl.xml.functions import (Element, QName, tostring) from openpyxl.xml.constants import ( COREPROPS_NS, DCORE_NS, @@ -46,7 +46,7 @@ def to_tree(self, tagname=None, value=None, namespace=None): el = super(QualifiedDateTime, self).to_tree(tagname, value, namespace) - el.set("{%s}type" % XSI_NS, "dcterms:W3CDTF") + el.set("{%s}type" % XSI_NS, QName(DCTERMS_NS, "W3CDTF")) return el diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/reader/excel.py new/openpyxl-2.6.4/openpyxl/reader/excel.py --- old/openpyxl-2.6.2/openpyxl/reader/excel.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/reader/excel.py 2019-09-20 17:54:54.000000000 +0200 @@ -37,7 +37,7 @@ XLSM, XLSX, ) - +from openpyxl.cell import MergedCell from openpyxl.comments.comment_sheet import CommentSheet from .strings import read_string_table @@ -203,6 +203,7 @@ def read_worksheets(self): + comment_warning = """Cell '{0}':{1} is part of a merged range but has a comment which will be removed because merged cells cannot contain any data.""" for sheet, rel in self.parser.find_sheets(): if rel.target not in self.valid_files: continue @@ -232,7 +233,13 @@ src = self.archive.read(r.target) comment_sheet = CommentSheet.from_tree(fromstring(src)) for ref, comment in comment_sheet.comments: - ws[ref].comment = comment + try: + ws[ref].comment = comment + except AttributeError: + c = ws[ref] + if isinstance(c, MergedCell): + warnings.warn(comment_warning.format(ws.title, c.coordinate)) + continue # preserve link to VML file if VBA if self.wb.vba_archive and ws.legacy_drawing: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/styles/named_styles.py new/openpyxl-2.6.4/openpyxl/styles/named_styles.py --- old/openpyxl-2.6.2/openpyxl/styles/named_styles.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/styles/named_styles.py 2019-09-23 16:31:11.000000000 +0200 @@ -1,7 +1,6 @@ from __future__ import absolute_import # Copyright (c) 2010-2019 openpyxl -from collections import OrderedDict from openpyxl.compat import safe_string from openpyxl.descriptors import ( @@ -21,7 +20,7 @@ from .protection import Protection from .numbers import ( NumberFormatDescriptor, - BUILTIN_FORMATS, + BUILTIN_FORMATS_MAX_SIZE, BUILTIN_FORMATS_REVERSE, ) from .cell_style import ( @@ -123,7 +122,8 @@ if fmt in BUILTIN_FORMATS_REVERSE: fmt = BUILTIN_FORMATS_REVERSE[fmt] else: - fmt = self._wb._number_formats.add(self.number_format) + 164 + fmt = self._wb._number_formats.add(self.number_format) + ( + BUILTIN_FORMATS_MAX_SIZE) self._style.numFmtId = fmt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/styles/numbers.py new/openpyxl-2.6.4/openpyxl/styles/numbers.py --- old/openpyxl-2.6.2/openpyxl/styles/numbers.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/styles/numbers.py 2019-09-23 16:31:11.000000000 +0200 @@ -52,6 +52,7 @@ 48: '##0.0E+0', 49: '@', } +BUILTIN_FORMATS_MAX_SIZE = 164 BUILTIN_FORMATS_REVERSE = dict( [(value, key) for key, value in BUILTIN_FORMATS.items()]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/styles/styleable.py new/openpyxl-2.6.4/openpyxl/styles/styleable.py --- old/openpyxl-2.6.2/openpyxl/styles/styleable.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/styles/styleable.py 2019-09-23 16:31:11.000000000 +0200 @@ -4,7 +4,11 @@ from copy import copy from warnings import warn -from .numbers import BUILTIN_FORMATS, BUILTIN_FORMATS_REVERSE +from .numbers import ( + BUILTIN_FORMATS, + BUILTIN_FORMATS_MAX_SIZE, + BUILTIN_FORMATS_REVERSE, +) from .proxy import StyleProxy from .cell_style import StyleArray from .named_styles import NamedStyle @@ -42,7 +46,8 @@ if value in BUILTIN_FORMATS_REVERSE: idx = BUILTIN_FORMATS_REVERSE[value] else: - idx = coll.add(value) + 164 + idx = coll.add(value) + BUILTIN_FORMATS_MAX_SIZE + if not getattr(instance, "_style"): instance._style = StyleArray() setattr(instance._style, self.key, idx) @@ -52,10 +57,10 @@ if not getattr(instance, "_style"): instance._style = StyleArray() idx = getattr(instance._style, self.key) - if idx < 164: + if idx < BUILTIN_FORMATS_MAX_SIZE: return BUILTIN_FORMATS.get(idx, "General") coll = getattr(instance.parent.parent, self.collection) - return coll[idx - 164] + return coll[idx - BUILTIN_FORMATS_MAX_SIZE] class NamedStyleDescriptor(object): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/styles/stylesheet.py new/openpyxl-2.6.4/openpyxl/styles/stylesheet.py --- old/openpyxl-2.6.2/openpyxl/styles/stylesheet.py 2019-03-19 19:15:13.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/styles/stylesheet.py 2019-09-23 16:31:11.000000000 +0200 @@ -1,10 +1,10 @@ # Copyright (c) 2010-2019 openpyxl +from warnings import warn + from openpyxl.descriptors.serialisable import Serialisable from openpyxl.descriptors import ( - Alias, Typed, - Sequence ) from openpyxl.descriptors.sequence import NestedSequence from openpyxl.descriptors.excel import ExtensionList @@ -12,6 +12,7 @@ from openpyxl.xml.constants import ARC_STYLE, SHEET_MAIN_NS from openpyxl.xml.functions import fromstring +from .builtins import styles from .colors import ColorList, COLOR_INDEX from .differential import DifferentialStyle from .table import TableStyleList @@ -20,15 +21,13 @@ from .fonts import Font from .numbers import ( NumberFormatList, + BUILTIN_FORMATS, + BUILTIN_FORMATS_MAX_SIZE, BUILTIN_FORMATS_REVERSE, is_date_format, builtin_format_code ) -from .alignment import Alignment -from .protection import Protection from .named_styles import ( - NamedStyle, - _NamedCellStyle, _NamedCellStyleList ) from .cell_style import CellStyle, CellStyleList @@ -125,8 +124,12 @@ named_style.font = self.fonts[xf.fontId] named_style.fill = self.fills[xf.fillId] named_style.border = self.borders[xf.borderId] - if xf.numFmtId in self.custom_formats: - named_style.number_format = self.custom_formats[xf.numFmtId] + if xf.numFmtId < BUILTIN_FORMATS_MAX_SIZE: + formats = BUILTIN_FORMATS + else: + formats = self.custom_formats + if xf.numFmtId in formats: + named_style.number_format = formats[xf.numFmtId] if xf.alignment: named_style.alignment = xf.alignment if xf.protection: @@ -161,7 +164,7 @@ if fmt in BUILTIN_FORMATS_REVERSE: # remove builtins style.numFmtId = BUILTIN_FORMATS_REVERSE[fmt] else: - style.numFmtId = formats.add(fmt) + 164 + style.numFmtId = formats.add(fmt) + BUILTIN_FORMATS_MAX_SIZE else: fmt = builtin_format_code(style.numFmtId) if is_date_format(fmt): @@ -205,6 +208,11 @@ for ns in wb._named_styles: ns.bind(wb) + if not wb._named_styles: + normal = styles['Normal'] + wb.add_named_style(normal) + warn("Workbook contains no default style, apply openpyxl's default") + if stylesheet.colors is not None: wb._colors = stylesheet.colors.index @@ -218,7 +226,7 @@ from .numbers import NumberFormat fmts = [] - for idx, code in enumerate(wb._number_formats, 164): + for idx, code in enumerate(wb._number_formats, BUILTIN_FORMATS_MAX_SIZE): fmt = NumberFormat(idx, code) fmts.append(fmt) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/workbook/workbook.py new/openpyxl-2.6.4/openpyxl/workbook/workbook.py --- old/openpyxl-2.6.2/openpyxl/workbook/workbook.py 2019-03-29 15:29:44.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/workbook/workbook.py 2019-09-20 17:54:54.000000000 +0200 @@ -217,6 +217,18 @@ self._sheets.insert(index, sheet) + def move_sheet(self, sheet, offset=0): + """ + Move a sheet or sheetname + """ + if not isinstance(sheet, Worksheet): + sheet = self[sheet] + idx = self._sheets.index(sheet) + del self._sheets[idx] + new_pos = idx + offset + self._sheets.insert(new_pos, sheet) + + def remove(self, worksheet): """Remove `worksheet` from this workbook.""" idx = self._sheets.index(worksheet) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/worksheet/_reader.py new/openpyxl-2.6.4/openpyxl/worksheet/_reader.py --- old/openpyxl-2.6.2/openpyxl/worksheet/_reader.py 2019-03-29 15:29:44.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/worksheet/_reader.py 2019-09-20 17:54:54.000000000 +0200 @@ -73,6 +73,7 @@ SCENARIOS_TAG = '{%s}scenarios' % SHEET_MAIN_NS DATA_TAG = '{%s}sheetData' % SHEET_MAIN_NS DIMENSION_TAG = '{%s}dimension' % SHEET_MAIN_NS +CUSTOM_VIEWS_TAG = '{%s}customSheetViews' % SHEET_MAIN_NS def _cast_number(value): @@ -116,6 +117,7 @@ LEGACY_TAG: self.parse_legacy, ROW_BREAK_TAG: self.parse_row_breaks, COL_BREAK_TAG: self.parse_col_breaks, + CUSTOM_VIEWS_TAG: self.parse_custom_views, } properties = { @@ -311,6 +313,11 @@ self.page_breaks.append(brk) + def parse_custom_views(self, element): + # clear page_breaks to avoid duplication + self.page_breaks = [] + + class WorksheetReader(object): """ Create a parser and apply it to a workbook diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/worksheet/_writer.py new/openpyxl-2.6.4/openpyxl/worksheet/_writer.py --- old/openpyxl-2.6.2/openpyxl/worksheet/_writer.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/worksheet/_writer.py 2019-09-23 16:31:11.000000000 +0200 @@ -47,6 +47,7 @@ def __init__(self, ws, out=None): self.ws = ws + self.ws._comments = [] if out is None: out = create_temporary_file() self.out = out diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/worksheet/copier.py new/openpyxl-2.6.4/openpyxl/worksheet/copier.py --- old/openpyxl-2.6.2/openpyxl/worksheet/copier.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/worksheet/copier.py 2019-09-20 17:54:54.000000000 +0200 @@ -9,8 +9,9 @@ class WorksheetCopy(object): """ - Copy the values, styles, dimensions and merged cells from one worksheet - to another within the same workbook. + Copy the values, styles, dimensions, merged cells, margins, and + print/page setup from one worksheet to another within the same + workbook. """ def __init__(self, source_worksheet, target_worksheet): @@ -39,6 +40,9 @@ self.target.sheet_format = copy(self.source.sheet_format) self.target.sheet_properties = copy(self.source.sheet_properties) self.target.merged_cells = copy(self.source.merged_cells) + self.target.page_margins = copy(self.source.page_margins) + self.target.page_setup = copy(self.source.page_setup) + self.target.print_options = copy(self.source.print_options) def _copy_cells(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/worksheet/pagebreak.py new/openpyxl-2.6.4/openpyxl/worksheet/pagebreak.py --- old/openpyxl-2.6.2/openpyxl/worksheet/pagebreak.py 2019-03-19 20:07:03.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/worksheet/pagebreak.py 2019-09-23 16:31:11.000000000 +0200 @@ -1,4 +1,3 @@ -from __future__ import absolute_import # Copyright (c) 2010-2019 openpyxl from openpyxl.descriptors.serialisable import Serialisable @@ -33,7 +32,7 @@ self.pt = pt -class PageBreak(Serialisable): +class RowBreak(Serialisable): tagname = "rowBreaks" @@ -82,9 +81,15 @@ self.brk = vals -RowBreak = PageBreak +PageBreak = RowBreak -class ColBreak(PageBreak): +class ColBreak(RowBreak): tagname = "colBreaks" + + count = RowBreak.count + manualBreakCount = RowBreak.manualBreakCount + brk = RowBreak.brk + + __attrs__ = RowBreak.__attrs__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl/worksheet/worksheet.py new/openpyxl-2.6.4/openpyxl/worksheet/worksheet.py --- old/openpyxl-2.6.2/openpyxl/worksheet/worksheet.py 2019-03-29 15:29:44.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl/worksheet/worksheet.py 2019-09-23 16:31:36.000000000 +0200 @@ -1,4 +1,3 @@ -from __future__ import absolute_import # Copyright (c) 2010-2019 openpyxl """Worksheet is the 2nd-level container in Excel.""" @@ -11,9 +10,9 @@ # compatibility imports from openpyxl.compat import ( - basestring, deprecated, ) + try: range = xrange except NameError: @@ -108,7 +107,7 @@ default_factory=self._add_column) self.row_breaks = RowBreak() self.col_breaks = ColBreak() - self.page_breaks = [self.row_breaks, self.col_breaks] + self.page_breaks = (self.row_breaks, self.col_breaks) self._cells = {} self._charts = [] self._images = [] @@ -652,7 +651,7 @@ elif isinstance(iterable, dict): for col_idx, content in iterable.items(): - if isinstance(col_idx, basestring): + if isinstance(col_idx, str): col_idx = column_index_from_string(col_idx) cell = Cell(self, row=row_idx, column=col_idx, value=content) self._cells[(row_idx, col_idx)] = cell @@ -715,8 +714,11 @@ self._move_cells(min_row=idx+amount, offset=-amount, row_or_col="row") + # calculating min and max col is an expensive operation, do it only once + min_col = self.min_column + max_col = self.max_column + 1 for row in remainder: - for col in range(self.min_column, self.max_column+1): + for col in range(min_col, max_col): if (row, col) in self._cells: del self._cells[row, col] self._current_row = self.max_row @@ -733,8 +735,11 @@ self._move_cells(min_col=idx+amount, offset=-amount, row_or_col="column") + # calculating min and max row is an expensive operation, do it only once + min_row = self.min_row + max_row = self.max_row + 1 for col in remainder: - for row in range(self.min_row, self.max_row+1): + for row in range(min_row, max_row): if (row, col) in self._cells: del self._cells[row, col] @@ -747,7 +752,7 @@ Existing cells will be overwritten. Formulae and references will not be updated. """ - if isinstance(cell_range, basestring): + if isinstance(cell_range, str): cell_range = CellRange(cell_range) if not isinstance(cell_range, CellRange): raise ValueError("Only CellRange objects can be moved") @@ -864,7 +869,7 @@ """ Range of cells in the form A1:D4 or list of ranges """ - if isinstance(value, basestring): + if isinstance(value, str): value = [value] self._print_area = [absolute_coordinate(v) for v in value] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.2/openpyxl.egg-info/PKG-INFO new/openpyxl-2.6.4/openpyxl.egg-info/PKG-INFO --- old/openpyxl-2.6.2/openpyxl.egg-info/PKG-INFO 2019-03-29 15:30:35.000000000 +0100 +++ new/openpyxl-2.6.4/openpyxl.egg-info/PKG-INFO 2019-09-25 16:16:12.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: openpyxl -Version: 2.6.2 +Version: 2.6.4 Summary: A Python library to read/write Excel 2010 xlsx/xlsm files Home-page: https://openpyxl.readthedocs.io Author: See AUTHORS