You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a decorated spider method, scrapy.utils.miscthrows a warning saying that it cannot determine if the callable is a generator with a return value.
ast.parse() fails here when called with a decorated method.
Steps to Reproduce
I just copied the logic from misc.py and used it to analyze a class with the same overall code structure:
This is my first time filing a Scrapy issue. I'm happy to add more context if necessary, and apologies in advance if this has already been discussed elsewhere (fwiw I couldn't find anything).
The text was updated successfully, but these errors were encountered:
When this features was introduced in #3869, it used dedent, which would have avoided this issue. In #4935, this was changed to a simple regex, because apparently some people write code like:
classBob:
defdoit(self):
"""this line is flush left """ifTrue:
yield1234
Anyway, to support both decorators and non-indented heredocs, then the regex needs to be made smarter.
Description
If you have a decorated spider method,
scrapy.utils.misc
throws a warning saying that it cannot determine if the callable is a generator with a return value.ast.parse()
fails here when called with a decorated method.Steps to Reproduce
I just copied the logic from
misc.py
and used it to analyze a class with the same overall code structure:The regex replacement isn't accounting for a possible decorator, so the code ends up looking like:
Expected behavior: I'd like to be able to use decorated methods without dealing with noisy logs.
Actual behavior: My container logs are filled with tons of warning messages. The only workaround is to avoid the usage of decorators.
Reproduces how often: 100% of the time to my knowledge
Versions
Additional context
This is my first time filing a Scrapy issue. I'm happy to add more context if necessary, and apologies in advance if this has already been discussed elsewhere (fwiw I couldn't find anything).
The text was updated successfully, but these errors were encountered: