<commit_before>from __future__ import print_function

import argparse
from multiprocessing import cpu_count

from dvc.command.init import CmdInit
from dvc.command.remove import CmdRemove
from dvc.command.run import CmdRun
from dvc.command.repro import CmdRepro
from dvc.command.data_sync import CmdDataSync, CmdDataPush, CmdDataPull, CmdDataStatus
from dvc.command.lock import CmdLock
from dvc.command.gc import CmdGC
from dvc.command.import_file import CmdImportFile
from dvc.command.show_workflow import CmdShowWorkflow
from dvc.command.instance_create import CmdInstanceCreate
from dvc.command.config import CmdConfig
from dvc.command.show_pipeline import CmdShowPipeline
from dvc import VERSION


def parse_args(argv=None):
    # Common args
    parent_parser = argparse.ArgumentParser(add_help=False)
    parent_parser.add_argument('-q',
                        '--quiet',
                        action='store_true',
                        default=False,
                        help='Be quiet.')
    parent_parser.add_argument('-v',
                        '--verbose',
                        action='store_true',
                        default=False,
                        help='Be verbose.')
    parent_parser.add_argument('-G',
                        '--no-git-actions',
                        action='store_true',
                        default=False,
                        help='Skip all git actions including reproducibility check and commits.')

    # Main parser
    desc = 'Data Version Control'
    parser = argparse.ArgumentParser(
                        prog='dvc',
                        description=desc,
                        parents=[parent_parser],
                        formatter_class=argparse.RawTextHelpFormatter)

    parser.add_argument('-V',
                        '--version',
                        action='version',
                        version='%(prog)s ' + VERSION)

    # Sub commands
    subparsers = parser.add_subparsers(
                        dest='cmd',
                        help='Use dvc CMD --help for command-specific help')

    # Init
    init_parser = subparsers.add_parser(
                        'init',
                        parents=[parent_parser],
                        help='Initialize dvc over a directory (should already be a git dir).')
    init_parser.add_argument(
                        '--data-dir',
                        default='data',
                        help='Data directory.')
    init_parser.set_defaults(func=CmdInit)

    # Run
    run_parser = subparsers.add_parser(
                        'run',
                        parents=[parent_parser],
                        help='Run command')
    run_parser.add_argument(
                        '--stdout',
                        help='Output std output to a file.')
    run_parser.add_argument(
                        '--stderr',
                        help='Output std error to a file.')
    run_parser.add_argument('-i',
                        '--input',
                        action='append',
                        help='Declare input data items for reproducible cmd.')
    run_parser.add_argument('-o',
                        '--output',
                        action='append',<commit_msg>python3: cli: add workaround for required subcommand<commit_after>from __future__ import print_function

import sys
import argparse
from multiprocessing import cpu_count

from dvc.command.init import CmdInit
from dvc.command.remove import CmdRemove
from dvc.command.run import CmdRun
from dvc.command.repro import CmdRepro
from dvc.command.data_sync import CmdDataSync, CmdDataPush, CmdDataPull, CmdDataStatus
from dvc.command.lock import CmdLock
from dvc.command.gc import CmdGC
from dvc.command.import_file import CmdImportFile
from dvc.command.show_workflow import CmdShowWorkflow
from dvc.command.instance_create import CmdInstanceCreate
from dvc.command.config import CmdConfig
from dvc.command.show_pipeline import CmdShowPipeline
from dvc import VERSION


def parse_args(argv=None):
    # Common args
    parent_parser = argparse.ArgumentParser(add_help=False)
    parent_parser.add_argument('-q',
                        '--quiet',
                        action='store_true',
                        default=False,
                        help='Be quiet.')
    parent_parser.add_argument('-v',
                        '--verbose',
                        action='store_true',
                        default=False,
                        help='Be verbose.')
    parent_parser.add_argument('-G',
                        '--no-git-actions',
                        action='store_true',
                        default=False,
                        help='Skip all git actions including reproducibility check and commits.')

    # Main parser
    desc = 'Data Version Control'
    parser = argparse.ArgumentParser(
                        prog='dvc',
                        description=desc,
                        parents=[parent_parser],
                        formatter_class=argparse.RawTextHelpFormatter)

    parser.add_argument('-V',
                        '--version',
                        action='version',
                        version='%(prog)s ' + VERSION)

    # Sub commands
    subparsers = parser.add_subparsers(
                        dest='cmd',
                        help='Use dvc CMD --help for command-specific help')

    # NOTE: Workaround for bug in Python 3
    if sys.version_info[0] == 3:
        subparsers.required = True
        subparsers.dest = 'cmd'

    # Init
    init_parser = subparsers.add_parser(
                        'init',
                        parents=[parent_parser],
                        help='Initialize dvc over a directory (should already be a git dir).')
    init_parser.add_argument(
                        '--data-dir',
                        default='data',
                        help='Data directory.')
    init_parser.set_defaults(func=CmdInit)

    # Run
    run_parser = subparsers.add_parser(
                        'run',
                        parents=[parent_parser],
                        help='Run command')
    run_parser.add_argument(
                        '--stdout',
                        help='Output std output to a file.')
    run_parser.add_argument(
                        '--stderr',
                        help='Output std error to a file.')
    run_parser.add_argument('-i',
                        '--input',
                        action='append',
                        help='Declare input data items for reproducible cmd.')
    run_parser.add_argument('-o',
                        '--output',
                        action='append',
{'fraction_non_alphanumeric': 0.08546754020250148, 'fraction_numerical': 0.0005955926146515784, 'mean_word_length': 1.526137645731478, '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': '6379572', 'n_tokens_mistral': 1737, 'n_tokens_neox': 1620, 'n_words': 387}