From 09ffea8bd658e612077e9337be833df1cc38a979 Mon Sep 17 00:00:00 2001 From: "Christine P. Chai" Date: Thu, 13 Feb 2025 18:33:48 -0800 Subject: [PATCH 1/6] DOC: Add docstrings to matplotlib.cbook.GrouperView --- lib/matplotlib/cbook.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index 9b26842a766c..5919960eb0c3 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -880,8 +880,12 @@ class GrouperView: def __init__(self, grouper): self._grouper = grouper def __contains__(self, item): return item in self._grouper def __iter__(self): return iter(self._grouper) - def joined(self, a, b): return self._grouper.joined(a, b) - def get_siblings(self, a): return self._grouper.get_siblings(a) + def joined(self, a, b): + """Return whether *a* and *b* are members of the same set.""" + return self._grouper.joined(a, b) + def get_siblings(self, a): + """Return all of the items joined with *a*, including itself.""" + return self._grouper.get_siblings(a) def simple_linear_interpolation(a, steps): From 76dd8be040550839c79e89d4ee52b78d3a12f551 Mon Sep 17 00:00:00 2001 From: "Christine P. Chai" Date: Fri, 14 Feb 2025 11:13:43 -0800 Subject: [PATCH 2/6] DOC: Fixed linting errors in cbook.py --- lib/matplotlib/cbook.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index 5919960eb0c3..43e5dc7f99a5 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -850,11 +850,15 @@ def join(self, a, *args): mapping[elem] = set_a def joined(self, a, b): - """Return whether *a* and *b* are members of the same set.""" + """ + Return whether *a* and *b* are members of the same set. + """ return (self._mapping.get(a, object()) is self._mapping.get(b)) def remove(self, a): - """Remove *a* from the grouper, doing nothing if it is not there.""" + """ + Remove *a* from the grouper, doing nothing if it is not there. + """ self._mapping.pop(a, {a}).remove(a) self._ordering.pop(a, None) @@ -881,10 +885,14 @@ def __init__(self, grouper): self._grouper = grouper def __contains__(self, item): return item in self._grouper def __iter__(self): return iter(self._grouper) def joined(self, a, b): - """Return whether *a* and *b* are members of the same set.""" + """ + Return whether *a* and *b* are members of the same set. + """ return self._grouper.joined(a, b) def get_siblings(self, a): - """Return all of the items joined with *a*, including itself.""" + """ + Return all of the items joined with *a*, including itself. + """ return self._grouper.get_siblings(a) From c951f1a3da53bdb715f83f081f5c3c5c64a8e512 Mon Sep 17 00:00:00 2001 From: "Christine P. Chai" Date: Fri, 14 Feb 2025 11:50:59 -0800 Subject: [PATCH 3/6] Update cbook.py Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- lib/matplotlib/cbook.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index 43e5dc7f99a5..5e9c71a9bb1a 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -889,6 +889,7 @@ def joined(self, a, b): Return whether *a* and *b* are members of the same set. """ return self._grouper.joined(a, b) + def get_siblings(self, a): """ Return all of the items joined with *a*, including itself. From 8d2b682b5dab1a1c3a2c430c9c761e4b9a3fa25a Mon Sep 17 00:00:00 2001 From: "Christine P. Chai" Date: Fri, 14 Feb 2025 11:51:05 -0800 Subject: [PATCH 4/6] Update cbook.py Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- lib/matplotlib/cbook.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index 5e9c71a9bb1a..84ba1a964644 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -884,6 +884,7 @@ class GrouperView: def __init__(self, grouper): self._grouper = grouper def __contains__(self, item): return item in self._grouper def __iter__(self): return iter(self._grouper) + def joined(self, a, b): """ Return whether *a* and *b* are members of the same set. From 08982e9a27d76f4a81d0a9af43e123de1928cdf2 Mon Sep 17 00:00:00 2001 From: "Christine P. Chai" Date: Fri, 14 Feb 2025 12:12:43 -0800 Subject: [PATCH 5/6] Revert unnecessary changes --- lib/matplotlib/cbook.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index 84ba1a964644..3fbe588bbbab 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -850,15 +850,11 @@ def join(self, a, *args): mapping[elem] = set_a def joined(self, a, b): - """ - Return whether *a* and *b* are members of the same set. - """ + """Return whether *a* and *b* are members of the same set.""" return (self._mapping.get(a, object()) is self._mapping.get(b)) def remove(self, a): - """ - Remove *a* from the grouper, doing nothing if it is not there. - """ + """Remove *a* from the grouper, doing nothing if it is not there.""" self._mapping.pop(a, {a}).remove(a) self._ordering.pop(a, None) From eb7cae3fef6bfdffebfad6d4a02eb2ed9abb4b38 Mon Sep 17 00:00:00 2001 From: "Christine P. Chai" Date: Fri, 14 Feb 2025 12:15:47 -0800 Subject: [PATCH 6/6] Removed unnecessary whitespace --- lib/matplotlib/cbook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index 3fbe588bbbab..d90921158ee5 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -886,7 +886,7 @@ def joined(self, a, b): Return whether *a* and *b* are members of the same set. """ return self._grouper.joined(a, b) - + def get_siblings(self, a): """ Return all of the items joined with *a*, including itself.