This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 4fa9cfd Fix mypy in providers/grpc and providers/imap (#20651)
4fa9cfd is described below
commit 4fa9cfd7de13cd79956fbb68f8416a5a019465a4
Author: Kanthi <[email protected]>
AuthorDate: Thu Jan 6 05:10:08 2022 -0500
Fix mypy in providers/grpc and providers/imap (#20651)
---
airflow/providers/grpc/operators/grpc.py | 4 ++--
airflow/providers/imap/hooks/imap.py | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/airflow/providers/grpc/operators/grpc.py
b/airflow/providers/grpc/operators/grpc.py
index 98a9595..3120e25 100644
--- a/airflow/providers/grpc/operators/grpc.py
+++ b/airflow/providers/grpc/operators/grpc.py
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
-from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Sequence
+from typing import TYPE_CHECKING, Any, Callable, List, Optional, Sequence
from airflow.models import BaseOperator
from airflow.providers.grpc.hooks.grpc import GrpcHook
@@ -97,7 +97,7 @@ class GrpcOperator(BaseOperator):
for response in responses:
self._handle_response(response, context)
- def _handle_response(self, response: Any, context: Dict) -> None:
+ def _handle_response(self, response: Any, context: 'Context') -> None:
if self.log_response:
self.log.info(repr(response))
if self.response_callback:
diff --git a/airflow/providers/imap/hooks/imap.py
b/airflow/providers/imap/hooks/imap.py
index 6257a1e..64e07ad 100644
--- a/airflow/providers/imap/hooks/imap.py
+++ b/airflow/providers/imap/hooks/imap.py
@@ -71,7 +71,10 @@ class ImapHook(BaseHook):
"""
if not self.mail_client:
conn = self.get_connection(self.imap_conn_id)
- self.mail_client = imaplib.IMAP4_SSL(conn.host, conn.port or
imaplib.IMAP4_SSL_PORT)
+ if conn.port:
+ self.mail_client = imaplib.IMAP4_SSL(conn.host, conn.port)
+ else:
+ self.mail_client = imaplib.IMAP4_SSL(conn.host)
self.mail_client.login(conn.login, conn.password)
return self