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
I have searched for open issues that report the same problem
I have checked that the bug affects the latest version of the library
The results you expect to see
When building a new scraper, the generate.py script showed two things that were not expected behavior:
The 'from.. import..' statement for the new scraper gets put all the way at the top of the recipe_scrapers.init.py file, rather than putting this between the other statements in alphabetical order
When generating a class, the script does not take into account if one already exists. If a user is to run the script twice for the same website (e.g. when creating a test template for a page without ingredients_groups and one with) it creates a duplicate class
The results (including any Python error messages) that you are seeing
Put the new scraper's 'from... import...'statement in alphabetical position in the init.py file
Check if class already exists before generating new class
...
The text was updated successfully, but these errors were encountered:
* Currently, generate.py tries to insert new `from ... import ...` statements after the first line (See #1259 and #1427 (comment)).
* It looks like the `node.level > 0` condition was added to skip the first item (`from __future__ import annotations`, which the generator considers to be a valid scraper class), but unfortunately `self.last_node = node` is still reached. The second time `__import()` is called, the first line is `self.last_node` and the new import is added beneath it.
* This PR moves the `node.level > 0` condition up into the parent `if` statement to avoid `self.last_node = node` from being called. Luckily, this doesn't impact the `elif` beneath it.
* I manually validated that we can insert a new scraper class named "AAA" and "ZZZ"
Pre-filing checks
The results you expect to see
When building a new scraper, the generate.py script showed two things that were not expected behavior:
The results (including any Python error messages) that you are seeing
...
The text was updated successfully, but these errors were encountered: