Repository: great-expectations/great_expectations

Issue:
Use cleaner solution for non-truncating division in python 2
Prefer `from __future__ import division` to `1.*x/y`


Discussion:
Done inline during improve_partitions push.

Resolving patch:
diff --git a/great_expectations/core/evaluation_parameters.py b/great_expectations/core/evaluation_parameters.py
--- a/great_expectations/core/evaluation_parameters.py
+++ b/great_expectations/core/evaluation_parameters.py
@@ -401,7 +401,7 @@ def parse_evaluation_parameter(
     return result
 
 
-def _deduplicate_evaluation_parameter_dependencies(dependencies):
+def _deduplicate_evaluation_parameter_dependencies(dependencies: dict) -> dict:
     deduplicated = {}
     for suite_name, required_metrics in dependencies.items():
         deduplicated[suite_name] = []
diff --git a/great_expectations/core/expectation_configuration.py b/great_expectations/core/expectation_configuration.py
--- a/great_expectations/core/expectation_configuration.py
+++ b/great_expectations/core/expectation_configuration.py
@@ -4,6 +4,7 @@
 from typing import Any, Dict, Optional, Union
 
 import jsonpatch
+from pyparsing import ParseResults
 
 from great_expectations.core.evaluation_parameters import (
     _deduplicate_evaluation_parameter_dependencies,
@@ -1284,9 +1285,9 @@ def to_json_dict(self):
         )
         return myself
 
-    def get_evaluation_parameter_dependencies(self):
+    def get_evaluation_parameter_dependencies(self) -> dict:
         parsed_dependencies = {}
-        for key, value in self.kwargs.items():
+        for value in self.kwargs.values():
             if isinstance(value, dict) and "$PARAMETER" in value:
                 param_string_dependencies = find_evaluation_parameter_dependencies(
                     value["$PARAMETER"]
@@ -1306,28 +1307,37 @@ def get_evaluation_parameter_dependencies(self):
                 )
                 continue
 
-            if not urn.get("metric_kwargs"):
-                nested_update(
-                    dependencies,
-                    {urn["expectation_suite_name"]: [urn["metric_name"]]},
-                )
+            # Query stores do not have "expectation_suite_name"
+            if urn["urn_type"] == "stores" and "expectation_suite_name" not in urn:
+                pass
             else:
-                nested_update(
-                    dependencies,
-                    {
-                        urn["expectation_suite_name"]: [
-                            {
-                                "metric_kwargs_id": {
-                                    urn["metric_kwargs"]: [urn["metric_name"]]
-                                }
-                            }
-                        ]
-                    },
-                )
+                self._update_dependencies_with_expectation_suite_urn(dependencies, urn)
 
         dependencies = _deduplicate_evaluation_parameter_dependencies(dependencies)
         return dependencies
 
+    def _update_dependencies_with_expectation_suite_urn(
+        self, dependencies: dict, urn: ParseResults
+    ) -> None:
+        if not urn.get("metric_kwargs"):
+            nested_update(
+                dependencies,
+                {urn["expectation_suite_name"]: [urn["metric_name"]]},
+            )
+        else:
+            nested_update(
+                dependencies,
+                {
+                    urn["expectation_suite_name"]: [
+                        {
+                            "metric_kwargs_id": {
+                                urn["metric_kwargs"]: [urn["metric_name"]]
+                            }
+                        }
+                    ]
+                },
+            )
+
     def _get_expectation_impl(self):
         return get_expectation_impl(self.expectation_type)
 


Test patch:
diff --git a/tests/core/test_expectation_configuration.py b/tests/core/test_expectation_configuration.py
--- a/tests/core/test_expectation_configuration.py
+++ b/tests/core/test_expectation_configuration.py
@@ -151,6 +151,23 @@ def test_expectation_configuration_get_evaluation_parameter_dependencies():
     } == dependencies
 
 
+def test_expectation_configuration_get_evaluation_parameter_dependencies_with_query_store_formatted_urns():
+    ec = ExpectationConfiguration(
+        expectation_type="expect_column_values_to_be_in_set",
+        kwargs={
+            "column": "genre_id",
+            "value_set": {
+                "$PARAMETER": "urn:great_expectations:stores:query_store:get_pet_names"
+            },
+            "result_format": "COMPLETE",
+        },
+    )
+
+    # Should fully skip `nested_update` calls in method due to lacking an "expectation_suite_name" key
+    dependencies = ec.get_evaluation_parameter_dependencies()
+    assert dependencies == {}
+
+
 def test_expectation_configuration_patch(config4, config5, config6, config7):
     assert not config5.isEquivalentTo(config4, match_type="runtime")
     assert config5.patch("replace", "/value_set", [1, 2, 3]).isEquivalentTo(