MCPcopy
hub / github.com/scrapy/scrapy / _check_name_duplicates

Method _check_name_duplicates

scrapy/spiderloader.py:64–82  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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):

Callers 1

_load_all_spidersMethod · 0.95

Calls 3

itemsMethod · 0.80
extendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected