Skip to content
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

Fix matplotlib deprecation warning and adds some minor improvements #721

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

amenezes
Copy link

  • Fix deprecated matplotlib function
test/test_wordcloud.py: 46 warnings
  wordcloud/wordcloud.py:106: MatplotlibDeprecationWarning: The get_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap(obj)`` instead.
    self.colormap = plt.cm.get_cmap(colormap)
  • Added metadata classifiers
  • Improve regex performance using re.compile

@@ -576,13 +576,14 @@ def process_text(self, text):

flags = (re.UNICODE if sys.version < '3' and type(text) is unicode # noqa: F821
else 0)
pattern = r"\w[\w']*" if self.min_word_length <= 1 else r"\w[\w']+"
regexp = self.regexp if self.regexp is not None else pattern
if self.regexp is not None:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!
This call to compile actually doesn't change anything, as the object is only used once, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amueller,

Really sorry for the long delay. Yes there's no change on the workflow. The ideia is to simplify.

All the tests have passed locally, do you think it's useful to include any more?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I'm only very sporadically on this project these days. How does this change about the re simplify, the code gets longer, right?

@QuLogic
Copy link

QuLogic commented Apr 24, 2024

Just a friendly ping here; Matplotlib 3.9 will be out soon and this deprecation will be a hard error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants