From 4803d2a3d218efd9aab7251faef9a971082c6412 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Dec 13 2020 01:30:06 +0000 Subject: Update to latest version. --- diff --git a/.gitignore b/.gitignore index c9d9d5e..a4d8fa9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /mplcursors-0.2.tar.gz /mplcursors-0.2.1.tar.gz /mplcursors-0.3.tar.gz +/mplcursors-0.4.tar.gz diff --git a/6dbf40796b9774ae988fc650596880d31cbc0e89.patch b/6dbf40796b9774ae988fc650596880d31cbc0e89.patch deleted file mode 100644 index 323a76d..0000000 --- a/6dbf40796b9774ae988fc650596880d31cbc0e89.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 6dbf40796b9774ae988fc650596880d31cbc0e89 Mon Sep 17 00:00:00 2001 -From: Antony Lee -Date: Thu, 16 Apr 2020 13:01:50 +0200 -Subject: [PATCH] Switch to supporting new-style stem plots. - ---- - lib/mplcursors/_pick_info.py | 20 +++++++++++--------- - tests/test_mplcursors.py | 2 +- - 3 files changed, 15 insertions(+), 12 deletions(-) - -diff --git a/lib/mplcursors/_pick_info.py b/lib/mplcursors/_pick_info.py -index 0715441..8037134 100644 ---- a/lib/mplcursors/_pick_info.py -+++ b/lib/mplcursors/_pick_info.py -@@ -461,14 +461,16 @@ def _(container, event): - sel = compute_pick(container.markerline, event) - if sel: - return sel -- idx_sel = min(filter(lambda idx_sel: idx_sel[1] is not None, -- ((idx, compute_pick(line, event)) -- for idx, line in enumerate(container.stemlines))), -- key=lambda idx_sel: idx_sel[1].dist, default=None) -- if idx_sel: -- idx, _ = idx_sel -+ if not isinstance(container.stemlines, LineCollection): -+ warnings.warn("Only stem plots created with use_line_collection=True " -+ "are supported.") -+ return -+ sel = compute_pick(container.stemlines, event) -+ if sel: -+ idx, _ = sel.target.index - target = _with_attrs( -- container.stemlines[idx].get_xydata()[-1], index=idx) -+ container.stemlines.get_segments()[idx][-1], -+ index=sel.target.index) - return Selection(container, target, 0, None, None) - - -@@ -517,7 +519,7 @@ def get_ann_text(sel): - classes follow. - """ - warnings.warn( -- f"Annotation support for {type(sel.artist).__name__} is missing") -+ f"Annotation support for {type(sel.artist).__name__} is missing.") - return "" - - -@@ -750,7 +752,7 @@ def make_highlight(sel, *, highlight_kwargs): - classes follow. - """ - warnings.warn( -- f"Highlight support for {type(sel.artist).__name__} is missing") -+ f"Highlight support for {type(sel.artist).__name__} is missing.") - - - def _set_valid_props(artist, kwargs): -diff --git a/tests/test_mplcursors.py b/tests/test_mplcursors.py -index 8b4498d..3ccbfcf 100644 ---- a/tests/test_mplcursors.py -+++ b/tests/test_mplcursors.py -@@ -384,7 +384,7 @@ def test_dataless_errorbar(ax): - - def test_stem(ax): - with pytest.warns(None): # stem use_line_collection API change. -- ax.stem([1, 2, 3]) -+ ax.stem([1, 2, 3], use_line_collection=True) - cursor = mplcursors.cursor() - assert len(cursor.artists) == 1 - _process_event("__mouse_click__", ax, (.5, .5), 1) diff --git a/6f089d9a4d05e031ea443f7543c8f9b1c62e9135.patch b/6f089d9a4d05e031ea443f7543c8f9b1c62e9135.patch deleted file mode 100644 index aee7697..0000000 --- a/6f089d9a4d05e031ea443f7543c8f9b1c62e9135.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 6f089d9a4d05e031ea443f7543c8f9b1c62e9135 Mon Sep 17 00:00:00 2001 -From: Antony Lee -Date: Sat, 28 Mar 2020 12:47:18 +0100 -Subject: [PATCH] Remove notebook links from docs. - ---- - .doc-requirements.txt | 6 +++--- - doc/source/_static/hide_some_gallery_elements.css | 3 +++ - doc/source/conf.py | 8 +++++--- - 3 files changed, 11 insertions(+), 6 deletions(-) - create mode 100644 doc/source/_static/hide_some_gallery_elements.css - -diff --git a/.doc-requirements.txt b/.doc-requirements.txt -index eee57d6..acbfbe5 100644 ---- a/.doc-requirements.txt -+++ b/.doc-requirements.txt -@@ -1,3 +1,3 @@ --pandas==0.24.1 --sphinx==1.5.6 --sphinx-gallery==0.1.13 -+pandas==1.0.0 -+sphinx==2.4.4 -+sphinx-gallery==0.6.0 -diff --git a/doc/source/_static/hide_some_gallery_elements.css b/doc/source/_static/hide_some_gallery_elements.css -new file mode 100644 -index 0000000..b2a0738 ---- /dev/null -+++ b/doc/source/_static/hide_some_gallery_elements.css -@@ -0,0 +1,3 @@ -+div.sphx-glr-download-link-note, div.sphx-glr-download-jupyter { -+ display: none; -+} -diff --git a/doc/source/conf.py b/doc/source/conf.py -index 47368d1..461e1a3 100644 ---- a/doc/source/conf.py -+++ b/doc/source/conf.py -@@ -14,7 +14,7 @@ - 'sphinx.ext.viewcode', - 'sphinx_gallery.gen_gallery', - ] --needs_extensions = {'sphinx_gallery.gen_gallery': '0.1.13'} -+needs_extensions = {'sphinx_gallery.gen_gallery': '0.6.0'} - - source_suffix = '.rst' - exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] -@@ -38,7 +38,6 @@ - # -- Options for HTML output ---------------------------------------------- - - html_theme = 'alabaster' --html_sidebars = {'**': ['about.html', 'navigation.html', 'localtoc.html']} - html_theme_options = { - 'description': 'Interactive data selection cursors for Matplotlib.', - 'github_user': 'anntzer', -@@ -47,6 +46,9 @@ - 'github_button': False, - 'code_font_size': '80%', - } -+html_css_files = ['hide_some_gallery_elements.css'] -+html_static_path = ['_static'] -+html_sidebars = {'**': ['about.html', 'navigation.html', 'localtoc.html']} - # html_last_updated_fmt = '' # bitprophet/alabaster#93 - - htmlhelp_basename = 'mplcursors_doc' -@@ -102,7 +104,7 @@ - os.environ.pop("DISPLAY", None) # Don't warn about non-GUI when running s-g. - - sphinx_gallery_conf = { -- 'backreferences_dir': False, -+ 'backreferences_dir': None, - 'examples_dirs': '../../examples', - 'filename_pattern': r'.*\.py', - 'gallery_dirs': 'examples', diff --git a/b12a791f6f8fc8a2b920e2ccb2d8ae2dae79dba0.patch b/b12a791f6f8fc8a2b920e2ccb2d8ae2dae79dba0.patch deleted file mode 100644 index 63a0562..0000000 --- a/b12a791f6f8fc8a2b920e2ccb2d8ae2dae79dba0.patch +++ /dev/null @@ -1,32 +0,0 @@ -From b12a791f6f8fc8a2b920e2ccb2d8ae2dae79dba0 Mon Sep 17 00:00:00 2001 -From: Antony Lee -Date: Mon, 20 Jan 2020 08:47:58 +0100 -Subject: [PATCH] Fix against use of unicode minus in mpl3.2. - ---- - lib/mplcursors/_pick_info.py | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/lib/mplcursors/_pick_info.py b/lib/mplcursors/_pick_info.py -index 39c7c7e..0715441 100644 ---- a/lib/mplcursors/_pick_info.py -+++ b/lib/mplcursors/_pick_info.py -@@ -629,10 +629,16 @@ def _(sel): - for e in err] - # We'd normally want to check err.sum() == 0, but that can run - # into fp inaccuracies. -- if len({s.lstrip("+-") for s in err_s}) == 1: -+ signs = "+-\N{MINUS SIGN}" -+ if len({s.lstrip(signs) for s in err_s}) == 1: - repl = rf"\1=$\2\\pm{err_s[1]}$\3" - else: -- err_s = [("+" if not s.startswith(("+", "-")) else "") + s -+ # Replacing unicode minus by ascii minus don't change the -+ # rendering as the string is mathtext, but allows keeping -+ # the same tests across Matplotlib versions that use -+ # unicode minus and those that don't. -+ err_s = [("+" if not s.startswith(tuple(signs)) else "") -+ + s.replace("\N{MINUS SIGN}", "-") - for s in err_s] - repl = r"\1=$\2_{%s}^{%s}$\3" % tuple(err_s) - ann_text = re.sub(f"({dir})=(.*)(\n?)", repl, ann_text) diff --git a/ef2a5a5e81c1a6dfd9c253032f003c45aec39431.patch b/ef2a5a5e81c1a6dfd9c253032f003c45aec39431.patch deleted file mode 100644 index 517f063..0000000 --- a/ef2a5a5e81c1a6dfd9c253032f003c45aec39431.patch +++ /dev/null @@ -1,129 +0,0 @@ -From ef2a5a5e81c1a6dfd9c253032f003c45aec39431 Mon Sep 17 00:00:00 2001 -From: Antony Lee -Date: Thu, 16 Apr 2020 13:28:23 +0200 -Subject: [PATCH] More _parse_annotations in tests given change in mpl's value - formatting. - ---- - tests/test_mplcursors.py | 49 ++++++++++++++++++++++------------------ - 1 file changed, 27 insertions(+), 22 deletions(-) - -diff --git a/tests/test_mplcursors.py b/tests/test_mplcursors.py -index 3ccbfcf..e2b9678 100644 ---- a/tests/test_mplcursors.py -+++ b/tests/test_mplcursors.py -@@ -124,8 +124,8 @@ def test_line(ax, plotter): - # On the line. - _process_event("__mouse_click__", ax, (.1, .4), 1) - assert len(cursor.selections) == len(ax.texts) == 1 -- assert (_parse_annotation(cursor.selections[0], "foo\nx=(.*)\ny=(.*)") -- == approx((.1, .4))) -+ assert _parse_annotation( -+ cursor.selections[0], "foo\nx=(.*)\ny=(.*)") == approx((.1, .4)) - # Not removing it. - _process_event("__mouse_click__", ax, (0, 1), 3) - assert len(cursor.selections) == len(ax.texts) == 1 -@@ -133,8 +133,8 @@ def test_line(ax, plotter): - artist.set_label(None) - _process_event("__mouse_click__", ax, (.6, .9), 1) - assert len(cursor.selections) == len(ax.texts) == 2 -- assert (_parse_annotation(cursor.selections[1], "x=(.*)\ny=(.*)") -- == approx((.6, .9))) -+ assert _parse_annotation( -+ cursor.selections[1], "x=(.*)\ny=(.*)") == approx((.6, .9)) - # Remove both of them (first removing the second one, to test - # `Selection.__eq__` -- otherwise it is bypassed as `list.remove` - # checks identity first). -@@ -163,7 +163,8 @@ def test_scatter_text(ax): - ax.scatter([0, 1], [0, 1], c=[2, 3]) - cursor = mplcursors.cursor() - _process_event("__mouse_click__", ax, (0, 0), 1) -- assert cursor.selections[0].annotation.get_text() == "x=0\ny=0\n[2]" -+ assert _parse_annotation( -+ cursor.selections[0], "x=(.*)\ny=(.*)\n\[(.*)\]") == (0, 0, 2) - - - def test_steps_index(): -@@ -260,25 +261,25 @@ def test_image(ax, origin): - # Annotation text includes image value. - _process_event("__mouse_click__", ax, (.25, .25), 1) - sel, = cursor.selections -- assert (_parse_annotation(sel, r"x=(.*)\ny=(.*)\n\[0\]") -- == approx((.25, .25))) -+ assert _parse_annotation( -+ sel, r"x=(.*)\ny=(.*)\n\[0\]") == approx((.25, .25)) - # Moving around. - _process_event("key_press_event", ax, (.123, .456), "shift+right") - sel, = cursor.selections -- assert sel.annotation.get_text() == "x=1\ny=0\n[1]" -+ assert _parse_annotation(sel, r"x=(.*)\ny=(.*)\n\[1\]") == (1, 0) - assert array[sel.target.index] == 1 - _process_event("key_press_event", ax, (.123, .456), "shift+right") - sel, = cursor.selections -- assert sel.annotation.get_text() == "x=0\ny=0\n[0]" -+ assert _parse_annotation(sel, r"x=(.*)\ny=(.*)\n\[0\]") == (0, 0) - assert array[sel.target.index] == 0 - _process_event("key_press_event", ax, (.123, .456), "shift+up") - sel, = cursor.selections -- assert (sel.annotation.get_text() -- == {"upper": "x=0\ny=2\n[4]", "lower": "x=0\ny=1\n[2]"}[origin]) -+ assert (_parse_annotation(sel, r"x=(.*)\ny=(.*)\n\[(.*)\]") -+ == {"upper": (0, 2, 4), "lower": (0, 1, 2)}[origin]) - assert array[sel.target.index] == {"upper": 4, "lower": 2}[origin] - _process_event("key_press_event", ax, (.123, .456), "shift+down") - sel, = cursor.selections -- assert sel.annotation.get_text() == "x=0\ny=0\n[0]" -+ assert _parse_annotation(sel, r"x=(.*)\ny=(.*)\n\[0\]") == (0, 0) - assert array[sel.target.index] == 0 - - cursor = mplcursors.cursor() -@@ -295,12 +296,12 @@ def test_image_rgb(ax): - cursor = mplcursors.cursor() - _process_event("__mouse_click__", ax, (0, 0), 1) - sel, = cursor.selections -- assert (_parse_annotation(sel, r"x=(.*)\ny=(.*)\n\[0.1, 0.2, 0.3\]") -- == approx((0, 0))) -+ assert _parse_annotation( -+ sel, r"x=(.*)\ny=(.*)\n\[0.1, 0.2, 0.3\]") == approx((0, 0)) - _process_event("key_press_event", ax, (.123, .456), "shift+right") - sel, = cursor.selections -- assert (_parse_annotation(sel, r"x=(.*)\ny=(.*)\n\[0.4, 0.5, 0.6\]") -- == approx((1, 0))) -+ assert _parse_annotation( -+ sel, r"x=(.*)\ny=(.*)\n\[0.4, 0.5, 0.6\]") == approx((1, 0)) - - - def test_image_subclass(ax): -@@ -339,7 +340,8 @@ def test_quiver_and_barbs(ax, plotter): - _process_event("__mouse_click__", ax, (.5, 0), 1) - assert len(cursor.selections) == 0 - _process_event("__mouse_click__", ax, (1, 0), 1) -- assert cursor.selections[0].annotation.get_text() == "x=1\ny=0\n(1, 1)" -+ assert _parse_annotation( -+ cursor.selections[0], r"x=(.*)\ny=(.*)\n\(1, 1\)") == (1, 0) - - - @pytest.mark.parametrize("plotter,order", -@@ -363,14 +365,17 @@ def test_errorbar(ax): - assert len(cursor.selections) == 0 - _process_event("__mouse_click__", ax, (.5, .5), 1) - assert cursor.selections[0].target == approx((.5, .5)) -- assert (_parse_annotation(cursor.selections[0], "x=(.*)\ny=(.*)") -- == approx((.5, .5))) -+ assert _parse_annotation( -+ cursor.selections[0], "x=(.*)\ny=(.*)") == approx((.5, .5)) - _process_event("__mouse_click__", ax, (0, 1), 1) - assert cursor.selections[0].target == approx((0, 0)) -- assert cursor.selections[0].annotation.get_text() == "x=0\ny=$0\\pm1$" -+ assert _parse_annotation( -+ cursor.selections[0], r"x=(.*)\ny=\$(.*)\\pm(.*)\$") == (0, 0, 1) - _process_event("__mouse_click__", ax, (1, 2), 1) -- assert cursor.selections[0].target == approx((1, 1)) -- assert cursor.selections[0].annotation.get_text() == "x=1\ny=$1_{-1}^{+2}$" -+ sel, = cursor.selections -+ assert sel.target == approx((1, 1)) -+ assert _parse_annotation( -+ sel, r"x=(.*)\ny=\$(.*)_\{(.*)\}\^\{(.*)\}\$") == (1, 1, -1, 2) - - - def test_dataless_errorbar(ax): diff --git a/python-mplcursors.spec b/python-mplcursors.spec index b1c9d49..5afd606 100644 --- a/python-mplcursors.spec +++ b/python-mplcursors.spec @@ -1,17 +1,13 @@ %global srcname mplcursors Name: python-%{srcname} -Version: 0.3 -Release: 5%{?dist} +Version: 0.4 +Release: 1%{?dist} Summary: Interactive data selection cursors for Matplotlib License: MIT URL: https://github.com/anntzer/mplcursors Source0: %pypi_source -Patch0001: https://github.com/anntzer/mplcursors/commit/b12a791f6f8fc8a2b920e2ccb2d8ae2dae79dba0.patch -Patch0002: https://github.com/anntzer/mplcursors/commit/6f089d9a4d05e031ea443f7543c8f9b1c62e9135.patch -Patch0003: https://github.com/anntzer/mplcursors/commit/6dbf40796b9774ae988fc650596880d31cbc0e89.patch -Patch0004: https://github.com/anntzer/mplcursors/commit/ef2a5a5e81c1a6dfd9c253032f003c45aec39431.patch BuildArch: noarch @@ -39,7 +35,7 @@ mplcursors – Interactive data selection cursors for Matplotlib Summary: mplcursors documentation BuildRequires: python3dist(sphinx) -BuildRequires: python3dist(sphinx-gallery) >= 0.1.13 +BuildRequires: python3dist(sphinx-gallery) >= 0.6 BuildRequires: python3dist(pandas) %description -n python-%{srcname}-doc @@ -73,9 +69,9 @@ rm -rf html/.{doctrees,buildinfo} %files -n python3-%{srcname} %license LICENSE.txt %doc README.rst examples/README.txt -%{python3_sitelib}/%{srcname} +%{python3_sitelib}/%{srcname}/ %{python3_sitelib}/%{srcname}.pth -%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info +%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info/ %files -n python-%{srcname}-doc @@ -84,6 +80,9 @@ rm -rf html/.{doctrees,buildinfo} %changelog +* Sat Dec 12 2020 Elliott Sales de Andrade - 0.4-1 +- Update to latest version (#1906201) + * Sun Aug 02 2020 Elliott Sales de Andrade - 0.3-5 - Backport fixes to work with Matplotlib 3.3 diff --git a/sources b/sources index 8df2284..ca10840 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (mplcursors-0.3.tar.gz) = a64feddefc7a8da8c7a86d962c36e13e2d38c9fa0bc3b0c9ced071659b887b18df9b4254d45a75828475f39f60f0c1646c50c0c7c27c2d8e5dae3df216fee58f +SHA512 (mplcursors-0.4.tar.gz) = 7678f6debda975c0fb1b6a5676d78fc24b3b63b28f16e437146704c15484db3c785f501225c5fd6be808de5eafbcb406b59ac4e3e8c16ec8c234da629d6fb958