# Path: picatrix/lib/state.py
# def state(refresh_state: bool = False):
#   """Property that returns a state object."""
#   # pylint: disable=global-statement
#   # Making sure we have only one state object.
#   global __state
# 
#   with _LOCK:
#     if refresh_state or __state is None:
#       __state = State()
# 
#     return __state
# 
# Path: picatrix/lib/utils.py
# def ask_question(question: Text, input_type: Optional[Any] = Text) -> Any:
# def clear_notebook_output():
# def ipython_bind_global(name: Text, value: Any) -> Any:
# def ipython_get_global(name: Text) -> Any:
# def ipython_remove_global(name: Text):


import functools
import pandas
from dataclasses import dataclass
from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union
from IPython import get_ipython
from picatrix.lib import state, utils
    Args:
      helper_name (str): the name of the helper to remove.

    Raises:
      KeyError: if the helper is not registered.
    """
    if helper_name not in cls._helpers:
      raise KeyError(f'Helper [{helper_name}] is not registered.')

    _ = cls._helpers.pop(helper_name)
    try:
      utils.ipython_remove_global(helper_name)
    except KeyError:
      pass

  @classmethod
  def deregister_magic(cls, magic_name: Text):
    """Removes a magic from the registration.

    Args:
      magic_name (str): the name of the magic to remove.

    Raises:
      KeyError: if the magic is not registered.
    """
    if magic_name not in cls._magics:
      raise KeyError(f'Magic [{magic_name}] is not registered.')

    _ = cls._magics.pop(magic_name)
    try:

# Path: picatrix/lib/state.py
# def state(refresh_state: bool = False):
#   """Property that returns a state object."""
#   # pylint: disable=global-statement
#   # Making sure we have only one state object.
#   global __state
# 
#   with _LOCK:
#     if refresh_state or __state is None:
#       __state = State()
# 
#     return __state
# 
# Path: picatrix/lib/utils.py
# def ask_question(question: Text, input_type: Optional[Any] = Text) -> Any:
# def clear_notebook_output():
# def ipython_bind_global(name: Text, value: Any) -> Any:
# def ipython_get_global(name: Text) -> Any:
# def ipython_remove_global(name: Text):


# Path: picatrix/lib/manager.py
import functools
import pandas
from dataclasses import dataclass
from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union
from IPython import get_ipython
from picatrix.lib import state, utils

    Args:
      helper_name (str): the name of the helper to remove.

    Raises:
      KeyError: if the helper is not registered.
    """
    if helper_name not in cls._helpers:
      raise KeyError(f'Helper [{helper_name}] is not registered.')

    _ = cls._helpers.pop(helper_name)
    try:
      utils.ipython_remove_global(helper_name)
    except KeyError:
      pass

  @classmethod
  def deregister_magic(cls, magic_name: Text):
    """Removes a magic from the registration.

    Args:
      magic_name (str): the name of the magic to remove.

    Raises:
      KeyError: if the magic is not registered.
    """
    if magic_name not in cls._magics:
      raise KeyError(f'Magic [{magic_name}] is not registered.')

    _ = cls._magics.pop(magic_name)
    try:

      utils.ipython_remove_global(f'{magic_name}_func')