<commit_before># Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved

import sys

from django.core.management.base import BaseCommand

from awx.main.task_engine import TaskSerializer


class Command(BaseCommand):
    """Return a exit status of 0 if MongoDB should be active, and an
    exit status of 1 otherwise.

    This script is intended to be used by bash and init scripts to
    conditionally start MongoDB, so its focus is on being bash-friendly.
    """
    def handle(self, **kwargs):
        # Get the license data.
        license_reader = TaskSerializer()
        license_data = license_reader.from_file()

        # Does the license contain the system tracking feature?
        # If and only if it does, MongoDB should run.
        system_tracking = license_data['features']['system_tracking']

        # Okay, do we need MongoDB to be turned on?
        # This is a silly variable assignment right now, but I expect the
        # rules here will grow more complicated over time.
        # FIXME: Most likely this should be False if HA is active
        #        (not just enabled by license, but actually in use).
        uses_mongo = system_tracking

        # If we do not need Mongo, return a non-zero exit status.
        print('MongoDB NOT required')
        sys.exit(1)
<commit_msg>Set noqa to silence flake8.<commit_after># Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved

import sys

from django.core.management.base import BaseCommand

from awx.main.task_engine import TaskSerializer


class Command(BaseCommand):
    """Return a exit status of 0 if MongoDB should be active, and an
    exit status of 1 otherwise.

    This script is intended to be used by bash and init scripts to
    conditionally start MongoDB, so its focus is on being bash-friendly.
    """
    def handle(self, **kwargs):
        # Get the license data.
        license_reader = TaskSerializer()
        license_data = license_reader.from_file()

        # Does the license contain the system tracking feature?
        # If and only if it does, MongoDB should run.
        system_tracking = license_data['features']['system_tracking']

        # Okay, do we need MongoDB to be turned on?
        # This is a silly variable assignment right now, but I expect the
        # rules here will grow more complicated over time.
        # FIXME: Most likely this should be False if HA is active
        #        (not just enabled by license, but actually in use).
        uses_mongo = system_tracking  # noqa

        # If we do not need Mongo, return a non-zero exit status.
        print('MongoDB NOT required')
        sys.exit(1)

{'fraction_non_alphanumeric': 0.06378132118451026, 'fraction_numerical': 0.0056947608200455585, 'mean_word_length': 2.7165021156558535, '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': '4320100', 'n_tokens_mistral': 716, 'n_tokens_neox': 673, 'n_words': 321}