# Path: tensorflow/python/debug/cli/command_parser.py
# _BRACKETS_PATTERN = re.compile(r"\[[^\]]*\]")
# _QUOTES_PATTERN = re.compile(r"\"[^\"]*\"")
# _WHITESPACE_PATTERN = re.compile(r"\s+")
# def parse_command(command):
# def extract_output_file_path(args):
# def parse_tensor_name_with_slicing(in_str):
# def validate_slicing_string(slicing_string):
# def parse_indices(indices_string):
# def parse_ranges(range_string):
# def parse_readable_size_str(size_str):
# def evaluate_tensor_slice(tensor, tensor_slicing):


import argparse
import numpy as np  # pylint: disable=unused-import
from six.moves import xrange  # pylint: disable=redefined-builtin
from tensorflow.python.debug import stepper
from tensorflow.python.debug.cli import cli_shared
from tensorflow.python.debug.cli import command_parser
from tensorflow.python.debug.cli import debugger_cli_common
from tensorflow.python.debug.cli import tensor_format
    parsed = self.arg_parsers["step"].parse_args(args)

    if parsed.num_times < 0:
      return debugger_cli_common.RichTextLines(
          "ERROR: Invalid number of times to step: %d" % parsed.num_times)

    for _ in xrange(parsed.num_times):
      if self._next >= len(self._sorted_nodes):
        return debugger_cli_common.RichTextLines(
            "ERROR: Cannot step any further because the end of the sorted "
            "transitive closure has been reached.")
      else:
        screen_output = self.cont([self._sorted_nodes[self._next]], screen_info)

    return screen_output

  def print_tensor(self, args, screen_info=None):
    """Print the value of a tensor that the stepper has access to."""

    parsed = self.arg_parsers["print_tensor"].parse_args(args)

    if screen_info and "cols" in screen_info:
      np_printoptions = {"linewidth": screen_info["cols"]}
    else:
      np_printoptions = {}

    # Determine if any range-highlighting is required.
    highlight_options = cli_shared.parse_ranges_highlight(parsed.ranges)

    tensor_name, tensor_slicing = (

# Path: tensorflow/python/debug/cli/command_parser.py
# _BRACKETS_PATTERN = re.compile(r"\[[^\]]*\]")
# _QUOTES_PATTERN = re.compile(r"\"[^\"]*\"")
# _WHITESPACE_PATTERN = re.compile(r"\s+")
# def parse_command(command):
# def extract_output_file_path(args):
# def parse_tensor_name_with_slicing(in_str):
# def validate_slicing_string(slicing_string):
# def parse_indices(indices_string):
# def parse_ranges(range_string):
# def parse_readable_size_str(size_str):
# def evaluate_tensor_slice(tensor, tensor_slicing):


# Path: tensorflow/python/debug/cli/stepper_cli.py
import argparse
import numpy as np  # pylint: disable=unused-import
from six.moves import xrange  # pylint: disable=redefined-builtin
from tensorflow.python.debug import stepper
from tensorflow.python.debug.cli import cli_shared
from tensorflow.python.debug.cli import command_parser
from tensorflow.python.debug.cli import debugger_cli_common
from tensorflow.python.debug.cli import tensor_format

    parsed = self.arg_parsers["step"].parse_args(args)

    if parsed.num_times < 0:
      return debugger_cli_common.RichTextLines(
          "ERROR: Invalid number of times to step: %d" % parsed.num_times)

    for _ in xrange(parsed.num_times):
      if self._next >= len(self._sorted_nodes):
        return debugger_cli_common.RichTextLines(
            "ERROR: Cannot step any further because the end of the sorted "
            "transitive closure has been reached.")
      else:
        screen_output = self.cont([self._sorted_nodes[self._next]], screen_info)

    return screen_output

  def print_tensor(self, args, screen_info=None):
    """Print the value of a tensor that the stepper has access to."""

    parsed = self.arg_parsers["print_tensor"].parse_args(args)

    if screen_info and "cols" in screen_info:
      np_printoptions = {"linewidth": screen_info["cols"]}
    else:
      np_printoptions = {}

    # Determine if any range-highlighting is required.
    highlight_options = cli_shared.parse_ranges_highlight(parsed.ranges)

    tensor_name, tensor_slicing = (

        command_parser.parse_tensor_name_with_slicing(parsed.tensor_name))