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 2022/11/25 01:03:28 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #27778: Lambda hook: make runtime and handler optional

uranusjr commented on code in PR #27778:
URL: https://github.com/apache/airflow/pull/27778#discussion_r1031930667


##########
airflow/providers/amazon/aws/hooks/lambda_function.py:
##########
@@ -93,6 +93,12 @@ def create_lambda(
         code_signing_config_arn: str | None = None,
         architectures: list[str] | None = None,
     ) -> dict:
+        if package_type == "Zip":
+            if handler is None:
+                raise ValueError("Parameter 'handler' is required if 'package_type' is 'Zip'")
+            if runtime is None:
+                raise ValueError("Parameter 'runtime' is required if 'package_type' is 'Zip'")

Review Comment:
   These should be TypeError to mirror Python’s default behaviour.
   
   ```pycon
   >>> def f(*, a): pass
   ... 
   >>> f()
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
   TypeError: f() missing 1 required keyword-only argument: 'a'
   ```



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