diff --git a/src/event_handlers/source_code_event_handler.py b/src/event_handlers/source_code_event_handler.py index 8109504..b92cc80 100644 --- a/src/event_handlers/source_code_event_handler.py +++ b/src/event_handlers/source_code_event_handler.py @@ -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):