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 2021/12/17 09:56:16 UTC

[GitHub] [airflow] ashb commented on a change in pull request #20358: Fix remaining MyPy errors in Google Provider

ashb commented on a change in pull request #20358:
URL: https://github.com/apache/airflow/pull/20358#discussion_r771253052



##########
File path: airflow/providers/google/cloud/hooks/compute.py
##########
@@ -405,10 +405,11 @@ def get_instance_address(
         instance_info = self.get_instance_info(project_id=project_id, resource_id=resource_id, zone=zone)
         if use_internal_ip:
             return instance_info["networkInterfaces"][0].get("networkIP")
-
-        access_config = instance_info.get("networkInterfaces")[0].get("accessConfigs")
-        if access_config:
-            return access_config[0].get("natIP")
+        network_interfaces = instance_info.get("networkInterfaces")
+        if network_interfaces:
+            access_config = network_interfaces[0].get("accessConfigs")
+            if access_config:
+                return access_config[0].get("natIP")

Review comment:
       Shame https://www.python.org/dev/peps/pep-0505/ doesn't exist yet.




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