<commit_before># -*- coding: utf-8 -*-
import os

from pyjobs_crawlers.run import start_crawlers

from crawlers import PyJobsWebConnector
from pyjobsweb.commands import AppContextCommand


class CrawlCommand(AppContextCommand):

    def take_action(self, parsed_args):
        super(CrawlCommand, self).take_action(parsed_args)
        os.environ['SCRAPY_SETTINGS_MODULE'] = 'pyjobs_crawlers.settings'
        start_crawlers(connector_class=PyJobsWebConnector, processes=1, debug=False)<commit_msg>Enhance crawl command with argv parameters<commit_after># -*- coding: utf-8 -*-
import os

from pyjobs_crawlers.run import start_crawlers

from crawlers import PyJobsWebConnector
from pyjobsweb.commands import AppContextCommand


class CrawlCommand(AppContextCommand):

    def get_parser(self, prog_name):
        parser = super(CrawlCommand, self).get_parser(prog_name)

        parser.add_argument("-p", "--processes",
                            help='Number of processes used (set 0 to use main process)',
                            dest='processes', default=0)

        parser.add_argument("-d", "--debug",
                            help='Enable debug',
                            dest='debug', default=0)
        return parser

    def take_action(self, parsed_args):
        super(CrawlCommand, self).take_action(parsed_args)
        start_crawlers(connector_class=PyJobsWebConnector,
                       processes=parsed_args.processes,
                       debug=parsed_args.debug)
{'fraction_non_alphanumeric': 0.08945260347129506, 'fraction_numerical': 0.004005340453938585, 'mean_word_length': 2.9656084656084656, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4611363', 'n_tokens_mistral': 433, 'n_tokens_neox': 423, 'n_words': 88}