class_docstr: File completer class, optionally takes a list of allowed extensions
class_docstr_tok: ["File","completer","class",",","optionally","takes","a","list","of","allowed","extensions"]
code: def __call__(self, prefix, **kwargs):
      completion = []
      if self.allowednames:
          if self.directories:
              files = _call(
                  [
                      "bash",
                      "-c",
                      "compgen -A directory -- '{p}'".format(p=prefix),
                  ]
              )
              completion += [f + "/" for f in files]
          for x in self.allowednames:
              completion += _call(
                  [
                      "bash",
                      "-c",
                      "compgen -A file -X '!*.{0}' -- '{p}'".format(
                          x, p=prefix
                      ),
                  ]
              )
      else:
          completion += _call(
              [
                  "bash",
                  "-c",
                  "compgen -A file -- '{p}'".format(p=prefix),
              ]
          )
          anticomp = _call(
              [
                  "bash",
                  "-c",
                  "compgen -A directory -- '{p}'".format(p=prefix),
              ]
          )
          completion = list(set(completion) - set(anticomp))
  
          if self.directories:
              completion += [f + "/" for f in anticomp]
      return completion
  
imports: import argparse
  import os
  import subprocess
label_desc: Use image node_id 2 for calling the FilesCompleter obj's underlying member method code with example usage: obj.__call__(prefix) and returns: completion