-
Notifications
You must be signed in to change notification settings - Fork 4
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
Compatible with cyfunction #21
base: master
Are you sure you want to change the base?
Conversation
# This change helps to work with some modules like `pydantic`, which wraps | ||
# functions (includes coroutine functions) into cyfunctions. The method | ||
# `inspect.isfunction()` cannot recognize them for now. | ||
def is_func_or_cyfunc(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FrostyLeaf could you please add the description underneath the function as pydoc suggests?
# Compatible with coroutine cyfunction or other kind of functions which return coroutines | ||
# but are not coroutine functions | ||
co_or_ret = method(*request.args, **request.kwargs) | ||
# Maybe `inspect.isawaitable()` is better? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please elaborate on this comment? What are pros/cons of inspect.isawaitable
? If we pick it, do we need this comment?
# functions (includes coroutine functions) into cyfunctions. The method | ||
# `inspect.isfunction()` cannot recognize them for now. | ||
def is_func_or_cyfunc(object): | ||
return isfunction(object) or (type(object).__name__ == "cython_function_or_method") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FrostyLeaf could you please add test for this?
No description provided.