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/validator/metrics_calculator.py b/great_expectations/validator/metrics_calculator.py
--- a/great_expectations/validator/metrics_calculator.py
+++ b/great_expectations/validator/metrics_calculator.py
@@ -141,11 +141,16 @@ def compute_metrics(
         self,
         metric_configurations: List[MetricConfiguration],
         runtime_configuration: Optional[dict] = None,
+        min_graph_edges_pbar_enable: int = 0,
+        # Set to low number (e.g., 3) to suppress progress bar for small graphs.
+        show_progress_bars: bool = True,
     ) -> Dict[Tuple[str, str, str], MetricValue]:
         """
         Args:
             metric_configurations: List of desired MetricConfiguration objects to be resolved.
             runtime_configuration: Additional run-time settings (see "Validator.DEFAULT_RUNTIME_CONFIGURATION").
+            min_graph_edges_pbar_enable: Minumum number of graph edges to warrant showing progress bars.
+            show_progress_bars: Directive for whether or not to show progress bars.
 
         Returns:
             Dictionary with requested metrics resolved, with unique metric ID as key and computed metric as value.
@@ -154,23 +159,14 @@ def compute_metrics(
             metric_configurations=metric_configurations,
             runtime_configuration=runtime_configuration,
         )
-
-        resolved_metrics: Dict[Tuple[str, str, str], MetricValue]
-        aborted_metrics_info: Dict[
-            Tuple[str, str, str],
-            Dict[str, Union[MetricConfiguration, Set[ExceptionInfo], int]],
-        ]
-        resolved_metrics, aborted_metrics_info = graph.resolve_validation_graph(
+        resolved_metrics: Dict[
+            Tuple[str, str, str], MetricValue
+        ] = self.resolve_validation_graph(
+            graph=graph,
             runtime_configuration=runtime_configuration,
-            min_graph_edges_pbar_enable=0,
-            show_progress_bars=True,
+            min_graph_edges_pbar_enable=min_graph_edges_pbar_enable,
+            show_progress_bars=show_progress_bars,
         )
-
-        if aborted_metrics_info:
-            logger.warning(
-                f"Exceptions\n{str(aborted_metrics_info)}\noccurred while resolving metrics."
-            )
-
         return resolved_metrics
 
     def build_metric_dependency_graph(
@@ -201,3 +197,80 @@ def build_metric_dependency_graph(
             )
 
         return graph
+
+    @staticmethod
+    def resolve_validation_graph(
+        graph: ValidationGraph,
+        runtime_configuration: Optional[dict] = None,
+        min_graph_edges_pbar_enable: int = 0,
+        # Set to low number (e.g., 3) to suppress progress bar for small graphs.
+        show_progress_bars: bool = True,
+    ) -> Dict[Tuple[str, str, str], MetricValue]:
+        """
+        Args:
+            graph: "ValidationGraph" object, containing "metric_edge" structures with "MetricConfiguration" objects.
+            runtime_configuration: Additional run-time settings (see "Validator.DEFAULT_RUNTIME_CONFIGURATION").
+            min_graph_edges_pbar_enable: Minumum number of graph edges to warrant showing progress bars.
+            show_progress_bars: Directive for whether or not to show progress bars.
+
+        Returns:
+            Dictionary with requested metrics resolved, with unique metric ID as key and computed metric as value.
+        """
+        resolved_metrics: Dict[Tuple[str, str, str], MetricValue]
+        aborted_metrics_info: Dict[
+            Tuple[str, str, str],
+            Dict[str, Union[MetricConfiguration, Set[ExceptionInfo], int]],
+        ]
+        (
+            resolved_metrics,
+            aborted_metrics_info,
+        ) = MetricsCalculator.resolve_validation_graph_and_report_aborted_metrics_info(
+            graph=graph,
+            runtime_configuration=runtime_configuration,
+            min_graph_edges_pbar_enable=min_graph_edges_pbar_enable,
+            show_progress_bars=show_progress_bars,
+        )
+
+        if aborted_metrics_info:
+            logger.warning(
+                f"Exceptions\n{str(aborted_metrics_info)}\noccurred while resolving metrics."
+            )
+
+        return resolved_metrics
+
+    @staticmethod
+    def resolve_validation_graph_and_report_aborted_metrics_info(
+        graph: ValidationGraph,
+        runtime_configuration: Optional[dict] = None,
+        min_graph_edges_pbar_enable: int = 0,
+        # Set to low number (e.g., 3) to suppress progress bar for small graphs.
+        show_progress_bars: bool = True,
+    ) -> Tuple[
+        Dict[Tuple[str, str, str], MetricValue],
+        Dict[
+            Tuple[str, str, str],
+            Dict[str, Union[MetricConfiguration, Set[ExceptionInfo], int]],
+        ],
+    ]:
+        """
+        Args:
+            graph: "ValidationGraph" object, containing "metric_edge" structures with "MetricConfiguration" objects.
+            runtime_configuration: Additional run-time settings (see "Validator.DEFAULT_RUNTIME_CONFIGURATION").
+            min_graph_edges_pbar_enable: Minumum number of graph edges to warrant showing progress bars.
+            show_progress_bars: Directive for whether or not to show progress bars.
+
+        Returns:
+            Dictionary with requested metrics resolved, with unique metric ID as key and computed metric as value.
+            Aborted metrics information, with metric ID as key.
+        """
+        resolved_metrics: Dict[Tuple[str, str, str], MetricValue]
+        aborted_metrics_info: Dict[
+            Tuple[str, str, str],
+            Dict[str, Union[MetricConfiguration, Set[ExceptionInfo], int]],
+        ]
+        resolved_metrics, aborted_metrics_info = graph.resolve_validation_graph(
+            runtime_configuration=runtime_configuration,
+            min_graph_edges_pbar_enable=min_graph_edges_pbar_enable,
+            show_progress_bars=show_progress_bars,
+        )
+        return resolved_metrics, aborted_metrics_info


Test patch: