class_docstr: An extension of CompletionFinder which dynamically completes class-trait based options
  
  This finder adds a few functionalities:
  
  1. When completing options, it will add ``--Class.`` to the list of completions, for each
  class in `Application.classes` that could complete the current option.
  2. If it detects that we are currently trying to complete an option related to ``--Class.``,
  it will add the corresponding config traits of Class to the `ArgumentParser` instance,
  so that the traits' completers can be used.
  3. If there are any subcommands, they are added as completions for the first word
  
  Note that we are avoiding adding all config traits of all classes to the `ArgumentParser`,
  which would be easier but would add more runtime overhead and would also make completions
  appear more spammy.
  
  These changes do require using the internals of `argcomplete.CompletionFinder`.
class_docstr_tok: ["An","extension","of","CompletionFinder","which","dynamically","completes","class-trait","based","options","This","finder","adds","a","few","functionalities",":","1",".","When","completing","options",",","it","will","add","``","--","Class.","``","to","the","list","of","completions",",","for","each","class","in","`","Application.classes","`","that","could","complete","the","current","option",".","2",".","If","it","detects","that","we","are","currently","trying","to","complete","an","option","related","to","``","--","Class.","``",",","it","will","add","the","corresponding","config","traits","of","Class","to","the","`","ArgumentParser","`","instance",",","so","that","the","traits","'","completers","can","be","used",".","3",".","If","there","are","any","subcommands",",","they","are","added","as","completions","for","the","first","word","Note","that","we","are","avoiding","adding","all","config","traits","of","all","classes","to","the","`","ArgumentParser","`",",","which","would","be","easier","but","would","add","more","runtime","overhead","and","would","also","make","completions","appear","more","spammy",".","These","changes","do","require","using","the","internals","of","`","argcomplete.CompletionFinder","`","."]
docstr: Match the word to be completed against our Configurable classes
  
  Check if cword_prefix could potentially match against --{class}. for any class
  in Application.classes.
docstr_tok: ["Match","the","word","to","be","completed","against","our","Configurable","classes","Check","if","cword_prefix","could","potentially","match","against","--","{","class","}",".","for","any","class","in","Application.classes","."]
code: def match_class_completions(
      self, cword_prefix: str
  ) -> t.List[t.Tuple[t.Any, str]]:
      """Match the word to be completed against our Configurable classes
  
      Check if cword_prefix could potentially match against --{class}. for any class
      in Application.classes.
      """
      class_completions = [
          (cls, f"--{cls.__name__}.") for cls in self.config_classes
      ]
      matched_completions = class_completions
      if "." in cword_prefix:
          cword_prefix = cword_prefix[: cword_prefix.index(".") + 1]
          matched_completions = [
              (cls, c)
              for (cls, c) in class_completions
              if c == cword_prefix
          ]
      elif len(cword_prefix) > 0:
          matched_completions = [
              (cls, c)
              for (cls, c) in class_completions
              if c.startswith(cword_prefix)
          ]
      return matched_completions
  
file_path: catboost/contrib/python/traitlets/py3/traitlets/config/argcomplete_config.py
imports: import argparse
  import os
  import typing
label_desc: Use image node_id 1 for calling the ExtendedCompletionFinder obj's underlying member method code with example usage: obj.match_class_completions(cword_prefix) and returns: matched_completions