You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Taragolis (via GitHub)" <gi...@apache.org> on 2023/08/26 17:25:48 UTC
[GitHub] [airflow] Taragolis commented on a diff in pull request #33780: Improve modules import in AWS probvider by move some of them into a type-checking block
Taragolis commented on code in PR #33780:
URL: https://github.com/apache/airflow/pull/33780#discussion_r1306493188
##########
airflow/providers/amazon/aws/hooks/ecr.py:
##########
@@ -20,11 +20,14 @@
import base64
import logging
from dataclasses import dataclass
-from datetime import datetime
+from typing import TYPE_CHECKING
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
from airflow.utils.log.secrets_masker import mask_secret
+if TYPE_CHECKING:
+ from datetime import datetime
Review Comment:
I don't think there is any beneficial to put datetime from stdlib under type-checking
##########
tests/providers/amazon/aws/operators/test_sagemaker_pipeline.py:
##########
@@ -30,6 +30,9 @@
)
from airflow.providers.amazon.aws.triggers.sagemaker import SageMakerPipelineTrigger
+if TYPE_CHECKING:
+ from unittest.mock import MagicMock
Review Comment:
The same valid here `from unittest import mock` should also load Magic as well as `@mock.patch.object(SageMakerHook, "start_pipeline")`
--
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