# Path: stestr/output.py
# def output_table(table, output=sys.stdout):
#     def show_row(row):
# def output_tests(tests, output=sys.stdout):
# def make_result(get_id, output=sys.stdout):
# def output_summary(successful, tests, tests_delta, time, time_delta, values,
#                    output=sys.stdout):
# def output_stream(stream, output=sys.stdout):
#     def __init__(self, process):
#     def _append_return_code_as_test(self):
#     def read(self, count=-1):
#     def readline(self):
#     def readlines(self):
# class ReturnCodeToSubunit:
# 
# Path: stestr/repository/util.py
# def _get_default_repo_url(repo_type):
# def get_repo_open(repo_type, repo_url=None):
# def get_repo_initialise(repo_type, repo_url=None):
# 
# Path: stestr/results.py
# def wasSuccessful(summary):
#     def __init__(self):
#     def startTestRun(self):
#     def status(self, *args, **kwargs):
#     def get_num_failures(self):
#     def get_time_taken(self):
#     def __init__(self, byte_stream):
#     def status(self, test_id=None, test_status=None, test_tags=None,
#                runnable=True, file_name=None, file_bytes=None, eof=False,
#                mime_type=None, route_code=None, timestamp=None):
#     def __init__(self, get_id, stream, previous_run=None):
#     def _format_error(self, label, test, error_text, test_tags=None):
#     def status(self, **kwargs):
#     def _get_previous_summary(self):
#     def _output_summary(self, run_id):
#     def startTestRun(self):
#     def stopTestRun(self):
#     def get_summary(self):
# class SummarizingResult(testtools.StreamSummary):
# class CatFiles(testtools.StreamResult):
# class CLITestResult(testtools.StreamResult):
# 
# Path: stestr/user_config.py
# def get_user_config(path=None):
#     def __init__(self, path):
#     def run(self):
#     def failing(self):
#     def last(self):
#     def load(self):
#     def history_list(self):
#     def history_show(self):
# class UserConfig:


import sys
import testtools
from cliff import command
from stestr import output
from stestr.repository import util
from stestr import results
from stestr import user_config





class Failing(command.Command):
    """Show the current failures known by the repository.

    Without --subunit, the process exit code will be non-zero if the
    previous test run was not successful and test failures are shown. But,
    with --subunit, the process exit code is non-zero only if the subunit
    stream could not be generated successfully from any failures. The test
    results and run status are included in the subunit stream emitted for
    the failed tests, so the stream should be used for interpretting the
    failing tests. If no subunit stream is emitted with --subunit and a
    zero exit code then there were no failures in the most recent run in
    the repository.
    """

    def get_parser(self, prog_name):
        parser = super().get_parser(prog_name)
        parser.add_argument(
            "--subunit", action="store_true",
            default=False, help="Show output as a subunit stream.")
        parser.add_argument(
            "--list", action="store_true",
            default=False, help="Show only a list of failing tests.")
        return parser

    def take_action(self, parsed_args):

# Path: stestr/output.py
# def output_table(table, output=sys.stdout):
#     def show_row(row):
# def output_tests(tests, output=sys.stdout):
# def make_result(get_id, output=sys.stdout):
# def output_summary(successful, tests, tests_delta, time, time_delta, values,
#                    output=sys.stdout):
# def output_stream(stream, output=sys.stdout):
#     def __init__(self, process):
#     def _append_return_code_as_test(self):
#     def read(self, count=-1):
#     def readline(self):
#     def readlines(self):
# class ReturnCodeToSubunit:
# 
# Path: stestr/repository/util.py
# def _get_default_repo_url(repo_type):
# def get_repo_open(repo_type, repo_url=None):
# def get_repo_initialise(repo_type, repo_url=None):
# 
# Path: stestr/results.py
# def wasSuccessful(summary):
#     def __init__(self):
#     def startTestRun(self):
#     def status(self, *args, **kwargs):
#     def get_num_failures(self):
#     def get_time_taken(self):
#     def __init__(self, byte_stream):
#     def status(self, test_id=None, test_status=None, test_tags=None,
#                runnable=True, file_name=None, file_bytes=None, eof=False,
#                mime_type=None, route_code=None, timestamp=None):
#     def __init__(self, get_id, stream, previous_run=None):
#     def _format_error(self, label, test, error_text, test_tags=None):
#     def status(self, **kwargs):
#     def _get_previous_summary(self):
#     def _output_summary(self, run_id):
#     def startTestRun(self):
#     def stopTestRun(self):
#     def get_summary(self):
# class SummarizingResult(testtools.StreamSummary):
# class CatFiles(testtools.StreamResult):
# class CLITestResult(testtools.StreamResult):
# 
# Path: stestr/user_config.py
# def get_user_config(path=None):
#     def __init__(self, path):
#     def run(self):
#     def failing(self):
#     def last(self):
#     def load(self):
#     def history_list(self):
#     def history_show(self):
# class UserConfig:


# Path: stestr/commands/failing.py
import sys
import testtools
from cliff import command
from stestr import output
from stestr.repository import util
from stestr import results
from stestr import user_config






class Failing(command.Command):
    """Show the current failures known by the repository.

    Without --subunit, the process exit code will be non-zero if the
    previous test run was not successful and test failures are shown. But,
    with --subunit, the process exit code is non-zero only if the subunit
    stream could not be generated successfully from any failures. The test
    results and run status are included in the subunit stream emitted for
    the failed tests, so the stream should be used for interpretting the
    failing tests. If no subunit stream is emitted with --subunit and a
    zero exit code then there were no failures in the most recent run in
    the repository.
    """

    def get_parser(self, prog_name):
        parser = super().get_parser(prog_name)
        parser.add_argument(
            "--subunit", action="store_true",
            default=False, help="Show output as a subunit stream.")
        parser.add_argument(
            "--list", action="store_true",
            default=False, help="Show only a list of failing tests.")
        return parser

    def take_action(self, parsed_args):

        user_conf = user_config.get_user_config(self.app_args.user_config)