Function
_run_command_profiled
(
cmd: ScrapyCommand, args: list[str], opts: argparse.Namespace
)
Source from the content-addressed store, hash-verified
| 223 | |
| 224 | |
| 225 | def _run_command_profiled( |
| 226 | cmd: ScrapyCommand, args: list[str], opts: argparse.Namespace |
| 227 | ) -> None: |
| 228 | if opts.profile: |
| 229 | sys.stderr.write(f"scrapy: writing cProfile stats to {opts.profile!r}\n") |
| 230 | loc = locals() |
| 231 | p = cProfile.Profile() |
| 232 | p.runctx("cmd.run(args, opts)", globals(), loc) |
| 233 | if opts.profile: |
| 234 | p.dump_stats(opts.profile) |
| 235 | |
| 236 | |
| 237 | if __name__ == "__main__": |
Tested by
no test coverage detected