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/execution_engine/execution_engine.py b/great_expectations/execution_engine/execution_engine.py
--- a/great_expectations/execution_engine/execution_engine.py
+++ b/great_expectations/execution_engine/execution_engine.py
@@ -203,9 +203,9 @@ def _load_batch_data_from_dict(self, batch_data_dict):
     def resolve_metrics(
         self,
         metrics_to_resolve: Iterable[MetricConfiguration],
-        metrics: Optional[Dict[Tuple, MetricConfiguration]] = None,
+        metrics: Optional[Dict[Tuple[str, str, str], MetricConfiguration]] = None,
         runtime_configuration: Optional[dict] = None,
-    ) -> Dict[Tuple, Any]:
+    ) -> Dict[Tuple[str, str, str], Any]:
         """resolve_metrics is the main entrypoint for an execution engine. The execution engine will compute the value
         of the provided metrics.
 
@@ -220,7 +220,7 @@ def resolve_metrics(
         if metrics is None:
             metrics = {}
 
-        resolved_metrics: Dict[Tuple, MetricConfiguration] = {}
+        resolved_metrics: Dict[Tuple[str, str, str], Any] = {}
 
         metric_fn_bundle = []
         for metric_to_resolve in metrics_to_resolve:
@@ -285,10 +285,7 @@ def resolve_metrics(
                     resolved_metrics[metric_to_resolve.id] = metric_fn(
                         **metric_provider_kwargs
                     )
-                except (
-                    ge_exceptions.MetricComputationError,
-                    ge_exceptions.InvalidMetricAccessorDomainKwargsKeyError,
-                ) as e:
+                except Exception as e:
                     raise ge_exceptions.MetricResolutionError(
                         message=str(e), failed_metrics=(metric_to_resolve,)
                     )
@@ -297,10 +294,7 @@ def resolve_metrics(
                     resolved_metrics[metric_to_resolve.id] = metric_fn(
                         **metric_provider_kwargs
                     )
-                except (
-                    ge_exceptions.MetricComputationError,
-                    ge_exceptions.InvalidMetricAccessorDomainKwargsKeyError,
-                ) as e:
+                except Exception as e:
                     raise ge_exceptions.MetricResolutionError(
                         message=str(e), failed_metrics=(metric_to_resolve,)
                     )
@@ -312,10 +306,7 @@ def resolve_metrics(
                     resolved_metrics[metric_to_resolve.id] = metric_fn(
                         **metric_provider_kwargs
                     )
-                except (
-                    ge_exceptions.MetricComputationError,
-                    ge_exceptions.InvalidMetricAccessorDomainKwargsKeyError,
-                ) as e:
+                except Exception as e:
                     raise ge_exceptions.MetricResolutionError(
                         message=str(e), failed_metrics=(metric_to_resolve,)
                     )
@@ -323,10 +314,7 @@ def resolve_metrics(
             try:
                 new_resolved = self.resolve_metric_bundle(metric_fn_bundle)
                 resolved_metrics.update(new_resolved)
-            except (
-                ge_exceptions.MetricComputationError,
-                ge_exceptions.InvalidMetricAccessorDomainKwargsKeyError,
-            ) as e:
+            except Exception as e:
                 raise ge_exceptions.MetricResolutionError(
                     message=str(e), failed_metrics=[x[0] for x in metric_fn_bundle]
                 )
diff --git a/great_expectations/validator/validator.py b/great_expectations/validator/validator.py
--- a/great_expectations/validator/validator.py
+++ b/great_expectations/validator/validator.py
@@ -32,7 +32,6 @@
 from great_expectations.exceptions import (
     GreatExpectationsError,
     InvalidExpectationConfigurationError,
-    MetricResolutionError,
 )
 from great_expectations.execution_engine import (
     ExecutionEngine,
@@ -331,7 +330,7 @@ def get_metrics(self, metrics: Dict[str, MetricConfiguration]) -> Dict[str, Any]
                 metric_configuration=metric_configuration,
             )
 
-        resolved_metrics: Dict[Tuple, Any] = {}
+        resolved_metrics: Dict[Tuple[str, str, str], Any] = {}
         self.resolve_validation_graph(
             graph=graph,
             metrics=resolved_metrics,
@@ -398,7 +397,7 @@ def build_metric_dependency_graph(
     def graph_validate(
         self,
         configurations: List[ExpectationConfiguration],
-        metrics: Optional[Dict[Tuple, Any]] = None,
+        metrics: Optional[Dict[Tuple[str, str, str], Any]] = None,
         runtime_configuration: Optional[dict] = None,
     ) -> List[ExpectationValidationResult]:
         """Obtains validation dependencies for each metric using the implementation of their associated expectation,
@@ -530,7 +529,7 @@ def graph_validate(
     def resolve_validation_graph(
         self,
         graph: ValidationGraph,
-        metrics: Dict[Tuple, Any],
+        metrics: Dict[Tuple[str, str, str], Any],
         runtime_configuration: Optional[dict] = None,
     ):
         if runtime_configuration is None:
@@ -545,7 +544,7 @@ def resolve_validation_graph(
             )
 
             if pbar is None:
-                # noinspection PyProtectedMember
+                # noinspection PyProtectedMember,SpellCheckingInspection
                 pbar = tqdm(
                     total=len(ready_metrics) + len(needed_metrics),
                     desc="Calculating Metrics",
@@ -571,8 +570,8 @@ def resolve_validation_graph(
     @staticmethod
     def _parse_validation_graph(
         validation_graph: ValidationGraph,
-        metrics: Dict[Tuple, Any],
-    ):
+        metrics: Dict[Tuple[str, str, str], Any],
+    ) -> Tuple[Set[MetricConfiguration], Set[MetricConfiguration]]:
         """Given validation graph, returns the ready and needed metrics necessary for validation using a traversal of
         validation graph (a graph structure of metric ids) edges"""
         unmet_dependency_ids = set()
@@ -597,9 +596,9 @@ def _parse_validation_graph(
     def _resolve_metrics(
         execution_engine: ExecutionEngine,
         metrics_to_resolve: Iterable[MetricConfiguration],
-        metrics: Dict[Tuple, Any] = None,
+        metrics: Dict[Tuple[str, str, str], Any] = None,
         runtime_configuration: dict = None,
-    ) -> Dict[Tuple, MetricConfiguration]:
+    ) -> Dict[Tuple[str, str, str], MetricConfiguration]:
         """A means of accessing the Execution Engine's resolve_metrics method, where missing metric configurations are
         resolved"""
         return execution_engine.resolve_metrics(


Test patch: