# Path: lib/utils/debug.py
# def Debug(classification, text):
#     if 'all' in print_classifications or classification in print_classifications:
#         print("ArcticTypescript: %s: %s" % (classification.ljust(8), text))
#     if classification not in possible_classifications:
#         print("ArcticTypescript: debug: got unknown debug message classification: %s. " \
#             "Consider adding this to possible_classifications" % classification)
#     sys.stdout.flush()
# 
# Path: lib/utils/disabling.py
# def is_plugin_temporarily_disabled(folder=None):
#     """ Returns True if the plugin is disabled globally or for folder.
#         Folder can be a view """
#     if is_plugin_globally_disabled() or folder is None:
#         return is_plugin_globally_disabled()
#     if folder is not None and isinstance(folder, sublime.View):
#         if folder.file_name() is None:
#             return is_plugin_globally_disabled()
#         folder = os.path.dirname(folder.file_name())
#     folder = os.path.normcase(folder)
#     return folder in plugin_disabled_for_folders


from .debug import Debug
from .disabling import is_plugin_temporarily_disabled
# coding=utf8


# CANCEL COMMAND EXCEPTION
class CancelCommand(Exception):
    """ Throw this exception in a command. The decorator
        catch_CancelCommand will catch it and cancel silently """
    pass

# CANCEL COMMAND EXCEPTION CATCHER DECORATOR
def catch_CancelCommand(func):
    """ Decorate every command with this one. It will check for
        the plugin disabled flag and catch CancelCommand exceptins. """

    def catcher(*kargs, **kwargs):
        if is_plugin_temporarily_disabled():
            return # do not execute command
        try:
            return func(*kargs, **kwargs)
        except CancelCommand:
            Debug('command', "A COMMAND WAS CANCELED")

# Path: lib/utils/debug.py
# def Debug(classification, text):
#     if 'all' in print_classifications or classification in print_classifications:
#         print("ArcticTypescript: %s: %s" % (classification.ljust(8), text))
#     if classification not in possible_classifications:
#         print("ArcticTypescript: debug: got unknown debug message classification: %s. " \
#             "Consider adding this to possible_classifications" % classification)
#     sys.stdout.flush()
# 
# Path: lib/utils/disabling.py
# def is_plugin_temporarily_disabled(folder=None):
#     """ Returns True if the plugin is disabled globally or for folder.
#         Folder can be a view """
#     if is_plugin_globally_disabled() or folder is None:
#         return is_plugin_globally_disabled()
#     if folder is not None and isinstance(folder, sublime.View):
#         if folder.file_name() is None:
#             return is_plugin_globally_disabled()
#         folder = os.path.dirname(folder.file_name())
#     folder = os.path.normcase(folder)
#     return folder in plugin_disabled_for_folders


# Path: lib/utils/CancelCommand.py
from .debug import Debug
from .disabling import is_plugin_temporarily_disabled

# coding=utf8


# CANCEL COMMAND EXCEPTION
class CancelCommand(Exception):
    """ Throw this exception in a command. The decorator
        catch_CancelCommand will catch it and cancel silently """
    pass

# CANCEL COMMAND EXCEPTION CATCHER DECORATOR
def catch_CancelCommand(func):
    """ Decorate every command with this one. It will check for
        the plugin disabled flag and catch CancelCommand exceptins. """

    def catcher(*kargs, **kwargs):
        if is_plugin_temporarily_disabled():
            return # do not execute command
        try:
            return func(*kargs, **kwargs)
        except CancelCommand:
            Debug('command', "A COMMAND WAS CANCELED")

            return False