(self)
| 62 | self._load_all_spiders() |
| 63 | |
| 64 | def _check_name_duplicates(self) -> None: |
| 65 | dupes = [] |
| 66 | for name, locations in self._found.items(): |
| 67 | dupes.extend( |
| 68 | [ |
| 69 | f" {cls} named {name!r} (in {mod})" |
| 70 | for mod, cls in locations |
| 71 | if len(locations) > 1 |
| 72 | ] |
| 73 | ) |
| 74 | |
| 75 | if dupes: |
| 76 | dupes_string = "\n\n".join(dupes) |
| 77 | warnings.warn( |
| 78 | "There are several spiders with the same name:\n\n" |
| 79 | f"{dupes_string}\n\n This can cause unexpected behavior.", |
| 80 | stacklevel=2, |
| 81 | category=UserWarning, |
| 82 | ) |
| 83 | |
| 84 | def _load_spiders(self, module: ModuleType) -> None: |
| 85 | for spcls in iter_spider_classes(module): |
no test coverage detected