mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-05 16:21:20 +00:00
Implement exclude list in FileManager
This commit is contained in:
parent
dceb3b947f
commit
8c492df646
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user