def file_complete(self, prefix, args):
        """ Look in the local filesystem for valid file choices. """
        path = os.path.expanduser(prefix)
        dirname, name = os.path.split(path)
        if not dirname:
            dirname = '.'
        try:
            dirs = os.listdir(dirname)
        except FileNotFoundError:
            return frozenset()
        choices = []
        session = self.calling_command.session
        for f in dirs:
            try:
                if (not name or f.startswith(name)) and \
                   not f.startswith('.'):
                    choices.append(f)
            except PermissionError:
                pass
        prevent_pad = session.pad_completion and len(choices) == 1 and \
            os.path.isdir(choices[0])
        names = [os.path.join(dirname, x) for x in choices]
        if prevent_pad:
            names.append(names[0] + '/')
        return frozenset(names)
def file_complete ( self , prefix , args ) : path = os . path . expanduser ( prefix ) dirname , name = os . path . split ( path ) if not dirname : dirname = '.' try : dirs = os . listdir ( dirname ) except FileNotFoundError : return frozenset ( ) choices = [ ] session = self . calling_command . session for f in dirs : try : if ( not name or f . startswith ( name ) ) and not f . startswith ( '.' ) : choices . append ( f ) except PermissionError : pass prevent_pad = session . pad_completion and len ( choices ) == 1 and os . path . isdir ( choices [ 0 ] ) names = [ os . path . join ( dirname , x ) for x in choices ] if prevent_pad : names . append ( names [ 0 ] + '/' ) return frozenset ( names )
Look in the local filesystem for valid file choices.