# Path: esc/modes.py
# MODES = {}
# class Mode:
#     def __init__(self, name, value, allowable_values):
#     def value(self):
#     def value(self, val):
# def get(name):
# def register(name, default_value, allowable_values=None):
# def set(name, val):
# 
# Path: esc/commands.py
# BINOP = 'binop'
# UNOP = 'unop'
# MAIN_DOC = """
#     The main menu. All other esc functions and menus are eventually accessible
#     from this menu.
# """
# class EscCommand:
# class EscMenu(EscCommand):
# class EscOperation(EscCommand):
# class EscBuiltin(EscCommand):
#     def __init__(self, key, description):
#     def help_title(self):
#     def signature_info(self):
#     def execute(self, access_key, ss, registry):
#     def register_child(self, child):
#     def simulated_result(self, ss, registry):  # pylint: disable=no-self-use, unused-argument
#     def test(self):
#     def __init__(self, key, description, doc, mode_display=None):
#     def __repr__(self):
#     def signature_info(self):
#     def is_main_menu(self):
#     def anonymous_children(self):
#     def named_children(self):
#     def child(self, access_key):
#     def execute(self, access_key, ss, registry):
#     def test(self):
#     def __init__(self, key, func, pop, push, description, menu, retain=False,
#                  log_as=None, simulate=True):
#     def __repr__(self):
#     def __doc__(self):
#     def signature_info(self):
#     def _describe_operation(self, args, retvals, registry):
#     def _insufficient_items_on_stack(self, pops_requested=None):
#     def _retrieve_arguments(self, ss):
#     def _simulated_description(self, args, log, results):
#     def _store_results(self, ss, args, return_values, registry):
#     def execute(self, access_key, ss, registry):  # pylint: disable=useless-return
#     def simulated_result(self, ss, registry):
#     def test(self):
#     def __init__(self):
#     def execute(self, access_key, ss, registry):  # pylint: disable=useless-return
#     def simulated_result(self, ss, registry):
#     def test(self):
#     def signature_info(self):
# def Menu(key, description, parent, doc, mode_display=None):  # pylint: disable=invalid-name
# def Constant(value, key, description, menu):  # pylint: disable=invalid-name
#     def func():
# def Operation(key, menu, push, description=None, retain=False, log_as=None, simulate=True):  # pylint: disable=invalid-name
#     def function_decorator(func):
#         def _bind_stack_parm(stack_item, parm):
#         def wrapper(stack, registry):
#         def ensure(before, after=None, raises=None, close=False):
# def Mode(name, default_value, allowable_values=None):  # pylint: disable=invalid-name
# def ModeChange(key, description, menu, mode_name, to_value):  # pylint: disable=invalid-name


import math
from esc import modes
from esc.commands import Menu, Operation, Mode, ModeChange, UNOP, main_menu
trig_doc = """
    Calculate the values of trigonometric functions, treating inputs as
    either degrees or radians depending on the mode.
"""


def trig_mode_display():
    return f"[{modes.get(TRIG_MODE_NAME)}]"


trig_menu = Menu('t', 'trig menu', parent=main_menu,
                 doc=trig_doc,
                 mode_display=trig_mode_display)


def trig_wrapper(bos, func, arc=False):
    """
    Used anytime a trig Operation is called. Performs any conversions from
    degrees to radians and vice versa, as called for by modes.trigMode (all
    Python math module functions use only radians).

    Takes the requested stack item, a Operation to be called on the value
    after/before the appropriate conversion, and a boolean indicating whether
    this is an arc/inverse Operation (requiring radian->degree after
    computation) or a forward one (requiring degree->radian before
    computation).

    Returns the new value of the stack as passed out by the provided Operation,
    after possible conversion to degrees.
    """

# Path: esc/modes.py
# MODES = {}
# class Mode:
#     def __init__(self, name, value, allowable_values):
#     def value(self):
#     def value(self, val):
# def get(name):
# def register(name, default_value, allowable_values=None):
# def set(name, val):
# 
# Path: esc/commands.py
# BINOP = 'binop'
# UNOP = 'unop'
# MAIN_DOC = """
#     The main menu. All other esc functions and menus are eventually accessible
#     from this menu.
# """
# class EscCommand:
# class EscMenu(EscCommand):
# class EscOperation(EscCommand):
# class EscBuiltin(EscCommand):
#     def __init__(self, key, description):
#     def help_title(self):
#     def signature_info(self):
#     def execute(self, access_key, ss, registry):
#     def register_child(self, child):
#     def simulated_result(self, ss, registry):  # pylint: disable=no-self-use, unused-argument
#     def test(self):
#     def __init__(self, key, description, doc, mode_display=None):
#     def __repr__(self):
#     def signature_info(self):
#     def is_main_menu(self):
#     def anonymous_children(self):
#     def named_children(self):
#     def child(self, access_key):
#     def execute(self, access_key, ss, registry):
#     def test(self):
#     def __init__(self, key, func, pop, push, description, menu, retain=False,
#                  log_as=None, simulate=True):
#     def __repr__(self):
#     def __doc__(self):
#     def signature_info(self):
#     def _describe_operation(self, args, retvals, registry):
#     def _insufficient_items_on_stack(self, pops_requested=None):
#     def _retrieve_arguments(self, ss):
#     def _simulated_description(self, args, log, results):
#     def _store_results(self, ss, args, return_values, registry):
#     def execute(self, access_key, ss, registry):  # pylint: disable=useless-return
#     def simulated_result(self, ss, registry):
#     def test(self):
#     def __init__(self):
#     def execute(self, access_key, ss, registry):  # pylint: disable=useless-return
#     def simulated_result(self, ss, registry):
#     def test(self):
#     def signature_info(self):
# def Menu(key, description, parent, doc, mode_display=None):  # pylint: disable=invalid-name
# def Constant(value, key, description, menu):  # pylint: disable=invalid-name
#     def func():
# def Operation(key, menu, push, description=None, retain=False, log_as=None, simulate=True):  # pylint: disable=invalid-name
#     def function_decorator(func):
#         def _bind_stack_parm(stack_item, parm):
#         def wrapper(stack, registry):
#         def ensure(before, after=None, raises=None, close=False):
# def Mode(name, default_value, allowable_values=None):  # pylint: disable=invalid-name
# def ModeChange(key, description, menu, mode_name, to_value):  # pylint: disable=invalid-name


# Path: esc-plugins/trig.py
import math
from esc import modes
from esc.commands import Menu, Operation, Mode, ModeChange, UNOP, main_menu

trig_doc = """
    Calculate the values of trigonometric functions, treating inputs as
    either degrees or radians depending on the mode.
"""


def trig_mode_display():
    return f"[{modes.get(TRIG_MODE_NAME)}]"


trig_menu = Menu('t', 'trig menu', parent=main_menu,
                 doc=trig_doc,
                 mode_display=trig_mode_display)


def trig_wrapper(bos, func, arc=False):
    """
    Used anytime a trig Operation is called. Performs any conversions from
    degrees to radians and vice versa, as called for by modes.trigMode (all
    Python math module functions use only radians).

    Takes the requested stack item, a Operation to be called on the value
    after/before the appropriate conversion, and a boolean indicating whether
    this is an arc/inverse Operation (requiring radian->degree after
    computation) or a forward one (requiring degree->radian before
    computation).

    Returns the new value of the stack as passed out by the provided Operation,
    after possible conversion to degrees.
    """

    if modes.get(TRIG_MODE_NAME) == 'degrees' and not arc: