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/rule_based_profiler/parameter_builder/parameter_builder.py b/great_expectations/rule_based_profiler/parameter_builder/parameter_builder.py
--- a/great_expectations/rule_based_profiler/parameter_builder/parameter_builder.py
+++ b/great_expectations/rule_based_profiler/parameter_builder/parameter_builder.py
@@ -153,8 +153,7 @@ def build_parameters(
                 batch_request=batch_request,
             )
 
-            resolve_evaluation_dependencies(
-                parameter_builder=self,
+            self.resolve_evaluation_dependencies(
                 domain=domain,
                 variables=variables,
                 parameters=parameters,
@@ -184,6 +183,76 @@ def build_parameters(
                 parameter_values=parameter_values,
             )
 
+    def resolve_evaluation_dependencies(
+        self,
+        domain: Domain,
+        variables: Optional[ParameterContainer] = None,
+        parameters: Optional[Dict[str, ParameterContainer]] = None,
+        fully_qualified_parameter_names: Optional[List[str]] = None,
+        recompute_existing_parameter_values: bool = False,
+    ) -> None:
+        """
+        This method computes ("resolves") pre-requisite ("evaluation") dependencies (i.e., results of executing other
+        "ParameterBuilder" objects), whose output(s) are needed by specified "ParameterBuilder" object to operate.
+        """
+
+        # Step-1: Check if any "evaluation_parameter_builders" are configured for specified "ParameterBuilder" object.
+        evaluation_parameter_builders: List[
+            ParameterBuilder
+        ] = self.evaluation_parameter_builders
+
+        if not evaluation_parameter_builders:
+            return
+
+        # Step-2: Obtain all fully-qualified parameter names ("variables" and "parameter" keys) in namespace of "Domain"
+        # (fully-qualified parameter names are stored in "ParameterNode" objects of "ParameterContainer" of "Domain"
+        # when "ParameterBuilder.build_parameters()" is executed for "ParameterBuilder.fully_qualified_parameter_name");
+        # this list contains "raw" (for internal calculations) and "JSON-serialized" fully-qualified parameter names.
+        if fully_qualified_parameter_names is None:
+            fully_qualified_parameter_names = get_fully_qualified_parameter_names(
+                domain=domain,
+                variables=variables,
+                parameters=parameters,
+            )
+
+        # Step-3: Check presence of fully-qualified parameter names of "ParameterBuilder" objects, obtained by iterating
+        # over evaluation dependencies.  Execute "ParameterBuilder.build_parameters()" if not in "Domain" scoped list.
+        evaluation_parameter_builder: ParameterBuilder
+        for evaluation_parameter_builder in evaluation_parameter_builders:
+            if (
+                evaluation_parameter_builder.raw_fully_qualified_parameter_name
+                not in fully_qualified_parameter_names
+                or evaluation_parameter_builder.json_serialized_fully_qualified_parameter_name
+                not in fully_qualified_parameter_names
+            ):
+                evaluation_parameter_builder.set_batch_list_if_null_batch_request(
+                    batch_list=self.batch_list,
+                    batch_request=self.batch_request,
+                )
+
+                evaluation_parameter_builder.build_parameters(
+                    domain=domain,
+                    variables=variables,
+                    parameters=parameters,
+                    recompute_existing_parameter_values=recompute_existing_parameter_values,
+                )
+
+    @abstractmethod
+    def _build_parameters(
+        self,
+        domain: Domain,
+        variables: Optional[ParameterContainer] = None,
+        parameters: Optional[Dict[str, ParameterContainer]] = None,
+        recompute_existing_parameter_values: bool = False,
+    ) -> Attributes:
+        """
+        Builds ParameterContainer object that holds ParameterNode objects with attribute name-value pairs and details.
+
+        Returns:
+            Attributes object, containing computed parameter values and parameter computation details metadata.
+        """
+        pass
+
     @property
     def name(self) -> str:
         return self._name
@@ -214,22 +283,6 @@ def json_serialized_fully_qualified_parameter_name(self) -> str:
         """
         return f"{PARAMETER_KEY}{self.name}"
 
-    @abstractmethod
-    def _build_parameters(
-        self,
-        domain: Domain,
-        variables: Optional[ParameterContainer] = None,
-        parameters: Optional[Dict[str, ParameterContainer]] = None,
-        recompute_existing_parameter_values: bool = False,
-    ) -> Attributes:
-        """
-        Builds ParameterContainer object that holds ParameterNode objects with attribute name-value pairs and details.
-
-        Returns:
-            Attributes object, containing computed parameter values and parameter computation details metadata.
-        """
-        pass
-
     def get_validator(
         self,
         domain: Optional[Domain] = None,
@@ -690,58 +743,3 @@ def init_parameter_builder(
         },
     )
     return parameter_builder
-
-
-def resolve_evaluation_dependencies(
-    parameter_builder: ParameterBuilder,
-    domain: Domain,
-    variables: Optional[ParameterContainer] = None,
-    parameters: Optional[Dict[str, ParameterContainer]] = None,
-    fully_qualified_parameter_names: Optional[List[str]] = None,
-    recompute_existing_parameter_values: bool = False,
-) -> None:
-    """
-    This method computes ("resolves") pre-requisite ("evaluation") dependencies (i.e., results of executing other
-    "ParameterBuilder" objects), whose output(s) are needed by specified "ParameterBuilder" object to fulfill its goals.
-    """
-
-    # Step-1: Check if any "evaluation_parameter_builders" are configured for specified "ParameterBuilder" object.
-    evaluation_parameter_builders: List[
-        ParameterBuilder
-    ] = parameter_builder.evaluation_parameter_builders
-
-    if not evaluation_parameter_builders:
-        return
-
-    # Step-2: Obtain all fully-qualified parameter names ("variables" and "parameter" keys) in namespace of "Domain"
-    # (fully-qualified parameter names are stored in "ParameterNode" objects of "ParameterContainer" of "Domain"
-    # whenever "ParameterBuilder.build_parameters()" is executed for "ParameterBuilder.fully_qualified_parameter_name");
-    # this list contains both, "raw" (for internal calculations) and "JSON-serialized" fully-qualified parameter names.
-    if fully_qualified_parameter_names is None:
-        fully_qualified_parameter_names = get_fully_qualified_parameter_names(
-            domain=domain,
-            variables=variables,
-            parameters=parameters,
-        )
-
-    # Step-3: Check for presence of fully-qualified parameter names of "ParameterBuilder" objects, obtained by iterating
-    # over evaluation dependencies.  "Execute ParameterBuilder.build_parameters()" if absent from "Domain" scoped list.
-    evaluation_parameter_builder: ParameterBuilder
-    for evaluation_parameter_builder in evaluation_parameter_builders:
-        if (
-            evaluation_parameter_builder.raw_fully_qualified_parameter_name
-            not in fully_qualified_parameter_names
-            or evaluation_parameter_builder.json_serialized_fully_qualified_parameter_name
-            not in fully_qualified_parameter_names
-        ):
-            evaluation_parameter_builder.set_batch_list_if_null_batch_request(
-                batch_list=parameter_builder.batch_list,
-                batch_request=parameter_builder.batch_request,
-            )
-
-            evaluation_parameter_builder.build_parameters(
-                domain=domain,
-                variables=variables,
-                parameters=parameters,
-                recompute_existing_parameter_values=recompute_existing_parameter_values,
-            )


Test patch: