thepabloaguilar commented on a change in pull request #9943:
URL: https://github.com/apache/airflow/pull/9943#discussion_r459187852
##########
File path: airflow/providers/postgres/hooks/postgres.py
##########
@@ -149,7 +152,7 @@ def _serialize_cell(cell, conn):
"""
return cell
- def get_iam_token(self, conn):
+ def get_iam_token(self, conn: psycopg2.extensions.connection) ->
Tuple[Any, Any, Union[int, Any]]:
Review comment:
The return type here is too general, I think you can improve it more!
##########
File path: airflow/providers/postgres/hooks/postgres.py
##########
@@ -58,7 +59,9 @@ def __init__(self, *args, **kwargs):
self.connection = kwargs.pop("connection", None)
self.conn = None
- def _get_cursor(self, raw_cursor):
+ def _get_cursor(self, raw_cursor: str) -> Union[psycopg2.extras.DictCursor,
+
psycopg2.extras.RealDictCursor,
+
psycopg2.extras.NamedTupleCursor]:
Review comment:
Would be great a type alias to the return type here
##########
File path: airflow/providers/postgres/operators/postgres.py
##########
@@ -60,9 +60,9 @@ def __init__(
self.autocommit = autocommit
self.parameters = parameters
self.database = database
- self.hook = None
+ self.hook: Optional[PostgresHook] = None
- def execute(self, context):
+ def execute(self, context: Dict[Any, Any]) -> None:
Review comment:
Are you sure that `context` has a `Dict` type?
----------------------------------------------------------------
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]