<commit_before>from _datetime import datetime
import logging
import superdesk
from superdesk.notification import push_notification
from superdesk.io import providers
from superdesk.celery_app import celery
from eve.utils import config

logger = logging.getLogger(__name__)


class UpdateIngest(superdesk.Command):
    """Update ingest providers."""

    option_list = (
        superdesk.Option('--provider', '-p', dest='provider_type'),
    )

    def run(self, provider_type=None):
        for provider in superdesk.get_resource_service('ingest_providers').get(req=None, lookup={}):
            if (not provider_type or provider_type == provider.get('type')) and not provider.get('is_closed', False):
                try:
                    update_provider(provider)
                except Exception as err:
                    logger.exception(err)

superdesk.command('ingest:update', UpdateIngest())


@celery.task
def update_provider(provider):
    """Update given provider."""
    if provider.get('type') in providers:
        for items in providers[provider.get('type')].update(provider):
            ingest_items(provider, items)<commit_msg>[SD-783] Reverting the modified code.<commit_after>from _datetime import datetime
import logging
import superdesk
from superdesk.notification import push_notification
from superdesk.io import providers
from superdesk.celery_app import celery
from eve.utils import config

logger = logging.getLogger(__name__)


class UpdateIngest(superdesk.Command):
    """Update ingest providers."""

    option_list = (
        superdesk.Option('--provider', '-p', dest='provider_type'),
    )

    def run(self, provider_type=None):
        for provider in superdesk.get_resource_service('ingest_providers').get(req=None, lookup={}):
            if (not provider_type or provider_type == provider.get('type')) and not provider.get('is_closed', False):
                try:
                    update_provider.delay(provider)
                except Exception as err:
                    logger.exception(err)

superdesk.command('ingest:update', UpdateIngest())


@celery.task
def update_provider(provider):
    """Update given provider."""
    if provider.get('type') in providers:
        for items in providers[provider.get('type')].update(provider):
            ingest_items(provider, items)
{'fraction_non_alphanumeric': 0.10858369098712446, 'fraction_numerical': 0.0012875536480686696, 'mean_word_length': 3.4826923076923078, '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': '3001713', 'n_tokens_mistral': 643, 'n_tokens_neox': 618, 'n_words': 159}