MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / __init__

Method __init__

tensorflow/python/debug/cli/base_ui.py:35–70  ·  view source on GitHub ↗

Constructor of the base class. Args: on_ui_exit: (`Callable`) the callback to be called when the UI exits. config: An instance of `cli_config.CLIConfig()` carrying user-facing configurations.

(self, on_ui_exit=None, config=None)

Source from the content-addressed store, hash-verified

33 INFO_MESSAGE_PREFIX = "INFO: "
34
35 def __init__(self, on_ui_exit=None, config=None):
36 """Constructor of the base class.
37
38 Args:
39 on_ui_exit: (`Callable`) the callback to be called when the UI exits.
40 config: An instance of `cli_config.CLIConfig()` carrying user-facing
41 configurations.
42 """
43
44 self._on_ui_exit = on_ui_exit
45
46 self._command_handler_registry = (
47 debugger_cli_common.CommandHandlerRegistry())
48
49 self._tab_completion_registry = debugger_cli_common.TabCompletionRegistry()
50
51 # Create top-level tab-completion context and register the exit and help
52 # commands.
53 self._tab_completion_registry.register_tab_comp_context(
54 [""], self.CLI_EXIT_COMMANDS +
55 [debugger_cli_common.CommandHandlerRegistry.HELP_COMMAND] +
56 debugger_cli_common.CommandHandlerRegistry.HELP_COMMAND_ALIASES)
57
58 self._config = config or cli_config.CLIConfig()
59 self._config_argparser = argparse.ArgumentParser(
60 description="config command", usage=argparse.SUPPRESS)
61 subparsers = self._config_argparser.add_subparsers()
62 set_parser = subparsers.add_parser("set")
63 set_parser.add_argument("property_name", type=str)
64 set_parser.add_argument("property_value", type=str)
65 set_parser = subparsers.add_parser("show")
66 self.register_command_handler(
67 "config",
68 self._config_command_handler,
69 self._config_argparser.format_help(),
70 prefix_aliases=["cfg"])
71
72 def set_help_intro(self, help_intro):
73 """Set an introductory message to the help output of the command registry.

Callers

nothing calls this directly

Calls 3

add_argumentMethod · 0.80

Tested by

no test coverage detected