You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/02/13 08:32:35 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #21538: py files doesn't have to be checked is_zipfiles in process_files

uranusjr commented on a change in pull request #21538:
URL: https://github.com/apache/airflow/pull/21538#discussion_r805299701



##########
File path: airflow/models/dagbag.py
##########
@@ -284,7 +284,10 @@ def process_file(self, filepath, only_if_updated=True, safe_mode=True):
             self.log.exception(e)
             return []
 
-        if not zipfile.is_zipfile(filepath):
+        _, file_ext = os.path.splitext(os.path.split(filepath)[-1])
+        is_zipfile = file_ext != '.py' and zipfile.is_zipfile(filepath)
+
+        if not is_zipfile:

Review comment:
       If you don’t need the first part of the filename, it’s easier to simply
   
   ```python
   if not filepath.endswith(".py") and zipfile.is_zipfile(filepath):
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org