Пример #1
0
 def ilistdirinfo(self, path='./', **kwargs):
     path = normpath(path)
     if kwargs.get('full'):
         should_show = lambda entry: self._should_show(entry)
     elif kwargs.get('absolute'):
         should_show = lambda entry: self._should_show(entry.lstrip('/'))
     else:
         should_show = lambda entry: self._should_show(pathcombine(path, entry))
     for entry in super(HideFS, self).ilistdirinfo(path, **kwargs):
         if should_show(entry[0]):
             yield entry
Пример #2
0
 def listdir(self, path='./', **kwargs):
     path = normpath(path)
     entries = super(HideFS, self).listdir(path, **kwargs)
     if kwargs.get('full'):
         should_show = lambda entry: self._should_show(entry)
     elif kwargs.get('absolute'):
         should_show = lambda entry: self._should_show(entry.lstrip('/'))
     else:
         should_show = lambda entry: self._should_show(pathcombine(path, entry))
     entries = [entry for entry in entries if should_show(entry)]
     return entries
Пример #3
0
            def recurse(recurse_path):
                try:
                    for path in listdir(recurse_path, wildcard=dir_wildcard, full=True, dirs_only=True):
                        for p in recurse(path):
                            yield p
                except ResourceNotFoundError:
                    # Could happen if another thread / process deletes something whilst we are walking
                    pass

                filenames = listdir(recurse_path, wildcard=wildcard, files_only=True)
                filenames = [filename for filename in filenames if self._should_show(pathcombine(recurse_path, filename))]
                yield (recurse_path, filenames)
Пример #4
0
 def ilistdirinfo(self, path='./', **kwargs):
     path = normpath(path)
     if kwargs.get('full'):
         should_show = lambda entry: self._should_show(entry)
     elif kwargs.get('absolute'):
         should_show = lambda entry: self._should_show(entry.lstrip('/'))
     else:
         should_show = lambda entry: self._should_show(
             pathcombine(path, entry))
     for entry in super(HideFS, self).ilistdirinfo(path, **kwargs):
         if should_show(entry[0]):
             yield entry
Пример #5
0
 def listdir(self, path='./', **kwargs):
     path = normpath(path)
     entries = super(HideFS, self).listdir(path, **kwargs)
     if kwargs.get('full'):
         should_show = lambda entry: self._should_show(entry)
     elif kwargs.get('absolute'):
         should_show = lambda entry: self._should_show(entry.lstrip('/'))
     else:
         should_show = lambda entry: self._should_show(
             pathcombine(path, entry))
     entries = [entry for entry in entries if should_show(entry)]
     return entries
Пример #6
0
            def recurse(recurse_path):
                try:
                    for path in listdir(recurse_path,
                                        wildcard=dir_wildcard,
                                        full=True,
                                        dirs_only=True):
                        for p in recurse(path):
                            yield p
                except ResourceNotFoundError:
                    # Could happen if another thread / process deletes something whilst we are walking
                    pass

                filenames = listdir(recurse_path,
                                    wildcard=wildcard,
                                    files_only=True)
                filenames = [
                    filename for filename in filenames
                    if self._should_show(pathcombine(recurse_path, filename))
                ]
                yield (recurse_path, filenames)