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

Adjust original_message deprecation warning #1681

Merged
merged 13 commits into from Oct 17, 2022

Conversation

NeloBlivion
Copy link
Member

@NeloBlivion NeloBlivion commented Oct 8, 2022

Summary

The original_message methods in Interaction were deprecated in 2.2, not 2.1.

On another note, the deprecated methods raise a RuntimeWarning due to not awaiting the new original_response functions

<string>:2: DeprecationWarning: Interaction.original_message is deprecated since version 2.1, consider using Interaction.original_response instead.
<string>:2: RuntimeWarning: coroutine 'Interaction.original_response' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

should they instead use @property and not be called inside the function? E.g. ApplicationContext.edit

@property
@discord.utils.copy_doc(Interaction.edit_original_response)
def edit(self) -> Callable[..., Awaitable[InteractionMessage]]:
return self.interaction.edit_original_response

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • 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

  • 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: ignore comments were used, a comment is also left explaining why.

Copy link
Member

@BobDotCom BobDotCom left a comment

Choose a reason for hiding this comment

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

should they instead use @property and not be called inside the function?

Yes. They should either be a property, or an async function. Personally I would prefer a property but I'm open to discussion either way.

# Property
@property
def foo(self):
    return bar

# Async function
async def foo(self):
    return await bar()

BobDotCom and others added 4 commits October 9, 2022 12:33
Converted to properties to avoid RuntimeError
`property` is incompatible with the `@deprecated` decorator as properties don't have `__name__`
@Lulalaby Lulalaby enabled auto-merge (squash) October 9, 2022 19:46
@BobDotCom
Copy link
Member

On second thought, it might be easier to use async methods instead of properties so that the @deprecated decorator can be used, and typehints would be simpler. What do you think?

@Lulalaby Lulalaby added documentation Improvements or additions to documentation priority: low Low Priority labels Oct 11, 2022
@codecov
Copy link

codecov bot commented Oct 14, 2022

Codecov Report

Merging #1681 (a0be7ff) into master (80941fe) will not change coverage.
The diff coverage is 50.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1681   +/-   ##
=======================================
  Coverage   33.23%   33.23%           
=======================================
  Files          95       95           
  Lines       18423    18423           
=======================================
  Hits         6123     6123           
  Misses      12300    12300           
Flag Coverage Δ
pytest 33.23% <50.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
discord/interactions.py 20.38% <50.00%> (ø)

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 80941fe...a0be7ff. Read the comment docs.

auto-merge was automatically disabled October 16, 2022 17:42

Head branch was pushed to by a user without write access

@NeloBlivion
Copy link
Member Author

Fair enough, reverted to async

@Lulalaby Lulalaby enabled auto-merge (squash) October 17, 2022 17:58
@Lulalaby Lulalaby merged commit 75bc6fe into Pycord-Development:master Oct 17, 2022
@TurnrDev
Copy link
Contributor

This should be released since it fixes a breaking change introduced in 2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation priority: low Low Priority
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants