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/expectations/metrics/util.py b/great_expectations/expectations/metrics/util.py
--- a/great_expectations/expectations/metrics/util.py
+++ b/great_expectations/expectations/metrics/util.py
@@ -643,7 +643,7 @@ def get_dbms_compatible_column_names(
         error_message_template=error_message_template,
     )
 
-    column_names_list: Union[List[str], str]
+    column_names_list: List[str]
     is_list: bool
     if isinstance(column_names, list):
         column_names_list = column_names
@@ -652,9 +652,7 @@ def get_dbms_compatible_column_names(
         column_names_list = [column_names]
         is_list = False
 
-    typed_column_names_list: Union[
-        List[Union[str, quoted_name]], Union[str, quoted_name]
-    ]
+    typed_column_names_list: List[Union[str, quoted_name]]
     if isinstance(execution_engine, SqlAlchemyExecutionEngine):
         column_name: str
         batch_columns_dict: Dict[str, Union[str, quoted_name]] = {
@@ -685,7 +683,7 @@ def verify_column_names_exist(
         batch_columns_list: Properly typed column names (output of "table.columns" metric)
         error_message_template: String template to output error message if any column cannot be found in "Batch" object.
     """
-    column_names_list: Union[List[str], str]
+    column_names_list: List[str]
     if isinstance(column_names, list):
         column_names_list = column_names
     else:


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/validator/validator.py b/great_expectations/validator/validator.py
--- a/great_expectations/validator/validator.py
+++ b/great_expectations/validator/validator.py
@@ -1028,6 +1028,7 @@ def graph_validate(
                 expectation_validation_graphs=expectation_validation_graphs,
                 evrs=evrs,
                 processed_configurations=processed_configurations,
+                show_progress_bars=self._determine_progress_bars(),
             )
         except Exception as err:
             # If a general Exception occurs during the execution of "ValidationGraph.resolve()", then
@@ -1172,6 +1173,7 @@ def _resolve_suite_level_graph_and_process_metric_evaluation_errors(
         expectation_validation_graphs: List[ExpectationValidationGraph],
         evrs: List[ExpectationValidationResult],
         processed_configurations: List[ExpectationConfiguration],
+        show_progress_bars: bool,
     ) -> Tuple[
         Dict[Tuple[str, str, str], MetricValue],
         List[ExpectationValidationResult],
@@ -1186,7 +1188,7 @@ def _resolve_suite_level_graph_and_process_metric_evaluation_errors(
         resolved_metrics, aborted_metrics_info = graph.resolve(
             runtime_configuration=runtime_configuration,
             min_graph_edges_pbar_enable=0,
-            show_progress_bars=True,
+            show_progress_bars=show_progress_bars,
         )
 
         # Trace MetricResolutionError occurrences to expectations relying on corresponding malfunctioning metrics.


Test patch:
Repository: great-expectations/great_expectations

Issue:
Numpy Datetime TypeError in expect_column_pair_values_a_to_be_greater_than_b 
**Describe the bug**
I try to use expect_column_pair_values_a_to_be_greater_than_b expectation to validate my parquet files, but when run checkpoint I get a dtype exception. As image below.

![Captura de tela de 2022-12-09 22-59-52](https://user-images.githubusercontent.com/23370997/206824873-c1a9e23e-b96b-4e25-ba84-fb541f67edb7.png)

when debug convert_to_json_serializable function, does not has conditional for numpy datetime.

**Expected behavior**
numpy "DateTime" datatype to be supported in convert_to_json_serializable

**Environment (please complete the following information):**
 - Operating System: Ubuntu 20.04 Linux
 - Great Expectations 0.15.31
 - Python 3.10.6
 - File type: Parquet

Let me know if anything is unclear. 
Thx!


Discussion:
I created this condicional to numpy datetime in convert_to_json_serializable function. If it's ok, I can submit my PR for review

Resolving patch:
diff --git a/great_expectations/core/util.py b/great_expectations/core/util.py
--- a/great_expectations/core/util.py
+++ b/great_expectations/core/util.py
@@ -228,6 +228,9 @@ def convert_to_json_serializable(data) -> dict:  # noqa: C901 - complexity 28
     if isinstance(data, (datetime.datetime, datetime.date)):
         return data.isoformat()
 
+    if isinstance(data, (np.datetime64)):
+        return np.datetime_as_string(data)
+
     if isinstance(data, uuid.UUID):
         return str(data)
 


Test patch:
diff --git a/tests/core/test_convert_to_json_serializable.py b/tests/core/test_convert_to_json_serializable.py
--- a/tests/core/test_convert_to_json_serializable.py
+++ b/tests/core/test_convert_to_json_serializable.py
@@ -1,3 +1,4 @@
+import numpy as np
 import pytest
 
 from great_expectations.core.util import convert_to_json_serializable
@@ -46,3 +47,9 @@ def test_serialization_of_shapely_linestring():
 def test_serialization_of_bytes():
     data = b"\xC0\xA8\x00\x01"
     assert convert_to_json_serializable(data) == "b'\\xc0\\xa8\\x00\\x01'"
+
+
+def test_serialization_numpy_datetime():
+    datetime_to_test = "2022-12-08T12:56:23.423"
+    data = np.datetime64(datetime_to_test)
+    assert convert_to_json_serializable(data) == datetime_to_test
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/execution_engine/execution_engine.py b/great_expectations/execution_engine/execution_engine.py
--- a/great_expectations/execution_engine/execution_engine.py
+++ b/great_expectations/execution_engine/execution_engine.py
@@ -352,7 +352,7 @@ def resolve_metrics(
         (
             metric_fn_direct_configurations,
             metric_fn_bundle_configurations,
-        ) = self._build_direct_and_bundled_metric_computation_configurationsd(
+        ) = self._build_direct_and_bundled_metric_computation_configurations(
             metrics_to_resolve=metrics_to_resolve,
             metrics=metrics,
             runtime_configuration=runtime_configuration,
@@ -458,7 +458,7 @@ def resolve_data_reference(
             template_arguments=template_arguments,
         )
 
-    def _build_direct_and_bundled_metric_computation_configurationsd(
+    def _build_direct_and_bundled_metric_computation_configurations(
         self,
         metrics_to_resolve: Iterable[MetricConfiguration],
         metrics: Optional[Dict[Tuple[str, str, str], MetricValue]] = None,


Test patch:
Repository: great-expectations/great_expectations

Issue:
Display content of SQL query in validation result doc
**Is your feature request related to a problem? Please describe.**
When I use a RuntimeBatchRequest to define the BigQuery data I want to read with a SQL query, there's no way for me to see what query I ran (and therefore what data was used) in the validation results doc. 

**Describe the solution you'd like**
Instead of `SQLQuery` displayed in the `query` field in the validation doc, I'd like to see the actual text of the query run, e.g. `SELECT * FROM <mytable> ...`. 
![Screen Shot 2022-04-08 at 17 02 05](https://user-images.githubusercontent.com/27975703/165547776-f41ac4a0-0002-4d2e-a8a1-c0ce79ad2d9f.png)

**Describe alternatives you've considered**
The status quo (displaying `SQLQuery` and not the query run) is an alternative. This works okay for adhoc use, e.g. if a user has just run a validation manually and immediately reads the validation docs, but in any other situation it would be really helpful to see the query used.

**Additional context**
Using RuntimeBatchRequest with SQL queries seems like a really powerful way to use BQ data, but not being able to see which query was used for a validation would make it hard for us to use in production.



Discussion:
Thanks for raising this, @hkwweber - we will review and be in touch.
Hi @hkwweber - thanks for your patience! I wanted to let you know that we'll be discussing this internally this week to figure out when we can prioritize.

Resolving patch:
diff --git a/great_expectations/execution_engine/sqlalchemy_execution_engine.py b/great_expectations/execution_engine/sqlalchemy_execution_engine.py
--- a/great_expectations/execution_engine/sqlalchemy_execution_engine.py
+++ b/great_expectations/execution_engine/sqlalchemy_execution_engine.py
@@ -1225,7 +1225,6 @@ def get_batch_data_and_markers(
             # query != None is already checked when RuntimeQueryBatchSpec is instantiated
             query: str = batch_spec.query
 
-            batch_spec.query = "SQLQuery"
             batch_data = SqlAlchemyBatchData(
                 execution_engine=self,
                 query=query,


Test patch:
diff --git a/tests/execution_engine/test_sqlalchemy_execution_engine.py b/tests/execution_engine/test_sqlalchemy_execution_engine.py
--- a/tests/execution_engine/test_sqlalchemy_execution_engine.py
+++ b/tests/execution_engine/test_sqlalchemy_execution_engine.py
@@ -904,12 +904,14 @@ def test_get_batch_data_and_markers_using_query(sqlite_view_engine, test_df):
     test_df.to_sql("test_table_0", con=my_execution_engine.engine)
 
     query: str = "SELECT * FROM test_table_0"
+    batch_spec = RuntimeQueryBatchSpec(
+        query=query,
+    )
     batch_data, batch_markers = my_execution_engine.get_batch_data_and_markers(
-        batch_spec=RuntimeQueryBatchSpec(
-            query=query,
-        )
+        batch_spec=batch_spec
     )
 
+    assert batch_spec.query == query
     assert len(get_sqlite_temp_table_names(sqlite_view_engine)) == 2
     assert batch_markers.get("ge_load_time") is not None
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_queried_slowly_changing_table_to_have_no_gaps.py b/contrib/experimental/great_expectations_experimental/expectations/expect_queried_slowly_changing_table_to_have_no_gaps.py
--- a/contrib/experimental/great_expectations_experimental/expectations/expect_queried_slowly_changing_table_to_have_no_gaps.py
+++ b/contrib/experimental/great_expectations_experimental/expectations/expect_queried_slowly_changing_table_to_have_no_gaps.py
@@ -72,10 +72,12 @@ def _validate(
             threshold = self.default_kwarg_values["threshold"]
 
         metrics = convert_to_json_serializable(data=metrics)
+        holes_count: int
+        total_count: int
         holes_count, total_count = list(
             metrics.get("query.template_values")[0].values()
-        )[0]
-        error_rate = holes_count / total_count
+        )
+        error_rate = float(holes_count) / total_count
 
         return {
             "success": error_rate <= threshold,


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/cardinality_checker.py b/great_expectations/rule_based_profiler/helpers/cardinality_checker.py
--- a/great_expectations/rule_based_profiler/helpers/cardinality_checker.py
+++ b/great_expectations/rule_based_profiler/helpers/cardinality_checker.py
@@ -1,7 +1,7 @@
 import abc
 import enum
 from dataclasses import dataclass
-from typing import Optional, Tuple, Union
+from typing import Optional, Tuple, Union, cast
 
 from great_expectations.core.util import convert_to_json_serializable
 from great_expectations.exceptions import ProfilerConfigurationError
@@ -147,9 +147,14 @@ def cardinality_within_limit(self, metric_value: float) -> bool:
         self._validate_metric_value(metric_value=metric_value)
         if isinstance(self._cardinality_limit_mode, AbsoluteCardinalityLimit):
             return metric_value <= self._cardinality_limit_mode.max_unique_values
-        elif isinstance(self._cardinality_limit_mode, RelativeCardinalityLimit):
+
+        if isinstance(self._cardinality_limit_mode, RelativeCardinalityLimit):
             return metric_value <= self._cardinality_limit_mode.max_proportion_unique
 
+        raise ValueError(
+            f'Unknown "cardinality_limit_mode" mode "{self._cardinality_limit_mode}" encountered.'
+        )
+
     @staticmethod
     def _validate_metric_value(metric_value: float) -> None:
         if not isinstance(metric_value, (int, float)):
@@ -215,7 +220,7 @@ def _convert_to_cardinality_limit_mode(
                             f"Please specify a supported cardinality mode.  Supported cardinality modes are {[member.name for member in CardinalityLimitMode]}"
                         )
             else:
-                return cardinality_limit_mode.value
+                return cast(CardinalityLimitMode, cardinality_limit_mode).value
 
         if max_unique_values is not None:
             return AbsoluteCardinalityLimit(


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/data_context/data_context/abstract_data_context.py b/great_expectations/data_context/data_context/abstract_data_context.py
--- a/great_expectations/data_context/data_context/abstract_data_context.py
+++ b/great_expectations/data_context/data_context/abstract_data_context.py
@@ -34,7 +34,10 @@
 
 import great_expectations.exceptions as gx_exceptions
 from great_expectations.core import ExpectationSuite
-from great_expectations.core._docs_decorators import public_api
+from great_expectations.core._docs_decorators import (
+    deprecated_method_or_class,
+    public_api,
+)
 from great_expectations.core.batch import (
     Batch,
     BatchRequestBase,
@@ -2260,11 +2263,13 @@ def profile_data_asset(  # noqa: C901 - complexity 16
         profiling_results["success"] = True
         return profiling_results
 
+    @deprecated_method_or_class(
+        version="0.14.0", message="Part of the deprecated v2 API"
+    )
     def add_batch_kwargs_generator(
         self, datasource_name, batch_kwargs_generator_name, class_name, **kwargs
     ):
-        """
-        Add a batch kwargs generator to the named datasource, using the provided
+        """Add a batch kwargs generator to the named datasource, using the provided
         configuration.
 
         Args:
@@ -2274,7 +2279,7 @@ def add_batch_kwargs_generator(
             **kwargs: batch kwargs generator configuration, provided as kwargs
 
         Returns:
-
+            The batch_kwargs_generator
         """
         datasource_obj = self.get_datasource(datasource_name)
         generator = datasource_obj.add_batch_kwargs_generator(


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/data_context/data_context/abstract_data_context.py b/great_expectations/data_context/data_context/abstract_data_context.py
--- a/great_expectations/data_context/data_context/abstract_data_context.py
+++ b/great_expectations/data_context/data_context/abstract_data_context.py
@@ -648,6 +648,7 @@ def save_datasource(
         self._cached_datasources[datasource_name] = updated_datasource
         return updated_datasource
 
+    @public_api
     @usage_statistics_enabled_method(
         event_name=UsageStatsEvents.DATA_CONTEXT_ADD_DATASOURCE,
         args_payload_fn=add_datasource_usage_statistics,
@@ -659,16 +660,20 @@ def add_datasource(
         save_changes: Optional[bool] = None,
         **kwargs: Optional[dict],
     ) -> Optional[Union[LegacyDatasource, BaseDatasource]]:
-        """Add a new datasource to the data context, with configuration provided as kwargs.
+        """Add a new Datasource to the data context, with configuration provided as kwargs.
+
+        --Documentation--
+            - https://docs.greatexpectations.io/docs/terms/datasource
+
         Args:
-            name: the name for the new datasource to add
-            initialize: if False, add the datasource to the config, but do not
+            name: the name of the new Datasource to add
+            initialize: if False, add the Datasource to the config, but do not
                 initialize it, for example if a user needs to debug database connectivity.
-            save_changes (bool): should GX save the Datasource config?
-            kwargs (keyword arguments): the configuration for the new datasource
+            save_changes: should GX save the Datasource config?
+            kwargs: the configuration for the new Datasource
 
         Returns:
-            datasource (Datasource)
+            Datasource instance added.
         """
         save_changes = self._determine_save_changes_flag(save_changes)
 


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/validator/validator.py b/great_expectations/validator/validator.py
--- a/great_expectations/validator/validator.py
+++ b/great_expectations/validator/validator.py
@@ -28,6 +28,7 @@
 from marshmallow import ValidationError
 
 from great_expectations import __version__ as ge_version
+from great_expectations.core._docs_decorators import public_api
 from great_expectations.core.batch import (
     Batch,
     BatchData,
@@ -380,16 +381,22 @@ def columns(self, domain_kwargs: Optional[Dict[str, Any]] = None) -> List[str]:
         """
         return self._metrics_calculator.columns(domain_kwargs=domain_kwargs)
 
+    @public_api
     def head(
         self,
         n_rows: int = 5,
         domain_kwargs: Optional[Dict[str, Any]] = None,
         fetch_all: bool = False,
     ) -> pd.DataFrame:
-        """
-        Convenience method to obtain Batch first few rows.
+        """Return the first several rows or records from a Batch of data.
 
-        (To be deprecated in favor of using methods in "MetricsCalculator" class.)
+        Args:
+            n_rows: The number of rows to return.
+            domain_kwargs: If provided, the domain for which to return records.
+            fetch_all: If True, ignore n_rows and return the entire batch.
+
+        Returns:
+            A Pandas DataFrame containing the records' data.
         """
         return self._metrics_calculator.head(
             n_rows=n_rows, domain_kwargs=domain_kwargs, fetch_all=fetch_all


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_suite.py b/great_expectations/core/expectation_suite.py
--- a/great_expectations/core/expectation_suite.py
+++ b/great_expectations/core/expectation_suite.py
@@ -739,9 +739,11 @@ def add_expectation(
             overwrite_existing=overwrite_existing,
         )
 
+    @public_api
     def show_expectations_by_domain_type(self) -> None:
-        """
-        Displays "ExpectationConfiguration" list, grouped by "domain_type", in predetermined designated order.
+        """Displays "ExpectationConfiguration" list, grouped by "domain_type", in predetermined designated order.
+
+        The means of displaying is through the use of the "Pretty Print" library method "pprint.pprint()".
         """
         expectation_configurations_by_domain: Dict[
             str, List[ExpectationConfiguration]
@@ -762,8 +764,9 @@ def show_expectations_by_expectation_type(
         self,
         expectation_configurations: Optional[List[ExpectationConfiguration]] = None,
     ) -> None:
-        """
-        Displays "ExpectationConfiguration" list, grouped by "expectation_type", in predetermined designated order.
+        """Displays "ExpectationConfiguration" list, grouped by "expectation_type", in predetermined designated order.
+
+        The means of displaying is through the use of the "Pretty Print" library method "pprint.pprint()".
         """
         if expectation_configurations is None:
             expectation_configurations = (


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/core/expect_column_values_to_not_be_in_set.py b/great_expectations/expectations/core/expect_column_values_to_not_be_in_set.py
--- a/great_expectations/expectations/core/expect_column_values_to_not_be_in_set.py
+++ b/great_expectations/expectations/core/expect_column_values_to_not_be_in_set.py
@@ -122,7 +122,20 @@ class ExpectColumnValuesToNotBeInSet(ColumnMapExpectation):
     def validate_configuration(
         self, configuration: Optional[ExpectationConfiguration] = None
     ) -> None:
-        """Validates that a value_set has been provided."""
+        """
+        Validates the configuration of an Expectation.
+
+        The configuration will also be validated using each of the `validate_configuration` methods in its Expectation
+        superclass hierarchy.
+
+        Args:
+            configuration: An `ExpectationConfiguration` to validate. If no configuration is provided, it will be pulled
+                                  from the configuration attribute of the Expectation instance.
+
+        Raises:
+            `InvalidExpectationConfigurationError`: The configuration does not contain the values required by the
+            Expectation.
+        """
         super().validate_configuration(configuration)
         configuration = configuration or self.configuration
         try:


Test patch: