Hello community, here is the log from the commit of package python-openpyxl for openSUSE:Factory checked in at 2019-06-17 21:34:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-openpyxl (Old) and /work/SRC/openSUSE:Factory/.python-openpyxl.new.4811 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-openpyxl" Mon Jun 17 21:34:37 2019 rev:12 rq:710331 version:2.6.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-openpyxl/python-openpyxl.changes 2019-03-12 09:54:50.991520895 +0100 +++ /work/SRC/openSUSE:Factory/.python-openpyxl.new.4811/python-openpyxl.changes 2019-06-17 21:35:15.202998368 +0200 @@ -1,0 +2,11 @@ +Mon Jun 17 11:00:03 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Update to 2.6.2: + * #1173 Workbook has no _date_formats attribute + * #1190 Cannot create charts for worksheets with quotes in the title + * #1228 MergedCells not removed when range is unmerged + * #1232 Link to pivot table lost from charts + * #1233 Chart colours change after saving + * #1236 Cannot use ws.cell in read-only mode with Python 2.7 + +------------------------------------------------------------------- Old: ---- openpyxl-2.6.1.tar.gz New: ---- openpyxl-2.6.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-openpyxl.spec ++++++ --- /var/tmp/diff_new_pack.NEy8sD/_old 2019-06-17 21:35:15.682998259 +0200 +++ /var/tmp/diff_new_pack.NEy8sD/_new 2019-06-17 21:35:15.686998258 +0200 @@ -18,12 +18,12 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-openpyxl -Version: 2.6.1 +Version: 2.6.2 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 +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} @@ -36,7 +36,6 @@ # for embedded image support Recommends: python-Pillow BuildArch: noarch - %python_subpackages %description ++++++ openpyxl-2.6.1.tar.gz -> openpyxl-2.6.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/PKG-INFO new/openpyxl-2.6.2/PKG-INFO --- old/openpyxl-2.6.1/PKG-INFO 2019-03-04 13:10:58.000000000 +0100 +++ new/openpyxl-2.6.2/PKG-INFO 2019-03-29 15:30:36.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: openpyxl -Version: 2.6.1 +Version: 2.6.2 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.1/openpyxl/_constants.py new/openpyxl-2.6.2/openpyxl/_constants.py --- old/openpyxl-2.6.1/openpyxl/_constants.py 2019-03-04 12:58:56.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/_constants.py 2019-03-29 15:29:44.000000000 +0100 @@ -9,4 +9,4 @@ __license__ = "MIT/Expat" __maintainer_email__ = "openpyxl-us...@googlegroups.com" __url__ = "https://openpyxl.readthedocs.io" -__version__ = "2.6.1" +__version__ = "2.6.2" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/cell/_writer.py new/openpyxl-2.6.2/openpyxl/cell/_writer.py --- old/openpyxl-2.6.1/openpyxl/cell/_writer.py 2019-02-27 20:14:09.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/cell/_writer.py 2019-03-29 15:29:44.000000000 +0100 @@ -2,7 +2,7 @@ # Copyright (c) 2010-2019 openpyxl from openpyxl.compat import safe_string -from openpyxl.xml.functions import Element, SubElement +from openpyxl.xml.functions import Element, SubElement, whitespace, XML_NS, REL_NS from openpyxl import LXML from openpyxl.utils.datetime import to_excel, days_to_time from datetime import timedelta @@ -59,6 +59,8 @@ inline_string = SubElement(el, 'is') text = SubElement(inline_string, 't') text.text = value + whitespace(text) + else: cell_content = SubElement(el, 'v') @@ -85,8 +87,14 @@ if cell.data_type == 's': with xf.element("is"): - with xf.element("t"): - xf.write(value) + attrs = {} + if value != value.strip(): + attrs["{%s}space" % XML_NS] = "preserve" + el = Element("t", attrs) # lxml can't handle xml-ns + el.text = value + xf.write(el) + #with xf.element("t", attrs): + #xf.write(value) else: with xf.element("v"): if value is not None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/chart/_chart.py new/openpyxl-2.6.2/openpyxl/chart/_chart.py --- old/openpyxl-2.6.1/openpyxl/chart/_chart.py 2019-02-27 19:47:44.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/chart/_chart.py 2019-03-29 15:29:44.000000000 +0100 @@ -51,7 +51,7 @@ layout = Typed(expected_type=Layout, allow_none=True) roundedCorners = Bool(allow_none=True) axId = ValueSequence(expected_type=int) - visible_cells_only = Bool() + visible_cells_only = Bool(allow_none=True) display_blanks = Set(values=['span', 'gap', 'zero']) _series_type = "" @@ -81,6 +81,10 @@ self.plot_area = PlotArea() self.axId = axId self.display_blanks = 'gap' + self.pivotSource = None + self.pivotFormats = () + self.visible_cells_only = True + self.idx_base = 0 def __hash__(self): @@ -111,7 +115,7 @@ from .chartspace import ChartSpace, ChartContainer self.plot_area.layout = self.layout - idx_base = 0 + idx_base = self.idx_base for chart in self._charts: if chart not in self.plot_area._charts: chart.idx_base = idx_base @@ -126,9 +130,11 @@ container.backWall = chart.backWall container.plotVisOnly = self.visible_cells_only container.dispBlanksAs = self.display_blanks + container.pivotFmts = self.pivotFormats cs = ChartSpace(chart=container) cs.style = self.style cs.roundedCorners = self.roundedCorners + cs.pivotSource = self.pivotSource return cs.to_tree() @@ -164,10 +170,9 @@ else: values = data.cols - for v in values: - range_string = u"{0}!{1}:{2}".format(data.sheetname, v[0], v[-1]) - series = SeriesFactory(range_string, title_from_data=titles_from_data) - self.ser.append(series) + for ref in values: + series = SeriesFactory(ref, title_from_data=titles_from_data) + self.series.append(series) def append(self, value): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/chart/chartspace.py new/openpyxl-2.6.2/openpyxl/chart/chartspace.py --- old/openpyxl-2.6.1/openpyxl/chart/chartspace.py 2019-02-27 19:47:44.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/chart/chartspace.py 2019-03-29 15:29:44.000000000 +0100 @@ -34,6 +34,7 @@ NestedMinMax, NestedText, ) +from openpyxl.descriptors.sequence import NestedSequence from openpyxl.xml.constants import CHART_NS from openpyxl.drawing.colors import ColorMapping @@ -45,61 +46,20 @@ from ._3d import _3DBase, View3D from .plotarea import PlotArea from .title import Title +from .pivot import ( + PivotFormat, + PivotSource, +) from .print_settings import PrintSettings -class PivotFormat(Serialisable): - - tagname = "pivotFmt" - - idx = NestedInteger(nested=True) - spPr = Typed(expected_type=GraphicalProperties, allow_none=True) - graphicalProperties = Alias("spPr") - txPr = Typed(expected_type=RichText, allow_none=True) - TextBody = Alias("txPr") - marker = Typed(expected_type=Marker, allow_none=True) - dLbl = Typed(expected_type=DataLabel, allow_none=True) - DataLabel = Alias("dLbl") - extLst = Typed(expected_type=ExtensionList, allow_none=True) - - __elements__ = ('idx', 'spPr', 'txPr', 'marker', 'dLbl') - - def __init__(self, - idx=0, - spPr=None, - txPr=None, - marker=None, - dLbl=None, - extLst=None, - ): - self.idx = idx - self.spPr = spPr - self.txPr = txPr - self.marker = marker - self.dLbl = dLbl - - -class PivotFormatList(Serialisable): - - tagname = "pivotFmts" - - pivotFmt = Sequence(expected_type=PivotFormat, allow_none=True) - - __elements__ = ('pivotFmt',) - - def __init__(self, - pivotFmt=(), - ): - self.pivotFmt = pivotFmt - - class ChartContainer(Serialisable): tagname = "chart" title = Typed(expected_type=Title, allow_none=True) autoTitleDeleted = NestedBool(allow_none=True) - pivotFmts = Typed(expected_type=PivotFormatList, allow_none=True) + pivotFmts = NestedSequence(expected_type=PivotFormat) view3D = _3DBase.view3D floor = _3DBase.floor sideWall = _3DBase.sideWall @@ -118,7 +78,7 @@ def __init__(self, title=None, autoTitleDeleted=None, - pivotFmts=None, + pivotFmts=(), view3D=None, floor=None, sideWall=None, @@ -172,25 +132,6 @@ self.userInterface = userInterface -class PivotSource(Serialisable): - - tagname = "pivotSource" - - name = NestedText(expected_type=unicode) - fmtId = NestedInteger(expected_type=int) - extLst = Typed(expected_type=ExtensionList, allow_none=True) - - __elements__ = ('name', 'fmtId') - - def __init__(self, - name=None, - fmtId=None, - extLst=None, - ): - self.name = name - self.fmtId = fmtId - - class ExternalData(Serialisable): tagname = "externalData" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/chart/pivot.py new/openpyxl-2.6.2/openpyxl/chart/pivot.py --- old/openpyxl-2.6.1/openpyxl/chart/pivot.py 1970-01-01 01:00:00.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/chart/pivot.py 2019-03-29 15:29:44.000000000 +0100 @@ -0,0 +1,66 @@ +from __future__ import absolute_import +# Copyright (c) 2010-2019 openpyxl + +from openpyxl.compat import unicode +from openpyxl.descriptors.serialisable import Serialisable +from openpyxl.descriptors import ( + Alias, + Typed, +) +from openpyxl.descriptors.nested import NestedInteger, NestedText +from openpyxl.descriptors.excel import ExtensionList + +from .label import DataLabel +from .marker import Marker +from .shapes import GraphicalProperties +from .text import RichText + + +class PivotSource(Serialisable): + + tagname = "pivotSource" + + name = NestedText(expected_type=unicode) + fmtId = NestedInteger(expected_type=int) + extLst = Typed(expected_type=ExtensionList, allow_none=True) + + __elements__ = ('name', 'fmtId') + + def __init__(self, + name=None, + fmtId=None, + extLst=None, + ): + self.name = name + self.fmtId = fmtId + + +class PivotFormat(Serialisable): + + tagname = "pivotFmt" + + idx = NestedInteger(nested=True) + spPr = Typed(expected_type=GraphicalProperties, allow_none=True) + graphicalProperties = Alias("spPr") + txPr = Typed(expected_type=RichText, allow_none=True) + TextBody = Alias("txPr") + marker = Typed(expected_type=Marker, allow_none=True) + dLbl = Typed(expected_type=DataLabel, allow_none=True) + DataLabel = Alias("dLbl") + extLst = Typed(expected_type=ExtensionList, allow_none=True) + + __elements__ = ('idx', 'spPr', 'txPr', 'marker', 'dLbl') + + def __init__(self, + idx=0, + spPr=None, + txPr=None, + marker=None, + dLbl=None, + extLst=None, + ): + self.idx = idx + self.spPr = spPr + self.txPr = txPr + self.marker = marker + self.dLbl = dLbl diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/chart/reader.py new/openpyxl-2.6.2/openpyxl/chart/reader.py --- old/openpyxl-2.6.1/openpyxl/chart/reader.py 2019-02-27 19:47:44.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/chart/reader.py 2019-03-29 15:29:44.000000000 +0100 @@ -33,5 +33,8 @@ chart.floor = cs.chart.floor chart.sideWall = cs.chart.sideWall chart.backWall = cs.chart.backWall + chart.pivotSource = cs.pivotSource + chart.pivotFormats = cs.chart.pivotFmts + chart.idx_base = min(s.idx for s in chart.series) return chart diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/chart/reference.py new/openpyxl-2.6.2/openpyxl/chart/reference.py --- old/openpyxl-2.6.1/openpyxl/chart/reference.py 2019-02-27 20:14:09.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/chart/reference.py 2019-03-29 15:29:44.000000000 +0100 @@ -87,39 +87,33 @@ return 1 + self.max_row - self.min_row + def __eq__(self, other): + return str(self) == str(other) + + @property def rows(self): """ - Return all cells in range by column + Return all rows in the range """ for row in range(self.min_row, self.max_row+1): - yield tuple('%s%d' % (get_column_letter(col), row) - for col in range(self.min_col, self.max_col+1)) + yield Reference(self.worksheet, self.min_col, row, self.max_col, row) @property def cols(self): """ - Return all cells in range by row + Return all columns in the range """ for col in range(self.min_col, self.max_col+1): - yield tuple('%s%d' % (get_column_letter(col), row) - for row in range(self.min_row, self.max_row+1)) - - - @property - def cells(self): - """ - Return a flattened list of all cells (by column) - """ - return chain.from_iterable(self.cols) + yield Reference(self.worksheet, col, self.min_row, col, self.max_row) def pop(self): """ Return and remove the first cell """ - cell = next(self.cells) + cell = "{0}{1}".format(get_column_letter(self.min_col), self.min_row) if self.min_row == self.max_row: self.min_col += 1 else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/descriptors/nested.py new/openpyxl-2.6.2/openpyxl/descriptors/nested.py --- old/openpyxl-2.6.1/openpyxl/descriptors/nested.py 2019-02-27 19:47:44.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/descriptors/nested.py 2019-03-29 15:29:44.000000000 +0100 @@ -18,7 +18,7 @@ ) from .sequence import Sequence from openpyxl.compat import safe_string -from openpyxl.xml.functions import Element, localname +from openpyxl.xml.functions import Element, localname, whitespace class Nested(Descriptor): @@ -73,6 +73,7 @@ tagname = "{%s}%s" % (namespace, tagname) el = Element(tagname) el.text = safe_string(value) + whitespace(el) return el diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/packaging/manifest.py new/openpyxl-2.6.2/openpyxl/packaging/manifest.py --- old/openpyxl-2.6.1/openpyxl/packaging/manifest.py 2019-03-04 12:58:56.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/packaging/manifest.py 2019-03-29 15:29:44.000000000 +0100 @@ -4,7 +4,7 @@ """ File manifest """ -import mimetypes +from mimetypes import MimeTypes import os.path from openpyxl.descriptors.serialisable import Serialisable @@ -40,8 +40,7 @@ from openpyxl.xml.functions import tostring # initialise mime-types -if not mimetypes.inited: - mimetypes.init() +mimetypes = MimeTypes() mimetypes.add_type('application/xml', ".xml") mimetypes.add_type('application/vnd.openxmlformats-package.relationships+xml', ".rels") mimetypes.add_type("application/vnd.ms-office.vbaProject", ".bin") @@ -120,7 +119,7 @@ Skip parts without extensions """ exts = set([os.path.splitext(part.PartName)[-1] for part in self.Override]) - return [(ext[1:], mimetypes.types_map[ext]) for ext in sorted(exts) if ext] + return [(ext[1:], mimetypes.types_map[True][ext]) for ext in sorted(exts) if ext] def to_tree(self): @@ -192,7 +191,7 @@ ext = os.path.splitext(fn)[-1] if not ext: continue - mime = mimetypes.types_map[ext] + mime = mimetypes.types_map[True][ext] fe = FileExtension(ext[1:], mime) self.Default.append(fe) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/workbook/workbook.py new/openpyxl-2.6.2/openpyxl/workbook/workbook.py --- old/openpyxl-2.6.1/openpyxl/workbook/workbook.py 2019-02-27 20:14:09.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/workbook/workbook.py 2019-03-29 15:29:44.000000000 +0100 @@ -75,7 +75,6 @@ self.loaded_theme = None self.vba_archive = None self.is_template = False - self._differential_styles = DifferentialStyleList() self.code_name = None self.epoch = CALENDAR_WINDOWS_1900 self.encoding = "utf-8" @@ -105,6 +104,7 @@ self._fills.add(DEFAULT_GRAY_FILL) self._number_formats = IndexedList() + self._date_formats = {} self._protections = IndexedList([Protection()]) @@ -113,6 +113,7 @@ self._named_styles = NamedStyleList() self.add_named_style(NamedStyle(font=copy(DEFAULT_FONT), builtinId=0)) self._table_styles = TableStyleList() + self._differential_styles = DifferentialStyleList() @property diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/worksheet/_read_only.py new/openpyxl-2.6.2/openpyxl/worksheet/_read_only.py --- old/openpyxl-2.6.1/openpyxl/worksheet/_read_only.py 2019-03-04 12:58:56.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/worksheet/_read_only.py 2019-03-29 15:29:44.000000000 +0100 @@ -17,10 +17,6 @@ _min_row = 1 _max_column = _max_row = None - cell = Worksheet.cell - __iter__ = Worksheet.__iter__ - - def __init__(self, parent_workbook, title, worksheet_path, shared_strings): self.parent = parent_workbook self.title = title @@ -33,10 +29,17 @@ self.iter_rows = Worksheet.iter_rows.__get__(self) self.values = Worksheet.values.__get__(self) self.rows = Worksheet.rows.__get__(self) + self.cell = Worksheet.cell.__get__(self) + + + def __iter__(self): + # 2.7 compat + meth = Worksheet.__iter__.__get__(self) + return meth() def __getitem__(self, key): - # use protected method from Worksheet + # 2.7 compat meth = Worksheet.__getitem__.__get__(self) return meth(key) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/worksheet/_reader.py new/openpyxl-2.6.2/openpyxl/worksheet/_reader.py --- old/openpyxl-2.6.1/openpyxl/worksheet/_reader.py 2019-03-04 12:58:56.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/worksheet/_reader.py 2019-03-29 15:29:44.000000000 +0100 @@ -351,9 +351,9 @@ def bind_merged_cells(self): if not self.parser.merged_cells: return - self.ws.merged_cells.ranges = self.parser.merged_cells.mergeCell + for cr in self.parser.merged_cells.mergeCell: - self.ws._clean_merge_range(cr) + self.ws.merge_cells(cr.ref) def bind_hyperlinks(self): @@ -365,7 +365,10 @@ # range of cells for row in self.ws[link.ref]: for cell in row: - cell.hyperlink = link + try: + cell.hyperlink = link + except AttributeError: + pass else: self.ws[link.ref].hyperlink = link diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/worksheet/cell_range.py new/openpyxl-2.6.2/openpyxl/worksheet/cell_range.py --- old/openpyxl-2.6.1/openpyxl/worksheet/cell_range.py 2019-02-27 20:14:09.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/worksheet/cell_range.py 2019-03-29 15:29:44.000000000 +0100 @@ -93,6 +93,23 @@ max_row=self.max_row ) + @property + def rows(self): + """ + Return cell coordinates as rows + """ + for row in range(self.min_row, self.max_row+1): + yield [(row, col) for col in range(self.min_col, self.max_col+1)] + + + @property + def cols(self): + """ + Return cell coordinates as columns + """ + for col in range(self.min_col, self.max_col+1): + yield [(row, col) for row in range(self.min_row, self.max_row+1)] + def _check_title(self, other): """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/worksheet/worksheet.py new/openpyxl-2.6.2/openpyxl/worksheet/worksheet.py --- old/openpyxl-2.6.1/openpyxl/worksheet/worksheet.py 2019-03-04 12:58:56.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/worksheet/worksheet.py 2019-03-29 15:29:44.000000000 +0100 @@ -5,7 +5,7 @@ # Python stdlib imports -from itertools import islice, product +from itertools import islice, product, chain from operator import itemgetter from inspect import isgenerator @@ -139,7 +139,6 @@ self.legacy_drawing = None self.sheet_properties = WorksheetProperties() self.sheet_format = SheetFormatProperties() - self._merged_cell_range = {} self.scenarios = ScenarioList() @@ -570,32 +569,24 @@ def merge_cells(self, range_string=None, start_row=None, start_column=None, end_row=None, end_column=None): + """ Set merge on a cell range. Range is a cell range (e.g. A1:E1) """ cr = CellRange(range_string=range_string, min_col=start_column, min_row=start_row, max_col=end_column, max_row=end_row) - """ Set merge on a cell range. Range is a cell range (e.g. A1:E1) """ - - self.merged_cells.add(cr.coord) + self.merged_cells.add(cr) self._clean_merge_range(cr) def _clean_merge_range(self, cr): """ Remove all but the top left-cell from a range of merged cells - and creates a MergedCellRange object to recreate the lost border - information. - After deletion of cells a reformat is issued. + and recreate the lost border information. + Borders are then applied """ - - min_col, min_row, max_col, max_row = cr.bounds - mcr = MergedCellRange(self, cr.coord) - self._merged_cell_range.update({cr.bounds:mcr}) - - rows = range(min_row, max_row+1) - cols = range(min_col, max_col+1) - cells = product(rows, cols) + cells = chain.from_iterable(mcr.rows) + next(cells) # skip first cell - for row, col in islice(cells, 1, None): + for row, col in cells: self._cells[row, col] = MergedCell(self, row, col) mcr.format() @@ -617,8 +608,11 @@ self.merged_cells.remove(cr) - # Deletes the MergedCellRange. - del self._merged_cell_range[cr.bounds] + cells = chain.from_iterable(cr.rows) + next(cells) # skip first cell + + for row, col in cells: + del self._cells[(row, col)] def append(self, iterable): @@ -759,16 +753,20 @@ raise ValueError("Only CellRange objects can be moved") if not rows and not cols: return - min_col, min_row, max_col, max_row = cell_range.bounds - # rebase moved range - cell_range.shift(row_shift=rows, col_shift=cols) down = rows > 0 right = cols > 0 - r = sorted(range(min_row, max_row+1), reverse=down) - c = sorted(range(min_col, max_col+1), reverse=right) - for row, column in product(r, c): - self._move_cell(row, column, rows, cols, translate) + + if rows: + cells = sorted(cell_range.rows, reverse=down) + else: + cells = sorted(cell_range.cols, reverse=right) + + for row, col in chain.from_iterable(cells): + self._move_cell(row, col, rows, cols, translate) + + # rebase moved range + cell_range.shift(row_shift=rows, col_shift=cols) def _move_cell(self, row, column, row_offset, col_offset, translate=False): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/xml/constants.py new/openpyxl-2.6.2/openpyxl/xml/constants.py --- old/openpyxl-2.6.1/openpyxl/xml/constants.py 2019-03-04 12:58:56.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/xml/constants.py 2019-03-29 15:29:44.000000000 +0100 @@ -36,6 +36,8 @@ ARC_CUSTOM_UI = 'customUI/customUI.xml' ## namespaces +# XML +XML_NS = "http://www.w3.org/XML/1998/namespace" # Dublin Core DCORE_NS = 'http://purl.org/dc/elements/1.1/' DCTERMS_NS = 'http://purl.org/dc/terms/' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl/xml/functions.py new/openpyxl-2.6.2/openpyxl/xml/functions.py --- old/openpyxl-2.6.1/openpyxl/xml/functions.py 2019-02-27 20:14:09.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl/xml/functions.py 2019-03-29 15:29:44.000000000 +0100 @@ -96,7 +96,8 @@ VTYPES_NS, COREPROPS_NS, DCTERMS_NS, - DCTERMS_PREFIX + DCTERMS_PREFIX, + XML_NS ) register_namespace(DCTERMS_PREFIX, DCTERMS_NS) @@ -109,6 +110,7 @@ register_namespace('vt', VTYPES_NS) register_namespace('xdr', SHEET_DRAWING_NS) register_namespace('cdr', CHART_DRAWING_NS) +register_namespace('xml', XML_NS) tostring = partial(tostring, encoding="utf-8") @@ -120,3 +122,8 @@ return "comment" m = NS_REGEX.match(node.tag) return m.group('localname') + + +def whitespace(node): + if node.text != node.text.strip(): + node.set("{%s}space" % XML_NS, "preserve") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openpyxl-2.6.1/openpyxl.egg-info/PKG-INFO new/openpyxl-2.6.2/openpyxl.egg-info/PKG-INFO --- old/openpyxl-2.6.1/openpyxl.egg-info/PKG-INFO 2019-03-04 13:10:57.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl.egg-info/PKG-INFO 2019-03-29 15:30:35.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: openpyxl -Version: 2.6.1 +Version: 2.6.2 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.1/openpyxl.egg-info/SOURCES.txt new/openpyxl-2.6.2/openpyxl.egg-info/SOURCES.txt --- old/openpyxl-2.6.1/openpyxl.egg-info/SOURCES.txt 2019-03-04 13:10:57.000000000 +0100 +++ new/openpyxl-2.6.2/openpyxl.egg-info/SOURCES.txt 2019-03-29 15:30:36.000000000 +0100 @@ -35,6 +35,7 @@ openpyxl/chart/marker.py openpyxl/chart/picture.py openpyxl/chart/pie_chart.py +openpyxl/chart/pivot.py openpyxl/chart/plotarea.py openpyxl/chart/print_settings.py openpyxl/chart/radar_chart.py