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/01/18 17:56:24 UTC

[GitHub] [airflow] josh-fell opened a new pull request #20930: Fix Mypy "no attribute" errors in `airflow/contrib/sensors`

josh-fell opened a new pull request #20930:
URL: https://github.com/apache/airflow/pull/20930


   Related: #19891 
   
   Errors being fixed:
   ```
   root@bf161c77e90e:/opt/airflow# mypy --namespace-packages airflow/contrib/sensors
   airflow/contrib/sensors/wasb_sensor.py:22: error: Module "airflow.providers.microsoft.azure.sensors.wasb" has no attribute "WasbPrefixSensor"
       from airflow.providers.microsoft.azure.sensors.wasb import WasbBlobSensor, WasbPrefixSensor  # noqa
       ^
   airflow/contrib/sensors/sagemaker_training_sensor.py:22: error: Module "airflow.providers.amazon.aws.sensors.sagemaker_training" has no attribute "SageMakerHook"
       from airflow.providers.amazon.aws.sensors.sagemaker_training import (  # noqa
       ^
   Found 2 errors in 2 files (checked 36 source files)
   ```
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md).
   


-- 
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



[GitHub] [airflow] potiuk merged pull request #20930: Fix import path for `SageMakerHook` in `airflow/contrib/sensors/sagemaker_training`

Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #20930:
URL: https://github.com/apache/airflow/pull/20930


   


-- 
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



[GitHub] [airflow] uranusjr commented on a change in pull request #20930: Fix Mypy "no attribute" errors in `airflow/contrib/sensors`

Posted by GitBox <gi...@apache.org>.
uranusjr commented on a change in pull request #20930:
URL: https://github.com/apache/airflow/pull/20930#discussion_r788496703



##########
File path: airflow/providers/microsoft/azure/sensors/wasb.pyi
##########
@@ -41,3 +42,7 @@ class WasbBlobSensor(BaseSensorOperator):
         check_options: Optional[dict] = None,
         **kwargs,
     ) -> None: ...
+
+# Adding this public module override to suppress Mypy errors stating
+# "airflow.providers.microsoft.azure.sensors.wasb has no attribute 'WasbPrefixSensor'".
+__all__ = ["WasbBlobSensor", "WasbPrefixSensor"]

Review comment:
       FYI you can put `__all__` in the Python source. It also silences Flake8 so you don’t need `noqa`, which I strongly prefer because `__all__` declares explicitly what are actually expected from the module.




-- 
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



[GitHub] [airflow] potiuk commented on a change in pull request #20930: Fix Mypy "no attribute" errors in `airflow/contrib/sensors`

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #20930:
URL: https://github.com/apache/airflow/pull/20930#discussion_r787123196



##########
File path: airflow/providers/microsoft/azure/sensors/wasb.pyi
##########
@@ -41,3 +42,7 @@ class WasbBlobSensor(BaseSensorOperator):
         check_options: Optional[dict] = None,
         **kwargs,
     ) -> None: ...
+
+# Adding this public module override to suppress Mypy errors stating
+# "airflow.providers.microsoft.azure.sensors.wasb has no attribute 'WasbPrefixSensor'".
+__all__ = ["WasbBlobSensor", "WasbPrefixSensor"]

Review comment:
       Lets' 'remove the .pyi files once and for all: #20936 




-- 
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



[GitHub] [airflow] github-actions[bot] commented on pull request #20930: Fix import path for `SageMakerHook` in `airflow/contrib/sensors/sagemaker_training`

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #20930:
URL: https://github.com/apache/airflow/pull/20930#issuecomment-1017670198


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


-- 
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



[GitHub] [airflow] josh-fell commented on a change in pull request #20930: Fix Mypy "no attribute" errors in `airflow/contrib/sensors`

Posted by GitBox <gi...@apache.org>.
josh-fell commented on a change in pull request #20930:
URL: https://github.com/apache/airflow/pull/20930#discussion_r787139586



##########
File path: airflow/providers/microsoft/azure/sensors/wasb.pyi
##########
@@ -41,3 +42,7 @@ class WasbBlobSensor(BaseSensorOperator):
         check_options: Optional[dict] = None,
         **kwargs,
     ) -> None: ...
+
+# Adding this public module override to suppress Mypy errors stating
+# "airflow.providers.microsoft.azure.sensors.wasb has no attribute 'WasbPrefixSensor'".
+__all__ = ["WasbBlobSensor", "WasbPrefixSensor"]

Review comment:
       I may have planted the seed so I'll gladly take any heat with you 🙂 
   
   I'll remove this change then.




-- 
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



[GitHub] [airflow] josh-fell commented on a change in pull request #20930: Fix import path for `SageMakerHook` in `airflow/contrib/sensors/sagemaker_training`

Posted by GitBox <gi...@apache.org>.
josh-fell commented on a change in pull request #20930:
URL: https://github.com/apache/airflow/pull/20930#discussion_r788835207



##########
File path: airflow/providers/microsoft/azure/sensors/wasb.pyi
##########
@@ -41,3 +42,7 @@ class WasbBlobSensor(BaseSensorOperator):
         check_options: Optional[dict] = None,
         **kwargs,
     ) -> None: ...
+
+# Adding this public module override to suppress Mypy errors stating
+# "airflow.providers.microsoft.azure.sensors.wasb has no attribute 'WasbPrefixSensor'".
+__all__ = ["WasbBlobSensor", "WasbPrefixSensor"]

Review comment:
       Right on, thanks @uranusjr! I'll keep this approach in mind if I ever deprecate modules in the future.




-- 
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



[GitHub] [airflow] josh-fell commented on a change in pull request #20930: Fix Mypy "no attribute" errors in `airflow/contrib/sensors`

Posted by GitBox <gi...@apache.org>.
josh-fell commented on a change in pull request #20930:
URL: https://github.com/apache/airflow/pull/20930#discussion_r787016712



##########
File path: airflow/providers/microsoft/azure/sensors/wasb.pyi
##########
@@ -41,3 +42,7 @@ class WasbBlobSensor(BaseSensorOperator):
         check_options: Optional[dict] = None,
         **kwargs,
     ) -> None: ...
+
+# Adding this public module override to suppress Mypy errors stating
+# "airflow.providers.microsoft.azure.sensors.wasb has no attribute 'WasbPrefixSensor'".
+__all__ = ["WasbBlobSensor", "WasbPrefixSensor"]

Review comment:
       I'd love some feedback here on this approach vs. adding the `WasbPrefixSensor` explicitly.




-- 
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



[GitHub] [airflow] potiuk commented on a change in pull request #20930: Fix Mypy "no attribute" errors in `airflow/contrib/sensors`

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #20930:
URL: https://github.com/apache/airflow/pull/20930#discussion_r787123196



##########
File path: airflow/providers/microsoft/azure/sensors/wasb.pyi
##########
@@ -41,3 +42,7 @@ class WasbBlobSensor(BaseSensorOperator):
         check_options: Optional[dict] = None,
         **kwargs,
     ) -> None: ...
+
+# Adding this public module override to suppress Mypy errors stating
+# "airflow.providers.microsoft.azure.sensors.wasb has no attribute 'WasbPrefixSensor'".
+__all__ = ["WasbBlobSensor", "WasbPrefixSensor"]

Review comment:
       Lets' 'remove the fake .pyi files once and for all: #20936 . This was a very bad idea of mine :(




-- 
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