# Path: invoke/util.py
# LOG_FORMAT = "%(name)s.%(module)s.%(funcName)s: %(message)s"
# def enable_logging():
# def task_name_sort_key(name):
# def cd(where):
# def has_fileno(stream):
# def isatty(stream):
# def encode_output(string, encoding):
# def helpline(obj):
#     def __init__(self, **kwargs):
#     def run(self):
#     def exception(self):
#     def is_dead(self):
#     def __repr__(self):
# class ExceptionHandlingThread(threading.Thread):
# 
# Path: invoke/exceptions.py
# class ParseError(Exception):
#     """
#     An error arising from the parsing of command-line flags/arguments.
# 
#     Ambiguous input, invalid task names, invalid flags, etc.
# 
#     .. versionadded:: 1.0
#     """
# 
#     def __init__(self, msg, context=None):
#         super(ParseError, self).__init__(msg)
#         self.context = context


import copy
    from ..vendor.lexicon import Lexicon
    from ..vendor.fluidity import StateMachine, state, transition
    from lexicon import Lexicon
    from fluidity import StateMachine, state, transition
from ..util import debug
from ..exceptions import ParseError
            )
            self.error(err.format(self.context.name, names))
        if self.context and self.context not in self.result:
            self.result.append(self.context)

    def switch_to_context(self, name):
        self.context = copy.deepcopy(self.contexts[name])
        debug("Moving to context {!r}".format(name))
        debug("Context args: {!r}".format(self.context.args))
        debug("Context flags: {!r}".format(self.context.flags))
        debug("Context inverse_flags: {!r}".format(self.context.inverse_flags))

    def complete_flag(self):
        if self.flag:
            msg = "Completing current flag {} before moving on"
            debug(msg.format(self.flag))
        # Barf if we needed a value and didn't get one
        if (
            self.flag
            and self.flag.takes_value
            and self.flag.raw_value is None
            and not self.flag.optional
        ):
            err = "Flag {!r} needed value and was not given one!"
            self.error(err.format(self.flag))
        # Handle optional-value flags; at this point they were not given an
        # explicit value, but they were seen, ergo they should get treated like
        # bools.
        if self.flag and self.flag.raw_value is None and self.flag.optional:
            msg = "Saw optional flag {!r} go by w/ no value; setting to True"

# Path: invoke/util.py
# LOG_FORMAT = "%(name)s.%(module)s.%(funcName)s: %(message)s"
# def enable_logging():
# def task_name_sort_key(name):
# def cd(where):
# def has_fileno(stream):
# def isatty(stream):
# def encode_output(string, encoding):
# def helpline(obj):
#     def __init__(self, **kwargs):
#     def run(self):
#     def exception(self):
#     def is_dead(self):
#     def __repr__(self):
# class ExceptionHandlingThread(threading.Thread):
# 
# Path: invoke/exceptions.py
# class ParseError(Exception):
#     """
#     An error arising from the parsing of command-line flags/arguments.
# 
#     Ambiguous input, invalid task names, invalid flags, etc.
# 
#     .. versionadded:: 1.0
#     """
# 
#     def __init__(self, msg, context=None):
#         super(ParseError, self).__init__(msg)
#         self.context = context


# Path: invoke/parser/parser.py
import copy
    from ..vendor.lexicon import Lexicon
    from ..vendor.fluidity import StateMachine, state, transition
    from lexicon import Lexicon
    from fluidity import StateMachine, state, transition
from ..util import debug
from ..exceptions import ParseError

            )
            self.error(err.format(self.context.name, names))
        if self.context and self.context not in self.result:
            self.result.append(self.context)

    def switch_to_context(self, name):
        self.context = copy.deepcopy(self.contexts[name])
        debug("Moving to context {!r}".format(name))
        debug("Context args: {!r}".format(self.context.args))
        debug("Context flags: {!r}".format(self.context.flags))
        debug("Context inverse_flags: {!r}".format(self.context.inverse_flags))

    def complete_flag(self):
        if self.flag:
            msg = "Completing current flag {} before moving on"
            debug(msg.format(self.flag))
        # Barf if we needed a value and didn't get one
        if (
            self.flag
            and self.flag.takes_value
            and self.flag.raw_value is None
            and not self.flag.optional
        ):
            err = "Flag {!r} needed value and was not given one!"
            self.error(err.format(self.flag))
        # Handle optional-value flags; at this point they were not given an
        # explicit value, but they were seen, ergo they should get treated like
        # bools.
        if self.flag and self.flag.raw_value is None and self.flag.optional:
            msg = "Saw optional flag {!r} go by w/ no value; setting to True"

            debug(msg.format(self.flag.name))