mlgruby edited a comment on pull request #11159:
URL: https://github.com/apache/airflow/pull/11159#issuecomment-699475292


   > @in static check CI, mypy is throwing the same error which pylint is set 
to ignore. Can we ignore this mypy error?
   > 
   > ```
   > airflow/providers/snowflake/hooks/snowflake.py:55: error: "SnowflakeHook" 
has
   > no attribute "snowflake_conn_id"
   >             conn = self.get_connection(self.snowflake_conn_id)  # pylint: 
...
   >                                        ^
   > airflow/providers/snowflake/hooks/snowflake.py:129: error: "SnowflakeHook" 
has
   > no attribute "snowflake_conn_id"
   >             if self.snowflake_conn_id:  # pylint: disable=no-member
   >                ^
   > airflow/providers/snowflake/hooks/snowflake.py:130: error: "SnowflakeHook" 
has
   > no attribute "snowflake_conn_id"
   >     ...         connection_object = 
self.get_connection(self.snowflake_conn_i...
   > ```
   > 
   > Yes. These errors can be ignored by `typing: ignore` because we're sure 
these attributes exist but are dynamically created.
   
   Tried below solution but I am still getting above error! 
   
   ```python 
   # type: ignore
   conn = self.get_connection(self.snowflake_conn_id)  # pylint: 
disable=no-member
   ```
   and 
   ```python 
   # type: ignore[attr-defined]
   conn = self.get_connection(self.snowflake_conn_id)  # pylint: 
disable=no-member
   ```
   The second one I prefer as in this way we are less likely to silence 
unexpected errors that are not safe to ignore.
   
   Not sure how to put both pylint ignore and mypy ignore for the piece of 
code! 


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to