MCPcopy
hub / github.com/scrapy/scrapy / _iter_command_classes

Function _iter_command_classes

scrapy/cmdline.py:40–51  ·  view source on GitHub ↗
(module_name: str)

Source from the content-addressed store, hash-verified

38
39
40def _iter_command_classes(module_name: str) -> Iterable[type[ScrapyCommand]]:
41 # TODO: add `name` attribute to commands and merge this function with
42 # scrapy.utils.spider.iter_spider_classes
43 for module in walk_modules_iter(module_name):
44 for obj in vars(module).values():
45 if (
46 inspect.isclass(obj)
47 and issubclass(obj, ScrapyCommand)
48 and obj.__module__ == module.__name__
49 and obj not in {ScrapyCommand, BaseRunSpiderCommand}
50 ):
51 yield obj
52
53
54def _get_commands_from_module(module: str, inproject: bool) -> dict[str, ScrapyCommand]:

Callers 1

Calls 2

walk_modules_iterFunction · 0.90
valuesMethod · 0.80

Tested by

no test coverage detected