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/data_context/data_context/base_data_context.py b/great_expectations/data_context/data_context/base_data_context.py
--- a/great_expectations/data_context/data_context/base_data_context.py
+++ b/great_expectations/data_context/data_context/base_data_context.py
@@ -1776,7 +1776,7 @@ def get_validator(
         batch: Optional[Batch] = None,
         batch_list: Optional[List[Batch]] = None,
         batch_request: Optional[BatchRequestBase] = None,
-        batch_request_list: List[Optional[BatchRequestBase]] = None,
+        batch_request_list: Optional[List[BatchRequestBase]] = None,
         batch_data: Optional[Any] = None,
         data_connector_query: Optional[Union[IDDict, dict]] = None,
         batch_identifiers: Optional[dict] = None,
diff --git a/great_expectations/rule_based_profiler/data_assistant/data_assistant_runner.py b/great_expectations/rule_based_profiler/data_assistant/data_assistant_runner.py
--- a/great_expectations/rule_based_profiler/data_assistant/data_assistant_runner.py
+++ b/great_expectations/rule_based_profiler/data_assistant/data_assistant_runner.py
@@ -129,8 +129,8 @@ def run(
         """
         data_assistant_name: str = self._data_assistant_cls.data_assistant_type
         validator: Validator = get_validator_with_expectation_suite(
-            batch_request=batch_request,
             data_context=self._data_context,
+            batch_request=batch_request,
             expectation_suite=None,
             expectation_suite_name=None,
             component_name=data_assistant_name,
diff --git a/great_expectations/rule_based_profiler/helpers/util.py b/great_expectations/rule_based_profiler/helpers/util.py
--- a/great_expectations/rule_based_profiler/helpers/util.py
+++ b/great_expectations/rule_based_profiler/helpers/util.py
@@ -83,11 +83,6 @@ def get_validator(
             variables=variables,
             parameters=parameters,
         )
-
-        validator = data_context.get_validator(
-            batch_request=batch_request,
-            create_expectation_suite_with_name=expectation_suite_name,
-        )
     else:
         num_batches: int = len(batch_list)
         if num_batches == 0:
@@ -96,16 +91,19 @@ def get_validator(
 """
             )
 
-        expectation_suite: ExpectationSuite = data_context.create_expectation_suite(
-            expectation_suite_name=expectation_suite_name
-        )
-        validator = data_context.get_validator_using_batch_list(
-            expectation_suite=expectation_suite,
-            batch_list=batch_list,
-        )
+    validator = get_validator_with_expectation_suite(
+        data_context=data_context,
+        batch_list=batch_list,
+        batch_request=batch_request,
+        expectation_suite=None,
+        expectation_suite_name=expectation_suite_name,
+        component_name=f"rule_based_profiler-{expectation_suite_name}",
+        persist=False,
+    )
 
     # Always disabled for RBP and DataAssistants due to volume of metric calculations
     validator.show_progress_bars = False
+
     return validator
 
 
@@ -710,16 +708,17 @@ def _determine_quantile_bias_corrected_point_estimate(
 
 
 def get_validator_with_expectation_suite(
-    batch_request: Union[BatchRequestBase, dict],
     data_context: "BaseDataContext",  # noqa: F821
+    batch_list: Optional[List[Batch]] = None,
+    batch_request: Optional[Union[BatchRequestBase, dict]] = None,
     expectation_suite: Optional["ExpectationSuite"] = None,  # noqa: F821
     expectation_suite_name: Optional[str] = None,
     component_name: str = "test",
     persist: bool = False,
 ) -> "Validator":  # noqa: F821
     """
-    Instantiates and returns "Validator" object using "data_context", "batch_request", and other available information.
-    Use "expectation_suite" if provided.  If not, then if "expectation_suite_name" is specified, then create
+    Instantiates and returns "Validator" using "data_context", "batch_list" or "batch_request", and other information.
+    Use "expectation_suite" if provided; otherwise, if "expectation_suite_name" is specified, then create
     "ExpectationSuite" from it.  Otherwise, generate temporary "expectation_suite_name" using supplied "component_name".
     """
     assert expectation_suite is None or isinstance(expectation_suite, ExpectationSuite)
@@ -732,9 +731,9 @@ def get_validator_with_expectation_suite(
         component_name=component_name,
         persist=persist,
     )
-
     batch_request = materialize_batch_request(batch_request=batch_request)
     validator: "Validator" = data_context.get_validator(  # noqa: F821
+        batch_list=batch_list,
         batch_request=batch_request,
         expectation_suite=expectation_suite,
     )


Test patch:
diff --git a/tests/integration/profiling/rule_based_profilers/test_profiler_user_workflows.py b/tests/integration/profiling/rule_based_profilers/test_profiler_user_workflows.py
--- a/tests/integration/profiling/rule_based_profilers/test_profiler_user_workflows.py
+++ b/tests/integration/profiling/rule_based_profilers/test_profiler_user_workflows.py
@@ -60,8 +60,8 @@ def alice_validator(alice_columnar_table_single_batch_context) -> Validator:
     }
 
     validator: Validator = get_validator_with_expectation_suite(
-        batch_request=batch_request,
         data_context=context,
+        batch_request=batch_request,
         expectation_suite_name=None,
         expectation_suite=None,
         component_name="profiler",
@@ -85,8 +85,8 @@ def bobby_validator(
     }
 
     validator: Validator = get_validator_with_expectation_suite(
-        batch_request=batch_request,
         data_context=context,
+        batch_request=batch_request,
         expectation_suite_name=None,
         expectation_suite=None,
         component_name="profiler",
@@ -115,8 +115,8 @@ def bobster_validator(
     }
 
     validator: Validator = get_validator_with_expectation_suite(
-        batch_request=batch_request,
         data_context=context,
+        batch_request=batch_request,
         expectation_suite_name=None,
         expectation_suite=None,
         component_name="profiler",
@@ -142,8 +142,8 @@ def quentin_validator(
     }
 
     validator: Validator = get_validator_with_expectation_suite(
-        batch_request=batch_request,
         data_context=context,
+        batch_request=batch_request,
         expectation_suite_name=None,
         expectation_suite=None,
         component_name="profiler",
@@ -1110,8 +1110,8 @@ def test_bobby_expect_column_values_to_be_between_auto_yes_default_profiler_conf
     }
 
     validator: Validator = get_validator_with_expectation_suite(
-        batch_request=batch_request,
         data_context=context,
+        batch_request=batch_request,
         expectation_suite_name=None,
         expectation_suite=None,
         component_name="profiler",
@@ -1356,8 +1356,8 @@ def test_bobby_expect_column_values_to_be_between_auto_yes_default_profiler_conf
     }
 
     validator: Validator = get_validator_with_expectation_suite(
-        batch_request=batch_request,
         data_context=context,
+        batch_request=batch_request,
         expectation_suite_name=None,
         expectation_suite=None,
         component_name="profiler",
diff --git a/tests/rule_based_profiler/data_assistant/test_onboarding_data_assistant.py b/tests/rule_based_profiler/data_assistant/test_onboarding_data_assistant.py
--- a/tests/rule_based_profiler/data_assistant/test_onboarding_data_assistant.py
+++ b/tests/rule_based_profiler/data_assistant/test_onboarding_data_assistant.py
@@ -143,8 +143,8 @@ def run_onboarding_data_assistant_result_jupyter_notebook_with_new_cell(
 
     explicit_instantiation_code: str = """
     validator: Validator = get_validator_with_expectation_suite(
-        batch_request=batch_request,
         data_context=context,
+        batch_request=batch_request,
         expectation_suite_name=None,
         expectation_suite=None,
         component_name="onboarding_data_assistant",
diff --git a/tests/rule_based_profiler/data_assistant/test_volume_data_assistant.py b/tests/rule_based_profiler/data_assistant/test_volume_data_assistant.py
--- a/tests/rule_based_profiler/data_assistant/test_volume_data_assistant.py
+++ b/tests/rule_based_profiler/data_assistant/test_volume_data_assistant.py
@@ -2128,8 +2128,8 @@ def quentin_explicit_instantiation_result_actual_time(
     }
 
     validator: Validator = get_validator_with_expectation_suite(
-        batch_request=batch_request,
         data_context=context,
+        batch_request=batch_request,
         expectation_suite_name=None,
         expectation_suite=None,
         component_name="volume_data_assistant",
@@ -2164,8 +2164,8 @@ def quentin_explicit_instantiation_result_frozen_time(
     }
 
     validator: Validator = get_validator_with_expectation_suite(
-        batch_request=batch_request,
         data_context=context,
+        batch_request=batch_request,
         expectation_suite_name=None,
         expectation_suite=None,
         component_name="volume_data_assistant",
@@ -2280,8 +2280,8 @@ def run_volume_data_assistant_result_jupyter_notebook_with_new_cell(
 
     explicit_instantiation_code: str = """
     validator: Validator = get_validator_with_expectation_suite(
-        batch_request=batch_request,
         data_context=context,
+        batch_request=batch_request,
         expectation_suite_name=None,
         expectation_suite=None,
         component_name="volume_data_assistant",
diff --git a/tests/rule_based_profiler/parameter_builder/test_regex_pattern_string_parameter_builder.py b/tests/rule_based_profiler/parameter_builder/test_regex_pattern_string_parameter_builder.py
--- a/tests/rule_based_profiler/parameter_builder/test_regex_pattern_string_parameter_builder.py
+++ b/tests/rule_based_profiler/parameter_builder/test_regex_pattern_string_parameter_builder.py
@@ -393,13 +393,10 @@ def test_regex_wrong_domain(mock_data_context: mock.MagicMock, batch_fixture: Ba
 
 @mock.patch("great_expectations.data_context.data_context.DataContext")
 def test_regex_single_candidate(
-    mock_data_context: mock.MagicMock, batch_fixture: Batch
+    mock_data_context: mock.MagicMock,
+    batch_fixture: Batch,
 ):
     batch: Batch = batch_fixture
-    mock_data_context.get_batch_list.return_value = [batch]
-    mock_data_context.get_validator_using_batch_list.return_value = Validator(
-        execution_engine=PandasExecutionEngine(), batches=[batch]
-    )
 
     data_context: DataContext = mock_data_context
 
@@ -425,6 +422,12 @@ def test_regex_single_candidate(
         domain.id: parameter_container,
     }
 
+    validator: Validator = Validator(
+        execution_engine=PandasExecutionEngine(),
+        batches=[batch],
+    )
+    mock_data_context.get_validator.return_value = validator
+
     assert parameter_container.parameter_nodes is None
 
     regex_pattern_string_parameter_builder.build_parameters(
@@ -464,10 +467,6 @@ def test_regex_single_candidate(
 def test_regex_two_candidates(mock_data_context: mock.MagicMock, batch_fixture: Batch):
     batch: Batch = batch_fixture
 
-    mock_data_context.get_batch_list.return_value = [batch]
-    mock_data_context.get_validator_using_batch_list.return_value = Validator(
-        execution_engine=PandasExecutionEngine(), batches=[batch]
-    )
     data_context: DataContext = mock_data_context
 
     metric_domain_kwargs: dict = {"column": "b"}
@@ -492,6 +491,12 @@ def test_regex_two_candidates(mock_data_context: mock.MagicMock, batch_fixture:
         domain.id: parameter_container,
     }
 
+    validator: Validator = Validator(
+        execution_engine=PandasExecutionEngine(),
+        batches=[batch],
+    )
+    mock_data_context.get_validator.return_value = validator
+
     assert parameter_container.parameter_nodes is None
 
     regex_pattern_string_parameter_builder.build_parameters(