B
    )`d
                 @   sF   d Z ddlmZ ddlmZ ddlmZ ddlZddgZd
dd	ZdS )z3TensorFlow Debugger (tfdbg) User-Interface Factory.    )absolute_import)division)print_functionNcursesreadlinec             C   s   |dkrt t}| r*| |kr*td|  yL| r8| dkrRddlm} |j||dS | dkrtddlm} |j||dS W n6 t	k
r   |
|  |std	t|d |d
S X dS )a  Create a `base_ui.BaseUI` subtype.

  This factory method attempts to fallback to other available ui_types on
  ImportError. For example, if `ui_type` is `curses`, but `curses` cannot be
  imported properly, e.g., on Windows, will fallback to `readline`.

  Args:
    ui_type: (`str`) requested UI type. Currently supported:
      (curses | readline)
    on_ui_exit: (`Callable`) the callback to be called when the UI exits.
    available_ui_types: (`None` or `list` of `str`) Manually-set available
      ui_types.
    config: An instance of `cli_config.CLIConfig()` carrying user-facing
      configurations.

  Returns:
    A `base_ui.BaseUI` subtype object.

  Raises:
    ValueError: on invalid ui_type or on exhausting or fallback ui_types.
  NzInvalid ui_type: '%s'r   r   )	curses_ui)
on_ui_exitconfigr   )readline_uiz Exhausted all fallback ui_types.)available_ui_types)copydeepcopySUPPORTED_UI_TYPES
ValueErrorZtensorflow.python.debug.clir   ZCursesUIr
   Z
ReadlineUIImportErrorremoveget_ui)Zui_typer   r   r	   r   r
    r   U/home/dcms/DCMS/lib/python3.7/site-packages/tensorflow/python/debug/cli/ui_factory.pyr      s"    

r   )NNN)__doc__
__future__r   r   r   r   r   r   r   r   r   r   <module>   s     