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/08/31 09:35:40 UTC
[GitHub] [airflow] uranusjr commented on a change in pull request #17935: Fix instantiating Vault Secret Backend during configuration
uranusjr commented on a change in pull request #17935:
URL: https://github.com/apache/airflow/pull/17935#discussion_r699153226
##########
File path: airflow/providers/hashicorp/secrets/vault.py
##########
@@ -206,7 +205,7 @@ def get_conn_uri(self, conn_id: str) -> Optional[str]:
return response.get("conn_uri") if response else None
- def get_connection(self, conn_id: str) -> Optional[Connection]:
+ def get_connection(self, conn_id: str) -> Any: # Do not change it to Connection (see below!)
Review comment:
I think you can do
```python
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
from airflow.models.connection import Connection
def get_connection(self, conn_id: str) -> "Optional[Connection]":
from airflow.models.connection import Connection # Still needed to make code work at runtime.
```
--
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