amueller / word_cloud

A little word cloud generator in Python
https://amueller.github.io/word_cloud
MIT License
10.1k stars 2.31k forks source link

Fix some deprecated #685

Closed teriterance closed 1 year ago

teriterance commented 2 years ago

This pull request remove some warning for deprecated variables

lib/python3.8/site-packages/wordcloud/wordcloud.py:501: DeprecationWarning: textsize is deprecated and will be removed in Pillow 10 (2023-07-01). Use textbbox or textlength instead. I used textlength in place of textsize

np.int is a deprecated, replaced by int.

and ROTATE_90 replaced by Transpose.ROTATE_90

amueller commented 2 years ago

Thank you for the PR! This looks good but I'd like to make sure the tests run. It seems I messed up my CI (again?), and I need to double check what the issue is.

teriterance commented 2 years ago

the tests have good results except for 2 of them due to the difference between textsize and textbox https://stackoverflow.com/questions/65494932/imagedraw-adapt-font-size-dynamically-to-text-length:

test/test_wordcloud.py:255: in test_mask assert_array_equal(wc_array[mask != 0], 0) E AssertionError: E Arrays are not equal E E Mismatched elements: 14853 / 15000 (99%) E Max absolute difference: 239 E Max relative difference: less E x: array([[ 32, 163, 134], E [32, 163, 134], E [ 32, 163, 134],... E y: array(0) ____ test_mask_contour ____ test/test_wordcloud.py:281: in test_mask_contour assert lg_total > sm_total E assert 1369086 > 1643735

kaisugi commented 2 years ago

any updates?

amueller commented 1 year ago

hm looks like tests aren't passing right now. sorry to be so slow getting back to you! Do you want to have a look or should I / someone else?

teriterance commented 1 year ago

I changed the test mask value because ImageDraw.textbbox() and ImageDraw.textsize() don't give the same image

for example with textsize() image

and for example with textbbox() image

amueller commented 1 year ago

Thanks. Did you see CI running? I'm confused they didn't seem to be running now. Maybe merge in the master branch? I'll try to check it later this week but pretty busy right now.

alexlang74 commented 1 year ago

Hi all - any timeline to get this released?

amueller commented 1 year ago

the timeline is mostly me trying to get CI to work again. Can you please try and merge master and push to the branch?

amueller commented 1 year ago

hm reopening did trigger CI, and it's failing...

amueller commented 1 year ago

I think I'll merge in #711 which contains some further fixes, thanks for your help!