feat: Replaced useless `cached_property` with `property` and moved to `functools.cached_property`
Summary
Fixes #2660
Replaced all cached_property with property or functools.cached_property based on the solution mentioned in the issue.
Information
- [x] This PR fixes an issue.
- [ ] This PR adds something new (e.g. new method or parameters).
- [x] This PR is a breaking change (e.g. methods or parameters removed/renamed).
- [ ] This PR is not a code change (e.g. documentation, README, typehinting, examples, ...).
Checklist
- [x] I have searched the open pull requests for duplicates.
- [ ] If code changes were made then they have been tested.
- [ ] I have updated the documentation to reflect the changes.
- [ ] If
type: ignorecomments were used, a comment is also left explaining why. - [ ] I have updated the changelog to include these changes.
See https://github.com/Pycord-Development/pycord/pull/2636#issuecomment-2506449499 and https://github.com/Pycord-Development/pycord/pull/2636#issuecomment-2514792776
Do you think is better to replace the two cached_property remained with property or evaluating the use of utils.cached_slots_property?
the two
cached_propertyremained
~~@RiccardoVaccari So there are two remaining cached_propertys ? Would you mind sending a reference to them ? This should not be merged before they are replaced then.~~
nvm, I missunderstood, you meant it already uses functools.cached_property. Well in that case we should keep that, as the point of the original issue is to use as much built in code and not custom code as possible, also see as DA344 said.
Do you think is better to replace the two
cached_propertyremained withpropertyor evaluating the use ofutils.cached_slots_property?
Keeping them as is it’s fine, it saves a function call because the data where cached_property is used is static, ie created_at, it’s bound to the id, and IDs cannot change, so calculating it everything it gets the property attr is not worth it, and it’s also not that necessary to be stored on a class attribute.
Do I need to fix this based on suggestions?
Yeah
Merge conflicts
@Lulalaby should be good