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

Method _babble

tensorflow/python/debug/cli/curses_ui_test.py:239–291  ·  view source on GitHub ↗
(self, args, screen_info=None)

Source from the content-addressed store, hash-verified

237 _EXIT = string_to_codes("exit\n")
238
239 def _babble(self, args, screen_info=None):
240 ap = argparse.ArgumentParser(
241 description="Do babble.", usage=argparse.SUPPRESS)
242 ap.add_argument(
243 "-n",
244 "--num_times",
245 dest="num_times",
246 type=int,
247 default=60,
248 help="How many times to babble")
249 ap.add_argument(
250 "-l",
251 "--line",
252 dest="line",
253 type=str,
254 default="bar",
255 help="The content of each line")
256 ap.add_argument(
257 "-k",
258 "--link",
259 dest="link",
260 action="store_true",
261 help="Create a command link on each line")
262 ap.add_argument(
263 "-m",
264 "--menu",
265 dest="menu",
266 action="store_true",
267 help="Create a menu for testing")
268
269 parsed = ap.parse_args(args)
270
271 lines = [parsed.line] * parsed.num_times
272 font_attr_segs = {}
273 if parsed.link:
274 for i in range(len(lines)):
275 font_attr_segs[i] = [(
276 0,
277 len(lines[i]),
278 debugger_cli_common.MenuItem("", "babble"),)]
279
280 annotations = {}
281 if parsed.menu:
282 menu = debugger_cli_common.Menu()
283 menu.append(
284 debugger_cli_common.MenuItem("babble again", "babble"))
285 menu.append(
286 debugger_cli_common.MenuItem("ahoy", "ahoy", enabled=False))
287 annotations[debugger_cli_common.MAIN_MENU_KEY] = menu
288
289 output = debugger_cli_common.RichTextLines(
290 lines, font_attr_segs=font_attr_segs, annotations=annotations)
291 return output
292
293 def _print_ones(self, args, screen_info=None):
294 ap = argparse.ArgumentParser(

Callers

nothing calls this directly

Calls 4

appendMethod · 0.95
add_argumentMethod · 0.80
parse_argsMethod · 0.80
rangeFunction · 0.50

Tested by

no test coverage detected