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/core/expect_column_mean_to_be_between.py b/great_expectations/expectations/core/expect_column_mean_to_be_between.py
--- a/great_expectations/expectations/core/expect_column_mean_to_be_between.py
+++ b/great_expectations/expectations/core/expect_column_mean_to_be_between.py
@@ -146,7 +146,7 @@ class ExpectColumnMeanToBeBetween(ColumnExpectation):
                     "n_resamples": 9999,
                     "random_seed": None,
                     "quantile_statistic_interpolation_method": "nearest",
-                    "quantile_bias_correcdtion": False,
+                    "quantile_bias_correction": False,
                     "quantile_bias_std_error_ratio_threshold": None,
                     "include_estimator_samples_histogram_in_details": False,
                     "truncate_values": {


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_result/data_assistant_result.py b/great_expectations/rule_based_profiler/data_assistant_result/data_assistant_result.py
--- a/great_expectations/rule_based_profiler/data_assistant_result/data_assistant_result.py
+++ b/great_expectations/rule_based_profiler/data_assistant_result/data_assistant_result.py
@@ -283,6 +283,8 @@ def __dir__(self) -> List[str]:
             DataAssistantResult.ALLOWED_KEYS
             | {
                 "get_expectation_suite",
+                "show_expectations_by_domain_type",
+                "show_expectations_by_expectation_type",
                 "plot_metrics",
                 "plot_expectations_and_metrics",
             }


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/usage_statistics/package_dependencies.py b/great_expectations/core/usage_statistics/package_dependencies.py
--- a/great_expectations/core/usage_statistics/package_dependencies.py
+++ b/great_expectations/core/usage_statistics/package_dependencies.py
@@ -152,6 +152,10 @@ class GEDependencies:
         "PyHive",
         "thrift",
         "thrift-sasl",
+        # requirements-dev-tools.txt
+        "jupyter",
+        "jupyterlab",
+        "matplotlib",
         # requirements-dev-all-contrib-expectations.txt
         "arxiv",
         "barcodenumber",
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -27,7 +27,12 @@ def get_extras_require():
         "teradata",
         "trino",
     )
-    ignore_keys = ("sqlalchemy", "test", "test-pipeline", "all-contrib-expectations")
+    ignore_keys = (
+        "sqlalchemy",
+        "test",
+        "dev-tools",
+        "all-contrib-expectations",
+    )
     rx_fname_part = re.compile(r"requirements-dev-(.*).txt")
     for fname in sorted(glob("requirements-dev-*.txt")):
         key = rx_fname_part.match(fname).group(1)


Test patch:
diff --git a/docker/Dockerfile.tests b/docker/Dockerfile.tests
--- a/docker/Dockerfile.tests
+++ b/docker/Dockerfile.tests
@@ -25,3 +25,6 @@ CMD [ "python", "--version"]
 
 FROM dev as test
 RUN pip install --no-cache-dir --requirement requirements-dev-test.txt --constraint constraints-dev.txt
+
+FROM dev as dev-tools
+RUN pip install --no-cache-dir --requirement requirements-dev-tools.txt --constraint constraints-dev.txt
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_result/data_assistant_result.py b/great_expectations/rule_based_profiler/data_assistant_result/data_assistant_result.py
--- a/great_expectations/rule_based_profiler/data_assistant_result/data_assistant_result.py
+++ b/great_expectations/rule_based_profiler/data_assistant_result/data_assistant_result.py
@@ -161,7 +161,7 @@ def metric_types(self) -> Dict[str, AltairDataTypes]:
 
     def show_expectations_by_domain_type(
         self,
-        expectation_suite_name: str,
+        expectation_suite_name: Optional[str] = None,
         include_profiler_config: bool = False,
         send_usage_event: bool = True,
     ) -> None:
@@ -177,7 +177,7 @@ def show_expectations_by_domain_type(
 
     def show_expectations_by_expectation_type(
         self,
-        expectation_suite_name: str,
+        expectation_suite_name: Optional[str] = None,
         include_profiler_config: bool = False,
         send_usage_event: bool = True,
     ) -> None:
@@ -193,7 +193,7 @@ def show_expectations_by_expectation_type(
 
     def get_expectation_suite(
         self,
-        expectation_suite_name: str,
+        expectation_suite_name: Optional[str] = None,
         include_profiler_config: bool = False,
         send_usage_event: bool = True,
     ) -> ExpectationSuite:
@@ -416,7 +416,7 @@ def _get_auxiliary_profiler_execution_details(self, verbose: bool) -> dict:
     )
     def _get_expectation_suite_with_usage_statistics(
         self,
-        expectation_suite_name: str,
+        expectation_suite_name: Optional[str] = None,
         include_profiler_config: bool = False,
     ) -> ExpectationSuite:
         """
@@ -430,7 +430,7 @@ def _get_expectation_suite_with_usage_statistics(
 
     def _get_expectation_suite_without_usage_statistics(
         self,
-        expectation_suite_name: str,
+        expectation_suite_name: Optional[str] = None,
         include_profiler_config: bool = False,
     ) -> ExpectationSuite:
         """


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_value_counts.py b/great_expectations/expectations/metrics/column_aggregate_metrics/column_value_counts.py
--- a/great_expectations/expectations/metrics/column_aggregate_metrics/column_value_counts.py
+++ b/great_expectations/expectations/metrics/column_aggregate_metrics/column_value_counts.py
@@ -155,7 +155,11 @@ def _spark(
         column: str = accessor_domain_kwargs["column"]
 
         value_counts_df: pyspark_sql_DataFrame = (
-            df.select(column).where(F.col(column).isNotNull()).groupBy(column).count()
+            df.select(column)
+            .where(F.col(column).isNotNull())
+            .where(~F.isnan(F.col(column)))
+            .groupBy(column)
+            .count()
         )
 
         if sort == "value":


Test patch:
diff --git a/tests/expectations/metrics/test_core.py b/tests/expectations/metrics/test_core.py
--- a/tests/expectations/metrics/test_core.py
+++ b/tests/expectations/metrics/test_core.py
@@ -4011,7 +4011,7 @@ def test_value_counts_metric_spark(spark_session):
     )
 
     metrics = engine.resolve_metrics(metrics_to_resolve=(desired_metric,))
-    assert pd.Series(index=[1.0, 2.0, 3.0, np.nan], data=[2, 2, 2, 1]).equals(
+    assert pd.Series(index=[1.0, 2.0, 3.0], data=[2, 2, 2]).equals(
         metrics[desired_metric.id]
     )
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/util.py b/great_expectations/util.py
--- a/great_expectations/util.py
+++ b/great_expectations/util.py
@@ -1515,7 +1515,9 @@ def convert_ndarray_datetime_to_float_dtype(data: np.ndarray) -> np.ndarray:
     Convert all elements of 1-D "np.ndarray" argument from "datetime.datetime" type to "timestamp" "float" type objects.
     """
     value: Any
-    return np.asarray([value.timestamp() for value in data])
+    return np.asarray(
+        [value.replace(tzinfo=datetime.timezone.utc).timestamp() for value in data]
+    )
 
 
 def convert_ndarray_float_to_datetime_dtype(data: np.ndarray) -> np.ndarray:
@@ -1523,7 +1525,7 @@ def convert_ndarray_float_to_datetime_dtype(data: np.ndarray) -> np.ndarray:
     Convert all elements of 1-D "np.ndarray" argument from "float" type to "datetime.datetime" type objects.
     """
     value: Any
-    return np.asarray([datetime.datetime.fromtimestamp(value) for value in data])
+    return np.asarray([datetime.datetime.utcfromtimestamp(value) for value in data])
 
 
 def convert_ndarray_float_to_datetime_tuple(


Test patch:
diff --git a/tests/test_ge_utils.py b/tests/test_ge_utils.py
--- a/tests/test_ge_utils.py
+++ b/tests/test_ge_utils.py
@@ -820,20 +820,20 @@ def test_convert_ndarray_datetime_to_float_dtype(
     numeric_array,
 ):
     element: Any
-
     assert convert_ndarray_datetime_to_float_dtype(data=datetime_array).tolist() == [
-        element.timestamp() for element in datetime_array
+        element.replace(tzinfo=datetime.timezone.utc).timestamp()
+        for element in datetime_array
     ]
 
     with pytest.raises(AttributeError) as e:
         _ = convert_ndarray_datetime_to_float_dtype(data=numeric_array)
 
-    assert str(e.value) == "'int' object has no attribute 'timestamp'"
+    assert "'int' object has no attribute 'replace'" in str(e.value)
 
-    with pytest.raises(AttributeError) as e:
+    with pytest.raises(TypeError) as e:
         _ = convert_ndarray_datetime_to_float_dtype(data=datetime_string_array)
 
-    assert str(e.value) == "'str' object has no attribute 'timestamp'"
+    assert "replace() takes no keyword arguments" in str(e.value)
 
 
 @pytest.mark.unit
@@ -841,9 +841,11 @@ def test_convert_ndarray_float_to_datetime_tuple(
     datetime_array,
 ):
     element: Any
-
     assert convert_ndarray_float_to_datetime_tuple(
-        data=[element.timestamp() for element in datetime_array]
+        data=[
+            element.replace(tzinfo=datetime.timezone.utc).timestamp()
+            for element in datetime_array
+        ]
     ) == tuple([element for element in datetime_array])
 
     with pytest.raises(TypeError) as e:
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_kl_divergence_to_be_less_than.py b/great_expectations/expectations/core/expect_column_kl_divergence_to_be_less_than.py
--- a/great_expectations/expectations/core/expect_column_kl_divergence_to_be_less_than.py
+++ b/great_expectations/expectations/core/expect_column_kl_divergence_to_be_less_than.py
@@ -812,7 +812,7 @@ def _atomic_kl_divergence_chart_template(cls, partition_object: dict) -> tuple:
         if len(weights) == 1:
             mark_bar_args["size"] = 20
 
-        chart = ""
+        chart = {}
         if partition_object.get("bins"):
             bins = partition_object["bins"]
             bins_x1 = [round(value, 1) for value in bins[:-1]]


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/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
@@ -945,7 +945,7 @@ def resolve_metric_bundle(
                 queries[domain_id]["select"].append(
                     metric_fn.label(
                         metric_to_resolve.metric_name.join(
-                            random.choices(string.ascii_lowercase, k=2)
+                            random.choices(string.ascii_lowercase, k=4)
                         )
                     )
                 )


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/util.py b/great_expectations/expectations/metrics/util.py
--- a/great_expectations/expectations/metrics/util.py
+++ b/great_expectations/expectations/metrics/util.py
@@ -6,6 +6,7 @@
 from dateutil.parser import parse
 from packaging import version
 
+from great_expectations.execution_engine.sqlalchemy_dialect import GESqlDialect
 from great_expectations.execution_engine.util import check_sql_engine_dialect
 from great_expectations.util import get_sqlalchemy_inspector
 
@@ -570,7 +571,15 @@ def column_reflection_fallback(
         if isinstance(selectable, TextClause):
             query: TextClause = selectable
         else:
-            query: Select = sa.select([sa.text("*")]).select_from(selectable).limit(1)
+            if dialect.name.lower() == GESqlDialect.REDSHIFT:
+                # Redshift needs temp tables to be declared as text
+                query: Select = (
+                    sa.select([sa.text("*")]).select_from(sa.text(selectable)).limit(1)
+                )
+            else:
+                query: Select = (
+                    sa.select([sa.text("*")]).select_from(selectable).limit(1)
+                )
         result_object = sqlalchemy_engine.execute(query)
         # noinspection PyProtectedMember
         col_names: List[str] = result_object._metadata.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/render/__init__.py b/great_expectations/render/__init__.py
--- a/great_expectations/render/__init__.py
+++ b/great_expectations/render/__init__.py
@@ -148,9 +148,7 @@ def __init__(
         self.table: Optional[List[List[RenderedAtomicValue]]] = table
 
         # GraphType
-        self.graph: Optional[RenderedAtomicValueGraph] = RenderedAtomicValueGraph(
-            graph=graph
-        )
+        self.graph = RenderedAtomicValueGraph(graph=graph)
 
     def __repr__(self) -> str:
         return json.dumps(self.to_json_dict(), indent=2)
@@ -225,7 +223,11 @@ def clean_null_attrs(self, data: dict, **kwargs: dict) -> dict:
         their values are None."""
         data = deepcopy(data)
         for key in RenderedAtomicValueSchema.REMOVE_KEYS_IF_NONE:
-            if key == "graph" and key in data and data[key]["graph"] is None:
+            if (
+                key == "graph"
+                and key in data
+                and data.get(key, {}).get("graph") is None
+            ):
                 data.pop(key)
             elif key in data and data[key] is None:
                 data.pop(key)


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/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
@@ -79,8 +79,6 @@ def __init__(
         self._parameter_builders = parameter_builders
         self._expectation_configuration_builders = expectation_configuration_builders
 
-        self._execution_time = None
-
     @measure_execution_time(
         execution_time_holder_object_reference_name="rule_state",
         execution_time_property_name="rule_execution_time",
@@ -208,13 +206,6 @@ def expectation_configuration_builders(
     ) -> Optional[List[ExpectationConfigurationBuilder]]:
         return self._expectation_configuration_builders
 
-    @property
-    def execution_time(self) -> Optional[float]:  # Execution time (in seconds).
-        """
-        Property that holds "execution_time" of this "Rule" (in seconds).
-        """
-        return self._execution_time
-
     def to_dict(self) -> dict:
         parameter_builder_configs: Optional[List[dict]] = None
         parameter_builders: Optional[


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/checkpoint/actions.py b/great_expectations/checkpoint/actions.py
--- a/great_expectations/checkpoint/actions.py
+++ b/great_expectations/checkpoint/actions.py
@@ -1081,20 +1081,24 @@ def _run(
                 expectation_suite_identifier,
             ],
         )
-
+        # <snippet>
         data_docs_validation_results = {}
+        # </snippet>
         if self.data_context.ge_cloud_mode:
             return data_docs_validation_results
 
         # get the URL for the validation result
+        # <snippet>
         docs_site_urls_list = self.data_context.get_docs_sites_urls(
             resource_identifier=validation_result_suite_identifier,
             site_names=self._site_names,
         )
+        # </snippet>
         # process payload
+        # <snippet>
         for sites in docs_site_urls_list:
             data_docs_validation_results[sites["site_name"]] = sites["site_url"]
-
+        # <snippet>
         return data_docs_validation_results
 
 


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/types/base.py b/great_expectations/data_context/types/base.py
--- a/great_expectations/data_context/types/base.py
+++ b/great_expectations/data_context/types/base.py
@@ -997,6 +997,8 @@ class Meta:
     # https://googleapis.dev/python/sqlalchemy-bigquery/latest/README.html#connection-string-parameters
     credentials_info = fields.Dict(required=False, allow_none=True)
 
+    create_temp_table = fields.Boolean(required=False, allow_none=True)
+
     # noinspection PyUnusedLocal
     @validates_schema
     def validate_schema(self, data, **kwargs):


Test patch:
Repository: great-expectations/great_expectations

Issue:
ConfigNotFoundError when instantiating DataContext with context_root_dir
**Describe the bug**
The DataContext allows instantiating from a user-defined [context_root_dir](https://github.com/great-expectations/great_expectations/blob/5adf91121d49ce3144a1b4ccaa5ac58c00a99373/great_expectations/data_context/data_context/data_context.py#L314). The in-code documentation indicates this should be [the parent folder containing the great_expectations folder](https://github.com/great-expectations/great_expectations/blob/5adf91121d49ce3144a1b4ccaa5ac58c00a99373/great_expectations/data_context/data_context/data_context.py#L342)

However, [when constructing the path to the great_expectations.yaml file](https://github.com/great-expectations/great_expectations/blob/5adf91121d49ce3144a1b4ccaa5ac58c00a99373/great_expectations/data_context/data_context/data_context.py#L412)  the /great_expectations/ subfolder is not included in the path.

This leads to this error
```
ConfigNotFoundError: Error: No great_expectations directory was found here!
```

**To Reproduce**
```
from great_expectations.data_context.data_context import DataContext
ROOT_DIRECTORY = "YOUR_ROOT_PATH"
context = DataContext(context_root_dir=ROOT_DIRECTORY)
```

**Expected behavior**
We would expect the code above to instantiate a DataContext

Currently a successful work-around is:
```
context = DataContext(context_root_dir=f"{ROOT_DIRECTORY}/great_expectations/" )
```

**Environment (please complete the following information):**
 - Operating System: MacOS and AWS DataBricks
 - Great Expectations Version: 0.15.5





Discussion:
Hey @paololucchino ! Thanks for reaching out here. We're reviewing internally and will be in touch.
Hi @paololucchino - following up here, this does work as intended. We will update [the line in the code here](https://github.com/great-expectations/great_expectations/blob/5adf91121d49ce3144a1b4ccaa5ac58c00a99373/great_expectations/data_context/data_context/data_context.py#L342) to make that clearer. Thank you again for the feedback! 

Resolving patch:
diff --git a/great_expectations/data_context/data_context/data_context.py b/great_expectations/data_context/data_context/data_context.py
--- a/great_expectations/data_context/data_context/data_context.py
+++ b/great_expectations/data_context/data_context/data_context.py
@@ -282,7 +282,6 @@ def _init_context_root_directory(self, context_root_dir: Optional[str]) -> str:
                 context_root_dir
             )
         else:
-            # Determine the "context root directory" - this is the parent of "great_expectations" dir
             context_root_dir = (
                 self.find_context_root_dir()
                 if context_root_dir is 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/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
@@ -445,11 +445,18 @@ def get_metrics(
         # Step-4: Sort "MetricConfiguration" directives by "metric_value_kwargs_id" and "batch_id" (in that order).
         # This precise sort order enables pairing every metric value with its respective "batch_id" (e.g., for display).
 
+        batch_id_idx: int
+        batch_id_ordering: Dict[str, int] = {
+            batch_id: batch_id_idx for batch_id_idx, batch_id in enumerate(batch_ids)
+        }
+
         metrics_to_resolve = sorted(
             metrics_to_resolve,
             key=lambda metric_configuration_element: (
                 metric_configuration_element.metric_value_kwargs_id,
-                metric_configuration_element.metric_domain_kwargs["batch_id"],
+                batch_id_ordering[
+                    metric_configuration_element.metric_domain_kwargs["batch_id"]
+                ],
             ),
         )
 
@@ -475,7 +482,7 @@ def get_metrics(
 
         metric_configuration: MetricConfiguration
 
-        resolved_metric_value: Any
+        resolved_metric_value: MetricValue
 
         for metric_configuration in metrics_to_resolve:
             if metric_configuration.id not in resolved_metrics:


Test patch: