ppizarror / pygame-menu

A menu for pygame. Simple, and easy to use
https://pygame-menu.readthedocs.io/
Other
544 stars 141 forks source link

Remove `is_callable` function. #395

Closed vnmabus closed 2 years ago

vnmabus commented 2 years ago

Use callable instead, which is a Python builtin and accepts also objects with a __call__ method. Fixes #394.

lgtm-com[bot] commented 2 years ago

This pull request introduces 2 alerts when merging 852264456d3673f0d34c78e99655dfd39b21ead6 into ea51d1fe26fe8ff9977414a8dc6d0b80ff06f05e - view on LGTM.com

new alerts:

vnmabus commented 2 years ago

There are two tests that fail because they consider that a type is not a callable (which is false, as a type implement __call__).

codecov[bot] commented 2 years ago

Codecov Report

Merging #395 (2f9308e) into master (ea51d1f) will decrease coverage by 0.00%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #395      +/-   ##
==========================================
- Coverage   97.22%   97.22%   -0.01%     
==========================================
  Files          48       48              
  Lines       12059    12058       -1     
==========================================
- Hits        11724    11723       -1     
  Misses        335      335              
Impacted Files Coverage Δ
pygame_menu/_decorator.py 98.68% <100.00%> (ø)
pygame_menu/menu.py 96.58% <100.00%> (ø)
pygame_menu/themes.py 98.47% <100.00%> (ø)
pygame_menu/utils.py 96.94% <100.00%> (ø)
pygame_menu/version.py 100.00% <100.00%> (ø)
pygame_menu/widgets/core/widget.py 97.75% <100.00%> (ø)
pygame_menu/widgets/widget/button.py 100.00% <100.00%> (ø)
pygame_menu/widgets/widget/dropselect_multiple.py 98.78% <100.00%> (ø)
pygame_menu/widgets/widget/label.py 100.00% <100.00%> (ø)
pygame_menu/widgets/widget/menulink.py 100.00% <100.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ea51d1f...2f9308e. Read the comment docs.

ppizarror commented 2 years ago

There are two tests that fail because they consider that a type is not a callable (which is false, as a type implement __call__).

You're right, I've updated the tests and removed some unused imports. Do you plan to add another feature to this new version? Let me know to publish it to pypi

vnmabus commented 2 years ago

I am not sure, as I am testing things as we go with the migration. I however have to say that removing is_callable is potentially a breaking change, as it was public. I am not sure if I should add it back with a deprecation notice, or how do you want to deal with that.

ppizarror commented 2 years ago

I'll a shorthand in utils. It will be removed in v5

ppizarror commented 2 years ago

I think this PR is ready to merge