<commit_before># Copyright 2014 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Handling of command line arguments shared by multiple xylem commands.

This includes arguments related to the configuration (see
:mod:`xylem.config`).
"""

from __future__ import unicode_literals

import argparse
import pydoc
import os
from six import StringIO

from xylem.config import add_global_config_arguments
from xylem.config import handle_global_config_arguments

from xylem.util import enable_pdb
from xylem.log_utils import enable_verbose
from xylem.log_utils import enable_debug
from xylem.terminal_color import disable_ANSI_colors


class PagerHelpAction(argparse._HelpAction):

    """Custom help action that uses pydoc.pager.<commit_msg>arguments: TODO<commit_after># Copyright 2014 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Handling of command line arguments shared by multiple xylem commands.

This includes arguments related to the configuration (see
:mod:`xylem.config`).
"""

from __future__ import unicode_literals

import argparse
import pydoc
import os
from six import StringIO

from xylem.config import add_global_config_arguments
from xylem.config import handle_global_config_arguments

from xylem.util import enable_pdb
from xylem.log_utils import enable_verbose
from xylem.log_utils import enable_debug
from xylem.terminal_color import disable_ANSI_colors


# TODO: update the help output such that the usage line does not include
#       global and config arguments for improved readability. Maybe just
#       add them as `usage: xylem ... [CONFIG_OPTIONS] [GLOBAL_OPTIONS]`


class PagerHelpAction(argparse._HelpAction):

    """Custom help action that uses pydoc.pager.
{'fraction_non_alphanumeric': 0.05803409503083061, 'fraction_numerical': 0.005803409503083061, 'mean_word_length': 5.061538461538461, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2180649', 'n_tokens_mistral': 750, 'n_tokens_neox': 725, 'n_words': 331}