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
@@ -165,55 +165,65 @@ def build_parameters(
             batch_request: Explicit batch_request used to supply data at runtime.
             force_batch_data: Whether or not to overwrite existing batch_request value in ParameterBuilder components.
         """
-        self.set_batch_list_or_batch_request(
-            batch_list=batch_list,
-            batch_request=batch_request,
-            force_batch_data=force_batch_data,
-        )
-
-        resolve_evaluation_dependencies(
-            parameter_builder=self,
+        fully_qualified_parameter_names: List[
+            str
+        ] = get_fully_qualified_parameter_names(
             domain=domain,
             variables=variables,
             parameters=parameters,
         )
+        if self.fully_qualified_parameter_name not in fully_qualified_parameter_names:
+            self.set_batch_list_or_batch_request(
+                batch_list=batch_list,
+                batch_request=batch_request,
+                force_batch_data=force_batch_data,
+            )
 
-        if parameter_computation_impl is None:
-            parameter_computation_impl = self._build_parameters
+            resolve_evaluation_dependencies(
+                parameter_builder=self,
+                domain=domain,
+                variables=variables,
+                parameters=parameters,
+                fully_qualified_parameter_names=fully_qualified_parameter_names,
+            )
 
-        computed_parameter_value: Any
-        parameter_computation_details: dict
-        (
-            computed_parameter_value,
-            parameter_computation_details,
-        ) = parameter_computation_impl(
-            domain=domain,
-            variables=variables,
-            parameters=parameters,
-        )
+            if parameter_computation_impl is None:
+                parameter_computation_impl = self._build_parameters
 
-        if json_serialize is None:
-            # Obtain json_serialize directive from "rule state" (i.e., variables and parameters); from instance variable otherwise.
-            json_serialize = get_parameter_value_and_validate_return_type(
+            computed_parameter_value: Any
+            parameter_computation_details: dict
+            (
+                computed_parameter_value,
+                parameter_computation_details,
+            ) = parameter_computation_impl(
                 domain=domain,
-                parameter_reference=self.json_serialize,
-                expected_return_type=bool,
                 variables=variables,
                 parameters=parameters,
             )
 
-        parameter_values: Dict[str, Any] = {
-            self.fully_qualified_parameter_name: {
-                "value": convert_to_json_serializable(data=computed_parameter_value)
-                if json_serialize
-                else computed_parameter_value,
-                "details": parameter_computation_details,
-            },
-        }
+            if json_serialize is None:
+                # Obtain json_serialize directive from "rule state" (i.e., variables and parameters); from instance variable otherwise.
+                json_serialize = get_parameter_value_and_validate_return_type(
+                    domain=domain,
+                    parameter_reference=self.json_serialize,
+                    expected_return_type=bool,
+                    variables=variables,
+                    parameters=parameters,
+                )
 
-        build_parameter_container(
-            parameter_container=parameters[domain.id], parameter_values=parameter_values
-        )
+            parameter_values: Dict[str, Any] = {
+                self.fully_qualified_parameter_name: {
+                    "value": convert_to_json_serializable(data=computed_parameter_value)
+                    if json_serialize
+                    else computed_parameter_value,
+                    "details": parameter_computation_details,
+                },
+            }
+
+            build_parameter_container(
+                parameter_container=parameters[domain.id],
+                parameter_values=parameter_values,
+            )
 
     @property
     @abstractmethod
@@ -652,6 +662,7 @@ def resolve_evaluation_dependencies(
     domain: Domain,
     variables: Optional[ParameterContainer] = None,
     parameters: Optional[Dict[str, ParameterContainer]] = None,
+    fully_qualified_parameter_names: Optional[List[str]] = None,
 ) -> None:
     """
     This method computes ("resolves") pre-requisite ("evaluation") dependencies (i.e., results of executing other
@@ -668,11 +679,12 @@ def resolve_evaluation_dependencies(
     # 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").
-    fully_qualified_parameter_names: List[str] = get_fully_qualified_parameter_names(
-        domain=domain,
-        variables=variables,
-        parameters=parameters,
-    )
+    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.


Test patch: