class_docstr: A simple framework for writing line-oriented command interpreters.
  
  These are often useful for test harnesses, administrative tools, and
  prototypes that will later be wrapped in a more sophisticated interface.
  
  A Cmd instance or subclass instance is a line-oriented interpreter
  framework.  There is no good reason to instantiate Cmd itself; rather,
  it's useful as a superclass of an interpreter class you define yourself
  in order to inherit Cmd's methods and encapsulate action methods.
class_docstr_tok: ["A","simple","framework","for","writing","line-oriented","command","interpreters",".","These","are","often","useful","for","test","harnesses",",","administrative","tools",",","and","prototypes","that","will","later","be","wrapped","in","a","more","sophisticated","interface",".","A","Cmd","instance","or","subclass","instance","is","a","line-oriented","interpreter","framework",".","There","is","no","good","reason","to","instantiate","Cmd","itself",";","rather",",","it","'s","useful","as","a","superclass","of","an","interpreter","class","you","define","yourself","in","order","to","inherit","Cmd","'s","methods","and","encapsulate","action","methods","."]
docstr: Return the next possible completion for 'text'.
  
  If a command has not been entered, then complete against command list.
  Otherwise try to call complete_<command> to get list of completions.
docstr_tok: ["Return","the","next","possible","completion","for","'text","'",".","If","a","command","has","not","been","entered",",","then","complete","against","command","list",".","Otherwise","try","to","call","complete_","<","command",">","to","get","list","of","completions","."]
code: def complete(self, text, state):
      """Return the next possible completion for 'text'.
  
      If a command has not been entered, then complete against command list.
      Otherwise try to call complete_<command> to get list of completions.
      """
      if state == 0:
          import readline
  
          origline = readline.get_line_buffer()
          line = origline.lstrip()
          stripped = len(origline) - len(line)
          begidx = readline.get_begidx() - stripped
          endidx = readline.get_endidx() - stripped
          if begidx > 0:
              cmd, args, foo = self.parseline(line)
              if cmd == "":
                  compfunc = self.completedefault
              else:
                  try:
                      compfunc = getattr(self, "complete_" + cmd)
                  except AttributeError:
                      compfunc = self.completedefault
          else:
              compfunc = self.completenames
          self.completion_matches = compfunc(text, line, begidx, endidx)
      try:
          return self.completion_matches[state]
      except IndexError:
          return None
  
file_path: catboost/contrib/tools/python3/src/Lib/cmd.py
imports: import string, sys
label_desc: Use image node_id 13 for calling the Cmd obj's underlying member method code with example usage: obj.complete(text, state) and returns: self, None