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/10/13 21:38:25 UTC

[GitHub] [airflow] o-nikolas commented on a diff in pull request #26949: Add type hints for EMR hook

o-nikolas commented on code in PR #26949:
URL: https://github.com/apache/airflow/pull/26949#discussion_r995145030


##########
airflow/providers/amazon/aws/hooks/emr.py:
##########
@@ -118,13 +128,13 @@ def create_job_flow(self, job_flow_overrides: dict[str, Any]) -> dict[str, Any]:
                         stacklevel=2,
                     )
                 config = emr_conn.extra_dejson.copy()
-        config.update(job_flow_overrides)
+        config.update(**job_flow_overrides)

Review Comment:
   prefixing with the `**` operator is going to unpack the dict into individual keyword args to the `update` method, **this is not the same** as updating with a dict object (how the previous code was). If you unpack a dict as individual keyword args to update, it puts the constraint on the keys that they must be valid python variable/argument names (i.e. strings). Here's an example that shows things more clearly:
   ![Screenshot from 2022-10-13 14-36-33](https://user-images.githubusercontent.com/65743084/195715628-a15fdfb3-7510-4d5b-9cbd-19179313cd85.png)
   
   
   



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