8000 Privatize Text.cached by mdboom · Pull Request #2457 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Privatize Text.cached #2457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
< 8000 div id="diff-cd3ee6de407043a9cec9c7b51eb01be6a7cd003f040685463ba1897375ebd044" data-details-container-group="file" class="file js-file js-details-container js-targetable-element show-inline-notes Details Details--on open soft-wrap file-type-prose " data-file-type=".rst" data-file-deleted="false" data-tagsearch-path="doc/api/api_changes.rst" data-targets="diff-file-filter.diffEntries" >
10 changes: 10 additions & 0 deletions doc/api/api_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ For new features that were added to matplotlib, please see
Changes in 1.3.x
================

Changes in 1.3.1
----------------

It is rare that we make an API change in a bugfix release, however,
for 1.3.1 since 1.3.0 the following change was made:

- `text.Text.cached` (used to cache font objects) has been made into a
private variable. Among the obvious encapsulation benefit, this
removes this confusing-looking member from the documentation.

Code removal
------------

Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class Text(Artist):
"""
zorder = 3

cached = maxdict(50)
_cached = maxdict(50)

def __str__(self):
return "Text(%g,%g,%s)" % (self._x, self._y, repr(self._text))
Expand Down Expand Up @@ -285,8 +285,8 @@ def _get_layout(self, renderer):
of a rotated text when necessary.
"""
key = self.get_prop_tup()
if key in self.cached:
return self.cached[key]
if key in self._cached:
return self._cached[key]

horizLayout = []

Expand Down Expand Up @@ -440,7 +440,7 @@ def get_text_width_height_descent(*kl, **kwargs):
xs, ys = xys[:, 0], xys[:, 1]

ret = bbox, zip(lines, whs, xs, ys), descent
self.cached[key] = ret
self._cached[key] = ret
return ret

def set_bbox(self, rectprops):
Expand Down
0