Taragolis commented on code in PR #34890:
URL: https://github.com/apache/airflow/pull/34890#discussion_r1358912441


##########
airflow/providers/amazon/aws/operators/lambda_function.py:
##########
@@ -152,7 +150,7 @@ def execute_complete(self, context: Context, event: 
dict[str, Any] | None = None
         return event["function_arn"]
 
 
-class LambdaInvokeFunctionOperator(BaseOperator):
+class LambdaInvokeFunctionOperator(AwsBaseOperator[LambdaHook]):

Review Comment:
   In square brakets it is just 
[typing.Generic](https://docs.python.org/3/library/typing.html#typing.Generic), 
which help type annotate type of the `hook` property, all chain is
   
   1. Define TypeVar
   
   
https://github.com/apache/airflow/blob/e9987d50598f70d84cbb2a5d964e21020e81c080/airflow/providers/amazon/aws/utils/mixins.py#L39
   
   2. Define Generic in class definition
   
   
https://github.com/apache/airflow/blob/e9987d50598f70d84cbb2a5d964e21020e81c080/airflow/providers/amazon/aws/utils/mixins.py#L100-L102
   
   3. Use defined typevar as annotation
   
   
https://github.com/apache/airflow/blob/e9987d50598f70d84cbb2a5d964e21020e81c080/airflow/providers/amazon/aws/utils/mixins.py#L111-L112
   
   
https://github.com/apache/airflow/blob/e9987d50598f70d84cbb2a5d964e21020e81c080/airflow/providers/amazon/aws/utils/mixins.py#L148-L151
   
   
   In general  `class 
LambdaInvokeFunctionOperator(AwsBaseOperator[LambdaHook]):` for help IDE, 
static checkers to understand that `hook` will return `LambdaHook` object (in 
our case we use only in one place), and in additional validate that 
`aws_hook_class` should be a subclass of `LambdaHook` 
   
   However information about generics doesn't available in runtime and we can't 
extract it from class definition, so we should assign actual class to 
`aws_hook_class` for construct hook in `hook` property
   



-- 
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: [email protected]

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

Reply via email to