# Path: cliff/app.py
# _SIGINT_EXIT = 130
# _SIGPIPE_EXIT = 141
#     NAME = os.path.splitext(os.path.basename(sys.argv[0]))[0]
#         NAME = os.path.split(os.path.dirname(sys.argv[0]))[-1]
#     LOG = logging.getLogger(NAME)
#     CONSOLE_MESSAGE_FORMAT = '%(message)s'
#     LOG_FILE_MESSAGE_FORMAT = \
#         '[%(asctime)s] %(levelname)-8s %(name)s %(message)s'
#     DEFAULT_VERBOSE_LEVEL = 1
#     DEFAULT_OUTPUT_ENCODING = 'utf-8'
# class App(object):
#     def __init__(self, description, version, command_manager,
#                  stdin=None, stdout=None, stderr=None,
#                  interactive_app_factory=None,
#                  deferred_help=False):
#     def _set_streams(self, stdin, stdout, stderr):
#     def build_option_parser(self, description, version,
#                             argparse_kwargs=None):
#     def configure_logging(self):
#     def print_help_if_requested(self):
#     def run(self, argv):
#     def initialize_app(self, argv):
#     def prepare_to_run_command(self, cmd):
#     def clean_up(self, cmd, result, err):
#     def interact(self):
#     def get_fuzzy_matches(self, cmd):
#     def run_subcommand(self, argv):
# 
# Path: cliff/command.py
# def _get_distributions_by_modules():
# def _get_distribution_for_module(module):
#     def __init__(self, app, app_args, cmd_name=None):
#     def _load_hooks(self):
#     def get_description(self):
#     def get_epilog(self):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
#     def run(self, parsed_args):
#     def _run_before_hooks(self, parsed_args):
#     def _run_after_hooks(self, parsed_args, return_code):
# class Command(object, metaclass=abc.ABCMeta):
# 
# Path: cliff/commandmanager.py
# LOG = logging.getLogger(__name__)
# def _get_commands_by_partial_name(args, commands):
#     def __init__(self, name, command_class):
#     def load(self, require=False):
#     def __init__(self, namespace, convert_underscores=True):
#     def _load_commands(self):
#     def load_commands(self, namespace):
#     def __iter__(self):
#     def add_command(self, name, command_class):
#     def add_legacy_command(self, old_name, new_name):
#     def find_command(self, argv):
#     def _get_last_possible_command_index(self, argv):
#     def add_command_group(self, group=None):
#     def get_command_groups(self):
#     def get_command_names(self, group=None):
# class EntryPointWrapper(object):
# class CommandManager(object):
# 
# Path: cliff/utils.py
# COST = {'w': 0, 's': 2, 'a': 1, 'd': 3}
#     STD_INPUT_HANDLE = -10
#     STD_OUTPUT_HANDLE = -11
#     STD_ERROR_HANDLE = -12
# def damerau_levenshtein(s1, s2, cost):
# def terminal_width(stdout):
# def _get_terminal_width_windows(stdout):
# def _get_terminal_width_ioctl(stdout):


import argparse
import codecs
import io
import sys
from unittest import mock
from cliff import app as application
from cliff import command as c_cmd
from cliff import commandmanager
from cliff.tests import base
from cliff.tests import utils as test_utils
from cliff import utils
        self.assertIn("test: 't' is not a test command. See 'test --help'.",
                      output)
        self.assertIn('Did you mean one of these?', output)
        self.assertIn('three word command\n  two words\n', output)

    def test_fuzzy_no_commands(self):
        cmd_mgr = commandmanager.CommandManager('cliff.fuzzy')
        app = application.App('test', '1.0', cmd_mgr)
        cmd_mgr.commands = {}
        matches = app.get_fuzzy_matches('foo')
        self.assertEqual([], matches)

    def test_fuzzy_common_prefix(self):
        # searched string is a prefix of all commands
        cmd_mgr = commandmanager.CommandManager('cliff.fuzzy')
        app = application.App('test', '1.0', cmd_mgr)
        cmd_mgr.commands = {}
        cmd_mgr.add_command('user list', test_utils.TestCommand)
        cmd_mgr.add_command('user show', test_utils.TestCommand)
        matches = app.get_fuzzy_matches('user')
        self.assertEqual(['user list', 'user show'], matches)

    def test_fuzzy_same_distance(self):
        # searched string has the same distance to all commands
        cmd_mgr = commandmanager.CommandManager('cliff.fuzzy')
        app = application.App('test', '1.0', cmd_mgr)
        cmd_mgr.add_command('user', test_utils.TestCommand)
        for cmd in cmd_mgr.commands.keys():
            self.assertEqual(
                8,

# Path: cliff/app.py
# _SIGINT_EXIT = 130
# _SIGPIPE_EXIT = 141
#     NAME = os.path.splitext(os.path.basename(sys.argv[0]))[0]
#         NAME = os.path.split(os.path.dirname(sys.argv[0]))[-1]
#     LOG = logging.getLogger(NAME)
#     CONSOLE_MESSAGE_FORMAT = '%(message)s'
#     LOG_FILE_MESSAGE_FORMAT = \
#         '[%(asctime)s] %(levelname)-8s %(name)s %(message)s'
#     DEFAULT_VERBOSE_LEVEL = 1
#     DEFAULT_OUTPUT_ENCODING = 'utf-8'
# class App(object):
#     def __init__(self, description, version, command_manager,
#                  stdin=None, stdout=None, stderr=None,
#                  interactive_app_factory=None,
#                  deferred_help=False):
#     def _set_streams(self, stdin, stdout, stderr):
#     def build_option_parser(self, description, version,
#                             argparse_kwargs=None):
#     def configure_logging(self):
#     def print_help_if_requested(self):
#     def run(self, argv):
#     def initialize_app(self, argv):
#     def prepare_to_run_command(self, cmd):
#     def clean_up(self, cmd, result, err):
#     def interact(self):
#     def get_fuzzy_matches(self, cmd):
#     def run_subcommand(self, argv):
# 
# Path: cliff/command.py
# def _get_distributions_by_modules():
# def _get_distribution_for_module(module):
#     def __init__(self, app, app_args, cmd_name=None):
#     def _load_hooks(self):
#     def get_description(self):
#     def get_epilog(self):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
#     def run(self, parsed_args):
#     def _run_before_hooks(self, parsed_args):
#     def _run_after_hooks(self, parsed_args, return_code):
# class Command(object, metaclass=abc.ABCMeta):
# 
# Path: cliff/commandmanager.py
# LOG = logging.getLogger(__name__)
# def _get_commands_by_partial_name(args, commands):
#     def __init__(self, name, command_class):
#     def load(self, require=False):
#     def __init__(self, namespace, convert_underscores=True):
#     def _load_commands(self):
#     def load_commands(self, namespace):
#     def __iter__(self):
#     def add_command(self, name, command_class):
#     def add_legacy_command(self, old_name, new_name):
#     def find_command(self, argv):
#     def _get_last_possible_command_index(self, argv):
#     def add_command_group(self, group=None):
#     def get_command_groups(self):
#     def get_command_names(self, group=None):
# class EntryPointWrapper(object):
# class CommandManager(object):
# 
# Path: cliff/utils.py
# COST = {'w': 0, 's': 2, 'a': 1, 'd': 3}
#     STD_INPUT_HANDLE = -10
#     STD_OUTPUT_HANDLE = -11
#     STD_ERROR_HANDLE = -12
# def damerau_levenshtein(s1, s2, cost):
# def terminal_width(stdout):
# def _get_terminal_width_windows(stdout):
# def _get_terminal_width_ioctl(stdout):


# Path: cliff/tests/test_app.py
import argparse
import codecs
import io
import sys
from unittest import mock
from cliff import app as application
from cliff import command as c_cmd
from cliff import commandmanager
from cliff.tests import base
from cliff.tests import utils as test_utils
from cliff import utils

        self.assertIn("test: 't' is not a test command. See 'test --help'.",
                      output)
        self.assertIn('Did you mean one of these?', output)
        self.assertIn('three word command\n  two words\n', output)

    def test_fuzzy_no_commands(self):
        cmd_mgr = commandmanager.CommandManager('cliff.fuzzy')
        app = application.App('test', '1.0', cmd_mgr)
        cmd_mgr.commands = {}
        matches = app.get_fuzzy_matches('foo')
        self.assertEqual([], matches)

    def test_fuzzy_common_prefix(self):
        # searched string is a prefix of all commands
        cmd_mgr = commandmanager.CommandManager('cliff.fuzzy')
        app = application.App('test', '1.0', cmd_mgr)
        cmd_mgr.commands = {}
        cmd_mgr.add_command('user list', test_utils.TestCommand)
        cmd_mgr.add_command('user show', test_utils.TestCommand)
        matches = app.get_fuzzy_matches('user')
        self.assertEqual(['user list', 'user show'], matches)

    def test_fuzzy_same_distance(self):
        # searched string has the same distance to all commands
        cmd_mgr = commandmanager.CommandManager('cliff.fuzzy')
        app = application.App('test', '1.0', cmd_mgr)
        cmd_mgr.add_command('user', test_utils.TestCommand)
        for cmd in cmd_mgr.commands.keys():
            self.assertEqual(
                8,

                utils.damerau_levenshtein('node', cmd, utils.COST),