internlm/SWE-Fixer-Train-110K huggingface dataset:
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/rule/rule.py b/great_expectations/rule_based_profiler/rule/rule.py
--- a/great_expectations/rule_based_profiler/rule/rule.py
+++ b/great_expectations/rule_based_profiler/rule/rule.py
@@ -44,7 +44,7 @@ def __init__(
 
         self._parameters = {}
 
-    def generate(
+    def run(
         self,
         variables: Optional[ParameterContainer] = None,
         batch_list: Optional[List[Batch]] = None,
diff --git a/great_expectations/rule_based_profiler/rule_based_profiler.py b/great_expectations/rule_based_profiler/rule_based_profiler.py
--- a/great_expectations/rule_based_profiler/rule_based_profiler.py
+++ b/great_expectations/rule_based_profiler/rule_based_profiler.py
@@ -294,7 +294,7 @@ def run(
 
         rule: Rule
         for rule in effective_rules:
-            expectation_configurations: List[ExpectationConfiguration] = rule.generate(
+            expectation_configurations: List[ExpectationConfiguration] = rule.run(
                 variables=effective_variables,
                 batch_list=batch_list,
                 batch_request=batch_request,


Test patch:
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/examples/expectations/set_based_column_map_expectation_template.py b/examples/expectations/set_based_column_map_expectation_template.py
--- a/examples/expectations/set_based_column_map_expectation_template.py
+++ b/examples/expectations/set_based_column_map_expectation_template.py
@@ -1,7 +1,7 @@
 """
 This is a template for creating custom SetBasedColumnMapExpectations.
 For detailed instructions on how to use it, please see:
-    https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_seet_based_column_map_expectations
+    https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_set_based_column_map_expectations
 """
 
 from great_expectations.expectations.regex_based_column_map_expectation import (


Test patch:
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/contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_geojson.py b/contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_geojson.py
--- a/contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_geojson.py
+++ b/contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_geojson.py
@@ -195,4 +195,4 @@ def _prescriptive_renderer(
 
 
 if __name__ == "__main__":
-    ExpectColumnValuesToBeValidGeojson().print_diagnostic_checklist()
\ No newline at end of file
+    ExpectColumnValuesToBeValidGeojson().print_diagnostic_checklist()


Test patch:
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/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
@@ -37,7 +37,7 @@
 TEMPORARY_EXPECTATION_SUITE_NAME_PREFIX: str = "tmp"
 TEMPORARY_EXPECTATION_SUITE_NAME_STEM: str = "suite"
 TEMPORARY_EXPECTATION_SUITE_NAME_PATTERN: re.Pattern = re.compile(
-    rf"^{TEMPORARY_EXPECTATION_SUITE_NAME_PREFIX}\..+\.{TEMPORARY_EXPECTATION_SUITE_NAME_STEM}\w{8}"
+    rf"^{TEMPORARY_EXPECTATION_SUITE_NAME_PREFIX}\..+\.{TEMPORARY_EXPECTATION_SUITE_NAME_STEM}\.\w{8}"
 )
 
 
@@ -490,15 +490,16 @@ def compute_bootstrap_quantiles_point_estimate(
     sample_lower_quantile: np.ndarray = np.quantile(metric_values, q=lower_quantile_pct)
     sample_upper_quantile: np.ndarray = np.quantile(metric_values, q=upper_quantile_pct)
 
+    bootstraps: np.ndarray
     if random_seed:
         random_state: np.random.Generator = np.random.Generator(
             np.random.PCG64(random_seed)
         )
-        bootstraps: np.ndarray = random_state.choice(
+        bootstraps = random_state.choice(
             metric_values, size=(n_resamples, metric_values.size)
         )
     else:
-        bootstraps: np.ndarray = np.random.choice(
+        bootstraps = np.random.choice(
             metric_values, size=(n_resamples, metric_values.size)
         )
 
@@ -627,7 +628,7 @@ def get_or_create_expectation_suite(
         if not component_name:
             component_name = "test"
 
-        expectation_suite_name = f"{TEMPORARY_EXPECTATION_SUITE_NAME_PREFIX}.{component_name}.{TEMPORARY_EXPECTATION_SUITE_NAME_STEM}{str(uuid.uuid4())[:8]}"
+        expectation_suite_name = f"{TEMPORARY_EXPECTATION_SUITE_NAME_PREFIX}.{component_name}.{TEMPORARY_EXPECTATION_SUITE_NAME_STEM}.{str(uuid.uuid4())[:8]}"
 
     if create_expectation_suite:
         try:
diff --git a/great_expectations/rule_based_profiler/parameter_builder/numeric_metric_range_multi_batch_parameter_builder.py b/great_expectations/rule_based_profiler/parameter_builder/numeric_metric_range_multi_batch_parameter_builder.py
--- a/great_expectations/rule_based_profiler/parameter_builder/numeric_metric_range_multi_batch_parameter_builder.py
+++ b/great_expectations/rule_based_profiler/parameter_builder/numeric_metric_range_multi_batch_parameter_builder.py
@@ -235,7 +235,7 @@ def _build_parameters(
                 f"""You have chosen a false_positive_rate of {false_positive_rate}, which is too close to 1.
 A false_positive_rate of {1.0-NP_EPSILON} has been selected instead."""
             )
-            false_positive_rate = 1.0 - NP_EPSILON
+            false_positive_rate = np.float64(1.0 - NP_EPSILON)
 
         # Compute metric value for each Batch object.
         super().build_parameters(


Test patch:
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/core/expectation_validation_result.py b/great_expectations/core/expectation_validation_result.py
--- a/great_expectations/core/expectation_validation_result.py
+++ b/great_expectations/core/expectation_validation_result.py
@@ -1,3 +1,4 @@
+import datetime
 import json
 import logging
 from copy import deepcopy
@@ -5,6 +6,7 @@
 from uuid import UUID
 
 import great_expectations.exceptions as ge_exceptions
+from great_expectations import __version__ as ge_version
 from great_expectations.core.expectation_configuration import (
     ExpectationConfigurationSchema,
 )
@@ -146,13 +148,38 @@ def __ne__(self, other):
             return True
 
     def __repr__(self):
+        """
+        # TODO: <Alex>5/9/2022</Alex>
+        This implementation is non-ideal (it was agreed to employ it for development expediency).  A better approach
+        would consist of "__str__()" calling "__repr__()", while all output options are handled through state variables.
+        """
+        json_dict: dict = self.to_json_dict()
         if in_jupyter_notebook():
-            json_dict = self.to_json_dict()
-            json_dict.pop("expectation_config")
-            return json.dumps(json_dict, indent=2)
-        return json.dumps(self.to_json_dict(), indent=2)
+            json_dict: dict = self.to_json_dict()
+            if (
+                "expectation_config" in json_dict
+                and "kwargs" in json_dict["expectation_config"]
+                and "auto" in json_dict["expectation_config"]["kwargs"]
+            ):
+                json_dict["expectation_config"]["meta"] = {
+                    "auto_generated_at": datetime.datetime.now(
+                        datetime.timezone.utc
+                    ).strftime("%Y%m%dT%H%M%S.%fZ"),
+                    "great_expectations_version": ge_version,
+                }
+                json_dict["expectation_config"]["kwargs"].pop("auto")
+                json_dict["expectation_config"]["kwargs"].pop("batch_id", None)
+            else:
+                json_dict.pop("expectation_config", None)
+
+        return json.dumps(json_dict, indent=2)
 
     def __str__(self):
+        """
+        # TODO: <Alex>5/9/2022</Alex>
+        This implementation is non-ideal (it was agreed to employ it for development expediency).  A better approach
+        would consist of "__str__()" calling "__repr__()", while all output options are handled through state variables.
+        """
         return json.dumps(self.to_json_dict(), indent=2)
 
     @staticmethod


Test patch:
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/data_assistant/data_assistant_dispatcher.py b/great_expectations/rule_based_profiler/data_assistant/data_assistant_dispatcher.py
--- a/great_expectations/rule_based_profiler/data_assistant/data_assistant_dispatcher.py
+++ b/great_expectations/rule_based_profiler/data_assistant/data_assistant_dispatcher.py
@@ -1,5 +1,5 @@
 import logging
-from typing import Dict, Optional, Type
+from typing import Dict, Optional, Set, Type
 
 from great_expectations.rule_based_profiler.data_assistant import DataAssistant
 from great_expectations.rule_based_profiler.data_assistant.data_assistant_runner import (
@@ -61,7 +61,7 @@ def register_data_assistant(
         data_assistant: Type[DataAssistant],  # noqa: F821
     ) -> None:
         """
-        This method executes "run()" of effective "RuleBasedProfiler" and fills "DataAssistantResult" object with outputs.
+        This method registers "DataAssistant" subclass for future instantiation and execution of its "run()" method.
 
         Args:
             data_assistant: "DataAssistant" class to be registered
@@ -89,14 +89,14 @@ def _register(cls, name: str, data_assistant: Type[DataAssistant]) -> None:
     def get_data_assistant_impl(
         cls,
         name: Optional[str],
-    ) -> Optional[Type[DataAssistant]]:  # noqa: F821
+    ) -> Optional[Type[DataAssistant]]:
         """
         This method obtains (previously registered) "DataAssistant" class from DataAssistant Registry.
 
         Note that it will clean the input string before checking against registered assistants.
 
         Args:
-            data_assistant_type: String representing "snake case" version of "DataAssistant" class type
+            name: String representing "snake case" version of "DataAssistant" class type
 
         Returns:
             Class inheriting "DataAssistant" if found; otherwise, None
@@ -105,3 +105,23 @@ def get_data_assistant_impl(
             return None
         name = name.lower()
         return cls._registered_data_assistants.get(name)
+
+    def __dir__(self):
+        """
+        This custom magic method is used to enable tab completion on "DataAssistantDispatcher" objects.
+        """
+        data_assistant_dispatcher_attrs: Set[str] = set(super().__dir__())
+        data_assistant_registered_names: Set[
+            str
+        ] = get_registered_data_assistant_names()
+        combined_dir_attrs: Set[str] = (
+            data_assistant_dispatcher_attrs | data_assistant_registered_names
+        )
+        return list(combined_dir_attrs)
+
+
+def get_registered_data_assistant_names() -> Set[str]:
+    """
+    This method returns names (registered data_assistant_type and alias name) of registered "DataAssistant" classes.
+    """
+    return set(DataAssistantDispatcher._registered_data_assistants.keys())


Test patch:
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/dataset/sqlalchemy_dataset.py b/great_expectations/dataset/sqlalchemy_dataset.py
--- a/great_expectations/dataset/sqlalchemy_dataset.py
+++ b/great_expectations/dataset/sqlalchemy_dataset.py
@@ -612,6 +612,9 @@ def __init__(
             self.dialect = import_library_module(
                 module_name="teradatasqlalchemy.dialect"
             )
+        elif dialect_name == "trino":
+            # WARNING: Trino Support is experimental, functionality is not fully under test
+            self.dialect = import_library_module(module_name="trino.sqlalchemy")
         else:
             self.dialect = None
 


Test patch:
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/data_assistant/onboarding_data_assistant.py b/great_expectations/rule_based_profiler/data_assistant/onboarding_data_assistant.py
--- a/great_expectations/rule_based_profiler/data_assistant/onboarding_data_assistant.py
+++ b/great_expectations/rule_based_profiler/data_assistant/onboarding_data_assistant.py
@@ -63,6 +63,10 @@ def expectation_kwargs_by_expectation_type(self) -> Dict[str, Dict[str, Any]]:
                 "auto": True,
                 "profiler_config": None,
             },
+            "expect_table_columns_to_match_set": {
+                "auto": True,
+                "profiler_config": None,
+            },
         }
 
     @property


Test patch:
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
@@ -89,7 +89,7 @@ def test_onboarding_data_assistant_result_serialization(
         bobby_onboarding_data_assistant_result.to_json_dict()
         == onboarding_data_assistant_result_as_dict
     )
-    assert len(bobby_onboarding_data_assistant_result.profiler_config.rules) == 7
+    assert len(bobby_onboarding_data_assistant_result.profiler_config.rules) == 8
 
 
 def test_onboarding_data_assistant_result_batch_id_to_batch_identifier_display_name_map_coverage(
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/data_assistant/data_assistant.py b/great_expectations/rule_based_profiler/data_assistant/data_assistant.py
--- a/great_expectations/rule_based_profiler/data_assistant/data_assistant.py
+++ b/great_expectations/rule_based_profiler/data_assistant/data_assistant.py
@@ -109,6 +109,7 @@ def get_table_row_count_metric_multi_batch_parameter_builder(
             """
             return self.build_numeric_metric_multi_batch_parameter_builder(
                 metric_name="table.row_count",
+                metric_domain_kwargs=None,
                 metric_value_kwargs=None,
                 json_serialize=json_serialize,
             )
@@ -312,6 +313,9 @@ def get_column_standard_deviation_metric_multi_batch_parameter_builder(
         @staticmethod
         def build_numeric_metric_multi_batch_parameter_builder(
             metric_name: str,
+            metric_domain_kwargs: Optional[
+                Union[str, dict]
+            ] = DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,
             metric_value_kwargs: Optional[Union[str, dict]] = None,
             json_serialize: Union[str, bool] = True,
         ) -> MetricMultiBatchParameterBuilder:
@@ -322,7 +326,7 @@ def build_numeric_metric_multi_batch_parameter_builder(
             return MetricMultiBatchParameterBuilder(
                 name=name,
                 metric_name=metric_name,
-                metric_domain_kwargs=DOMAIN_KWARGS_PARAMETER_FULLY_QUALIFIED_NAME,
+                metric_domain_kwargs=metric_domain_kwargs,
                 metric_value_kwargs=metric_value_kwargs,
                 enforce_numeric_metric=True,
                 replace_nan_with_zero=True,


Test patch:
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
@@ -1562,7 +1562,6 @@ def _profiler_config(name: str) -> RuleBasedProfilerConfig:
                     },
                     "parameter_builders": [
                         {
-                            "metric_domain_kwargs": "$domain.domain_kwargs",
                             "replace_nan_with_zero": True,
                             "name": "table_row_count",
                             "module_name": "great_expectations.rule_based_profiler.parameter_builder.metric_multi_batch_parameter_builder",
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/expectations/metrics/column_aggregate_metrics/column_values_length_max.py b/great_expectations/expectations/metrics/column_aggregate_metrics/column_values_length_max.py
--- a/great_expectations/expectations/metrics/column_aggregate_metrics/column_values_length_max.py
+++ b/great_expectations/expectations/metrics/column_aggregate_metrics/column_values_length_max.py
@@ -27,5 +27,5 @@ def _sqlalchemy(cls, column, **kwargs: dict):  # type: ignore[no-untyped-def]
         return sa.func.max(sa.func.length(column))
 
     @column_aggregate_partial(engine=SparkDFExecutionEngine, filter_column_isnull=True)
-    def _spark(cls, column: str, **kwargs: dict):  # type: ignore[no-untyped-def]
-        return F.max(F.length(F.col(column)))
+    def _spark(cls, column, **kwargs: dict):  # type: ignore[no-untyped-def]
+        return F.max(F.length(column))
diff --git a/great_expectations/expectations/metrics/column_aggregate_metrics/column_values_length_min.py b/great_expectations/expectations/metrics/column_aggregate_metrics/column_values_length_min.py
--- a/great_expectations/expectations/metrics/column_aggregate_metrics/column_values_length_min.py
+++ b/great_expectations/expectations/metrics/column_aggregate_metrics/column_values_length_min.py
@@ -27,5 +27,5 @@ def _sqlalchemy(cls, column, **kwargs: dict):  # type: ignore[no-untyped-def]
         return sa.func.min(sa.func.length(column))
 
     @column_aggregate_partial(engine=SparkDFExecutionEngine, filter_column_isnull=True)
-    def _spark(cls, column: str, **kwargs: dict):  # type: ignore[no-untyped-def]
-        return F.min(F.length(F.col(column)))
+    def _spark(cls, column, **kwargs: dict):  # type: ignore[no-untyped-def]
+        return F.min(F.length(column))


Test patch:
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/scripts/build_api_docs.py b/scripts/build_api_docs.py
--- a/scripts/build_api_docs.py
+++ b/scripts/build_api_docs.py
@@ -635,7 +635,7 @@ class and its Public API methods
         abbreviated_method, cross_links, sidebar_id = build_method_document(
             method_name, whitelisted_method, qualified_class_path, github_path
         )
-        in_progress_methods.append(abbreviated_method)
+        in_progress_methods.append(f"- {abbreviated_method}")
         all_edited_cross_link_files.update(cross_links)
         sidebar_method_items.append(
             f"{{ label: '  .{method_name}(...)', type: 'doc', id: '{sidebar_id}' }}"


Test patch:
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/domain_builder/map_metric_column_domain_builder.py b/great_expectations/rule_based_profiler/domain_builder/map_metric_column_domain_builder.py
--- a/great_expectations/rule_based_profiler/domain_builder/map_metric_column_domain_builder.py
+++ b/great_expectations/rule_based_profiler/domain_builder/map_metric_column_domain_builder.py
@@ -310,15 +310,14 @@ def _get_column_names_satisfying_tolerance_limits(
             for column_name, resolved_metrics in resolved_metrics_by_column_name.items()
         }
 
+        metric_value_ratios: List[float]
         metric_value_ratio: float
         intra_batch_adherence_by_column_name: Dict[str, List[bool]] = {
             column_name: [
                 metric_value_ratio <= max_unexpected_ratio
-                for metric_value_ratio in intra_batch_unexpected_ratios_by_column_name[
-                    column_name
-                ]
+                for metric_value_ratio in metric_value_ratios
             ]
-            for column_name in intra_batch_unexpected_ratios_by_column_name.keys()
+            for column_name, metric_value_ratios in intra_batch_unexpected_ratios_by_column_name.items()
         }
 
         inter_batch_adherence_by_column_name: Dict[str, float] = {


Test patch:
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/expectations/metrics/column_aggregate_metrics/column_partition.py b/great_expectations/expectations/metrics/column_aggregate_metrics/column_partition.py
--- a/great_expectations/expectations/metrics/column_aggregate_metrics/column_partition.py
+++ b/great_expectations/expectations/metrics/column_aggregate_metrics/column_partition.py
@@ -138,12 +138,14 @@ def _get_column_partition_using_metrics(bins, n_bins, _metrics):
         sturges = np.log2(nonnull_count + 1)
         min_, _25, _75, max_ = _metrics["column.quantile_values"]
         iqr = _75 - _25
-        if iqr < 1e-10:  # Consider IQR 0 and do not use variance-based estimator
-            n_bins = sturges
+        if iqr < 1.0e-10:  # Consider IQR 0 and do not use variance-based estimator
+            n_bins = int(np.ceil(sturges))
         else:
             fd = (2 * float(iqr)) / (nonnull_count ** (1 / 3))
             n_bins = max(int(np.ceil(sturges)), int(np.ceil(float(max_ - min_) / fd)))
+
         bins = np.linspace(start=float(min_), stop=float(max_), num=n_bins + 1).tolist()
     else:
         raise ValueError("Invalid parameter for bins argument")
+
     return bins


Test patch: