Implement exclude list in FileManager

This commit is contained in:
Kristóf Tóth 2018-02-08 16:56:30 +01:00
parent dceb3b947f
commit 8c492df646

View File

@ -10,6 +10,7 @@ log = logging.getLogger(__name__)
class FileManager:
def __init__(self, working_directory, selected_file=None):
self.exclude = ['__pycache__']
self._workdir = working_directory
self.filename = selected_file or self._relpath(self.files[0])
self.language = map_file_extension_to_language(self.filename)
@ -22,7 +23,9 @@ class FileManager:
@property
def files(self):
return [self._relpath(file) for file in glob(join(self._workdir, '**/*'), recursive=True) if isfile(file)]
return [self._relpath(file) for file in glob(join(self._workdir, '**/*'), recursive=True)
if isfile(file) and
not any(word in file for word in self.exclude)]
@property
def file_contents(self):