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 2021/12/11 04:32:20 UTC

[GitHub] [airflow] josh-fell commented on a change in pull request #20190: Fix mypy providers

josh-fell commented on a change in pull request #20190:
URL: https://github.com/apache/airflow/pull/20190#discussion_r767083756



##########
File path: airflow/providers/apache/cassandra/example_dags/example_cassandra_dag.py
##########
@@ -35,7 +35,7 @@
     catchup=False,
     tags=['example'],
 ) as dag:
-    table_sensor = CassandraTableSensor(task_id="cassandra_table_sensor")
+    table_sensor = CassandraTableSensor(task_id="cassandra_table_sensor", table="test")

Review comment:
       Adding this defeats the purpose of using the `default_args` in this example. Based on [this thread](https://github.com/apache/airflow/pull/19918#discussion_r759926403) we should hold off on trying to fix these MyPy errors for now. Likely we should try and fix the underlying logic so that these missing arg errors aren't thrown in the first place.

##########
File path: airflow/providers/asana/hooks/asana.py
##########
@@ -23,7 +23,7 @@
 from asana.error import NotFoundError
 
 try:
-    from functools import cached_property
+    from functools import cached_property  # type: ignore

Review comment:
       This should change to add the `sys.version_info` check as mentioned [here](https://github.com/apache/airflow/issues/19891#issuecomment-990728228).

##########
File path: airflow/providers/asana/example_dags/example_asana.py
##########
@@ -53,6 +53,7 @@
     create = AsanaCreateTaskOperator(
         task_id="run_asana_create_task",
         task_parameters={"notes": "Some notes about the task."},
+        conn_id='asana_default',

Review comment:
       Same comment in this file as well re: `default_args` use and MyPy errors.

##########
File path: airflow/providers/apache/spark/hooks/spark_sql.py
##########
@@ -83,12 +83,13 @@ def __init__(
         yarn_queue: Optional[str] = None,
     ) -> None:
         super().__init__()
+        options: Dict = {}
+        conn: Optional[Connection] = None
 
         try:
-            conn: "Optional[Connection]" = self.get_connection(conn_id)

Review comment:
       If the stringified typing can safely be removed then the `TYPE_CHECKING` statement can also be removed. You'll need to confirm though with some testing. MyPy _should_ complain if it's an issue.
   
   @kaxil @potiuk Another example of `get_connection()` in a hook's `__init__()` here. Oddly enough, this hook has a `get_conn()` method but it's a null method.




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