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/datasource/data_connector/batch_filter.py b/great_expectations/datasource/data_connector/batch_filter.py
--- a/great_expectations/datasource/data_connector/batch_filter.py
+++ b/great_expectations/datasource/data_connector/batch_filter.py
@@ -1,8 +1,9 @@
 import itertools
 import logging
-from typing import Callable, Dict, Optional, Union
+from typing import Callable, Dict, List, Optional, Union
 
 import great_expectations.exceptions as ge_exceptions
+from great_expectations.core.batch import BatchDefinition
 from great_expectations.core.id_dict import IDDict
 from great_expectations.util import is_int
 
@@ -50,9 +51,9 @@ def build_batch_filter(
 "{str(type(custom_filter_function))}", which is illegal.
             """
         )
-    batch_filter_parameters: Optional[dict] = data_connector_query_dict.get(
-        "batch_filter_parameters"
-    )
+    batch_filter_parameters: Optional[
+        Union[dict, IDDict]
+    ] = data_connector_query_dict.get("batch_filter_parameters")
     if batch_filter_parameters:
         if not isinstance(batch_filter_parameters, dict):
             raise ge_exceptions.BatchFilterError(
@@ -64,8 +65,7 @@ def build_batch_filter(
             raise ge_exceptions.BatchFilterError(
                 'All batch_filter_parameters keys must strings (Python "str").'
             )
-    if batch_filter_parameters is not None:
-        batch_filter_parameters: IDDict = IDDict(batch_filter_parameters)
+        batch_filter_parameters = IDDict(batch_filter_parameters)
     index: Optional[
         Union[int, list, tuple, slice, str]
     ] = data_connector_query_dict.get("index")
@@ -167,7 +167,9 @@ def __repr__(self) -> str:
         }
         return str(doc_fields_dict)
 
-    def select_from_data_connector_query(self, batch_definition_list=None):
+    def select_from_data_connector_query(
+        self, batch_definition_list: Optional[List[BatchDefinition]] = None
+    ) -> List[BatchDefinition]:
         if batch_definition_list is None:
             return []
         filter_function: Callable
@@ -175,6 +177,7 @@ def select_from_data_connector_query(self, batch_definition_list=None):
             filter_function = self.custom_filter_function
         else:
             filter_function = self.best_effort_batch_definition_matcher()
+        selected_batch_definitions: List[BatchDefinition]
         selected_batch_definitions = list(
             filter(
                 lambda batch_definition: filter_function(


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/util.py b/great_expectations/core/util.py
--- a/great_expectations/core/util.py
+++ b/great_expectations/core/util.py
@@ -19,6 +19,7 @@
 from great_expectations.core.run_identifier import RunIdentifier
 from great_expectations.exceptions import InvalidExpectationConfigurationError
 from great_expectations.types import SerializableDictDot
+from great_expectations.types.base import SerializableDotDict
 
 # Updated from the stack overflow version below to concatenate lists
 # https://stackoverflow.com/questions/3232943/update-value-of-a-nested-dictionary-of-varying-depth
@@ -125,7 +126,7 @@ def convert_to_json_serializable(data):
 
     # If it's one of our types, we use our own conversion; this can move to full schema
     # once nesting goes all the way down
-    if isinstance(data, SerializableDictDot):
+    if isinstance(data, (SerializableDictDot, SerializableDotDict)):
         return data.to_json_dict()
 
     try:
@@ -238,7 +239,7 @@ def ensure_json_serializable(data):
         test_obj may also be converted in place.
     """
 
-    if isinstance(data, SerializableDictDot):
+    if isinstance(data, (SerializableDictDot, SerializableDotDict)):
         return
 
     try:
diff --git a/great_expectations/types/base.py b/great_expectations/types/base.py
--- a/great_expectations/types/base.py
+++ b/great_expectations/types/base.py
@@ -45,3 +45,14 @@ def yaml_anchor(cls):
     def to_yaml(cls, representer, node):
         """Use dict representation for DotDict (and subtypes by default)"""
         return representer.represent_dict(node)
+
+
+class SerializableDotDict(DotDict):
+    """
+    Analogously to the way "SerializableDictDot" extends "DictDot" to provide JSON serialization, the present class,
+    "SerializableDotDict" extends "DotDict" to provide JSON-serializable version of the "DotDict" class as well.
+    Since "DotDict" is already YAML-serializable, "SerializableDotDict" is both YAML-serializable and JSON-serializable.
+    """
+
+    def to_json_dict(self) -> dict:
+        raise NotImplementedError


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/datasource/data_connector/batch_filter.py b/great_expectations/datasource/data_connector/batch_filter.py
--- a/great_expectations/datasource/data_connector/batch_filter.py
+++ b/great_expectations/datasource/data_connector/batch_filter.py
@@ -112,13 +112,15 @@ def _parse_index(
     elif isinstance(index, str):
         if is_int(value=index):
             return _parse_index(index=int(index))
-        index_as_list: List[Optional[int]] = []
+        index_as_list: List[Optional[str, int]]
+        if index:
+            index_as_list = index.split(":")
+            if len(index_as_list) == 1:
+                index_as_list = [None, index_as_list[0]]
+        else:
+            index_as_list = []
         idx_str: str
-        for idx_str in index.split(":"):
-            if not idx_str:
-                index_as_list.append(None)
-            else:
-                index_as_list.append(int(idx_str))
+        index_as_list = [int(idx_str) if idx_str else None for idx_str in index_as_list]
         return _parse_index(index=index_as_list)
     else:
         raise ge_exceptions.BatchFilterError(


Test patch:
Repository: great-expectations/great_expectations

Issue:
Datadocs renders 0 as `--`
**Describe the bug**
When observed value is 0, Data docs renders it as `--` instead of `0`

![image](https://user-images.githubusercontent.com/14918053/122597118-ed206000-d038-11eb-8c6f-0bfa356c2456.png)


**To Reproduce**
Steps to reproduce the behavior:
1. Run expectation that expects 0 rows as a result
2. Observe generated datadocs

**Expected behavior**
Datadocs should display `0` as observed value

**Environment (please complete the following information):**
 - Operating System:  Windows
 - Great Expectations Version: 0.13.19




Discussion:

Resolving patch:
diff --git a/great_expectations/expectations/expectation.py b/great_expectations/expectations/expectation.py
--- a/great_expectations/expectations/expectation.py
+++ b/great_expectations/expectations/expectation.py
@@ -475,7 +475,7 @@ def _diagnostic_observed_value_renderer(
         if result_dict is None:
             return "--"
 
-        if result_dict.get("observed_value"):
+        if result_dict.get("observed_value") is not None:
             observed_value = result_dict.get("observed_value")
             if isinstance(observed_value, (int, float)) and not isinstance(
                 observed_value, bool


Test patch:
diff --git a/tests/render/test_render_ValidationResultsTableContentBlockRenderer.py b/tests/render/test_render_ValidationResultsTableContentBlockRenderer.py
--- a/tests/render/test_render_ValidationResultsTableContentBlockRenderer.py
+++ b/tests/render/test_render_ValidationResultsTableContentBlockRenderer.py
@@ -240,6 +240,20 @@ def test_ValidationResultsTableContentBlockRenderer_get_observed_value(evr_succe
         ),
     )
 
+    evr_success_zero = ExpectationValidationResult(
+        success=True,
+        result={"observed_value": 0},
+        exception_info={
+            "raised_exception": False,
+            "exception_message": None,
+            "exception_traceback": None,
+        },
+        expectation_config=ExpectationConfiguration(
+            expectation_type="expect_table_row_count_to_be_between",
+            kwargs={"min_value": 0, "max_value": None, "result_format": "SUMMARY"},
+        ),
+    )
+
     # test _get_observed_value when evr.result["observed_value"] exists
     output_1 = get_renderer_impl(
         object_name=evr_success.expectation_config.expectation_type,
@@ -264,6 +278,12 @@ def test_ValidationResultsTableContentBlockRenderer_get_observed_value(evr_succe
         renderer_type="renderer.diagnostic.observed_value",
     )[1](result=evr_expect_column_values_to_be_null)
     assert output_4 == "100% null"
+    # test _get_observed_value to be 0
+    output_5 = get_renderer_impl(
+        object_name=evr_success_zero.expectation_config.expectation_type,
+        renderer_type="renderer.diagnostic.observed_value",
+    )[1](result=evr_success_zero)
+    assert output_5 == "0"
 
 
 def test_ValidationResultsTableContentBlockRenderer_get_unexpected_statement(
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/profiler.py b/great_expectations/rule_based_profiler/profiler.py
--- a/great_expectations/rule_based_profiler/profiler.py
+++ b/great_expectations/rule_based_profiler/profiler.py
@@ -40,8 +40,7 @@ def __init__(
         These will be used to define profiler computation patterns.
 
         Args:
-            variables_configs: Variables from a profiler configuration
-            rules_configs: Rule configuration as a dictionary
+            profiler_config: Variables and Rules configuration as a dictionary
             data_context: DataContext object that defines a full runtime environment (data access, etc.)
         """
         self._data_context = data_context


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/domain_builder.py b/great_expectations/rule_based_profiler/domain_builder/domain_builder.py
--- a/great_expectations/rule_based_profiler/domain_builder/domain_builder.py
+++ b/great_expectations/rule_based_profiler/domain_builder/domain_builder.py
@@ -73,7 +73,7 @@ def get_validator(
         )
 
         expectation_suite_name: str = (
-            f"tmp_domain_builder_suite_{str(uuid.uuid4())[:8]}"
+            f"tmp.domain_builder_suite_{str(uuid.uuid4())[:8]}"
         )
         return self.data_context.get_validator(
             batch_request=batch_request,
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
@@ -105,7 +105,7 @@ def get_validator(
         )
 
         expectation_suite_name: str = (
-            f"tmp_parameter_builder_suite_domain_{domain.id}_{str(uuid.uuid4())[:8]}"
+            f"tmp.parameter_builder_domain_{domain.id}_suite_{str(uuid.uuid4())[:8]}"
         )
         return self.data_context.get_validator(
             batch_request=batch_request,
diff --git a/great_expectations/rule_based_profiler/profiler.py b/great_expectations/rule_based_profiler/profiler.py
--- a/great_expectations/rule_based_profiler/profiler.py
+++ b/great_expectations/rule_based_profiler/profiler.py
@@ -137,7 +137,7 @@ def profile(
         """
         if expectation_suite_name is None:
             expectation_suite_name = (
-                f"tmp_suite_{self.__class__.__name__}_{str(uuid.uuid4())[:8]}"
+                f"tmp.profiler_{self.__class__.__name__}_suite_{str(uuid.uuid4())[:8]}"
             )
 
         expectation_suite: ExpectationSuite = 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/rule_based_profiler/parameter_builder/parameter_container.py b/great_expectations/rule_based_profiler/parameter_builder/parameter_container.py
--- a/great_expectations/rule_based_profiler/parameter_builder/parameter_container.py
+++ b/great_expectations/rule_based_profiler/parameter_builder/parameter_container.py
@@ -329,8 +329,10 @@ def _get_parameter_value_from_parameter_container(
 
     parameter_name_part: Optional[str] = None
     return_value: Optional[Union[Any, ParameterNode]] = parameter_node
+    parent_parameter_node: Optional[ParameterNode] = None
     try:
         for parameter_name_part in fully_qualified_parameter_name_as_list:
+            parent_parameter_node = return_value
             if parameter_name_part in return_value:
                 return_value = return_value[parameter_name_part]
 
@@ -338,6 +340,12 @@ def _get_parameter_value_from_parameter_container(
         raise KeyError(
             f"""Unable to find value for parameter name "{fully_qualified_parameter_name}": Part \
 "{parameter_name_part}" does not exist in fully-qualified parameter name.
+"""
+        )
+    if parameter_name_part not in parent_parameter_node:
+        raise KeyError(
+            f"""Unable to find value for parameter name "{fully_qualified_parameter_name}": Part \
+"{parameter_name_part}" of fully-qualified parameter name does not exist.
 """
         )
 


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
@@ -4,6 +4,7 @@
 from copy import deepcopy
 from typing import Any, Dict, List, Optional, Union
 
+import great_expectations as ge
 from great_expectations import __version__ as ge_version
 from great_expectations.core.evaluation_parameters import (
     _deduplicate_evaluation_parameter_dependencies,
@@ -99,21 +100,23 @@ def add_citation(
             citation_date = parse_string_to_datetime(datetime_string=citation_date)
 
         citation_date = citation_date or datetime.datetime.now(datetime.timezone.utc)
-        self.meta["citations"].append(
-            {
-                "citation_date": get_datetime_string_from_strftime_format(
-                    format_str="%Y-%m-%dT%H:%M:%S.%fZ", datetime_obj=citation_date
-                ),
-                "batch_request": batch_request,
-                "batch_definition": batch_definition,
-                "batch_spec": batch_spec,
-                "batch_kwargs": batch_kwargs,
-                "batch_markers": batch_markers,
-                "batch_parameters": batch_parameters,
-                "profiler_config": profiler_config,
-                "comment": comment,
-            }
+        citation: Dict[str, Any] = {
+            "citation_date": get_datetime_string_from_strftime_format(
+                format_str="%Y-%m-%dT%H:%M:%S.%fZ", datetime_obj=citation_date
+            ),
+            "batch_request": batch_request,
+            "batch_definition": batch_definition,
+            "batch_spec": batch_spec,
+            "batch_kwargs": batch_kwargs,
+            "batch_markers": batch_markers,
+            "batch_parameters": batch_parameters,
+            "profiler_config": profiler_config,
+            "comment": comment,
+        }
+        ge.util.filter_properties_dict(
+            properties=citation, clean_falsy=True, inplace=True
         )
+        self.meta["citations"].append(citation)
 
     def isEquivalentTo(self, other):
         """


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/profiler.py b/great_expectations/rule_based_profiler/profiler.py
--- a/great_expectations/rule_based_profiler/profiler.py
+++ b/great_expectations/rule_based_profiler/profiler.py
@@ -221,7 +221,7 @@ def profile(
 
         if include_citation:
             expectation_suite.add_citation(
-                comment="Suite created by Rule-Based Profiler with the following config",
+                comment="Suite created by Rule-Based Profiler with the configuration included.",
                 profiler_config=self._profiler_config,
             )
 


Test patch:
diff --git a/tests/rule_based_profiler/alice_user_workflow_fixture.py b/tests/rule_based_profiler/alice_user_workflow_fixture.py
--- a/tests/rule_based_profiler/alice_user_workflow_fixture.py
+++ b/tests/rule_based_profiler/alice_user_workflow_fixture.py
@@ -185,7 +185,7 @@ def alice_columnar_table_single_batch():
     yaml = YAML()
     profiler_config: dict = yaml.load(verbose_profiler_config)
     expected_expectation_suite.add_citation(
-        comment="Suite created by Rule-Based Profiler with the following config",
+        comment="Suite created by Rule-Based Profiler with the configuration included.",
         profiler_config=profiler_config,
     )
 
diff --git a/tests/rule_based_profiler/bobby_user_workflow_fixture.py b/tests/rule_based_profiler/bobby_user_workflow_fixture.py
--- a/tests/rule_based_profiler/bobby_user_workflow_fixture.py
+++ b/tests/rule_based_profiler/bobby_user_workflow_fixture.py
@@ -735,7 +735,7 @@ def bobby_columnar_table_multi_batch():
     yaml = YAML()
     profiler_config: dict = yaml.load(verbose_profiler_config)
     expected_expectation_suite_oneshot_sampling_method.add_citation(
-        comment="Suite created by Rule-Based Profiler with the following config",
+        comment="Suite created by Rule-Based Profiler with the configuration included.",
         profiler_config=profiler_config,
     )
Repository: great-expectations/great_expectations

Issue:
ValueError on RunTimeBatchRequest.get_json_dict with a pandas df
**Describe the bug**
If you try to get a dict for a RunTimeBatchRequest with a pandas dataframe, you get `ValueError: The truth value of a PandasDataset is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().`

**To Reproduce**
```
from great_expectations.core.batch import RuntimeBatchRequest
RuntimeBatchRequest(
    datasource_name="dsn",
    data_connector_name="dcn",
    data_asset_name="dan",
    runtime_parameters={
      "batch_data": pd.DataFrame({'c': [1,2,3]})
    },
    batch_identifiers={
        "id1": 123,
        "id2": 'abc'
    }
).get_json_dict()
```

**Expected behavior**
Should not try to serialize df.

**Environment (please complete the following information):**
 - Great Expectations Version:  0.13.19




Discussion:
@majidaldo Thank you for creating this issue! I see that you are trying to serialize the RuntimeBatchRequest. Could you show the broader context of this code snippet? 
> @majidaldo Thank you for creating this issue! I see that you are trying to serialize the RuntimeBatchRequest. Could you show the broader context of this code snippet?

...to collect it to create a dataset. maybe i can take it out of 'meta' after validation.

Resolving patch:
diff --git a/great_expectations/core/batch.py b/great_expectations/core/batch.py
--- a/great_expectations/core/batch.py
+++ b/great_expectations/core/batch.py
@@ -258,7 +258,7 @@ def get_json_dict(self) -> dict:
             json_dict["batch_identifiers"] = self.batch_identifiers
         if self.runtime_parameters is not None:
             json_dict["runtime_parameters"] = self.runtime_parameters
-            if json_dict["runtime_parameters"].get("batch_data"):
+            if json_dict["runtime_parameters"].get("batch_data") is not None:
                 json_dict["runtime_parameters"]["batch_data"] = str(
                     type(json_dict["runtime_parameters"]["batch_data"])
                 )


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/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
@@ -50,7 +50,7 @@ class MetricFunctionTypes(Enum):
 
 
 class MetricDomainTypes(Enum):
-    IDENTITY = "identity"
+    IDENTITY = "identity"  # Instructs ExecutionEngine not to split accessor_domain_kwargs out of domain_kwargs; hence, compute_domain_kwargs returned by ExecutionEngine will be domain_kwargs (unaltered).
     COLUMN = "column"
     COLUMN_PAIR = "column_pair"
     MULTICOLUMN = "multicolumn"


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/profile/base.py b/great_expectations/profile/base.py
--- a/great_expectations/profile/base.py
+++ b/great_expectations/profile/base.py
@@ -204,7 +204,7 @@ class ProfilerTypeMapping:
         "SMALLMONEY",
         "smallmoney",
     ]
-    IDENTITY_TYPE_NAMES = [
+    IDENTIFIER_TYPE_NAMES = [
         "UNIQUEIDENTIFIER",
         "uniqueidentifier",
     ]
diff --git a/great_expectations/rule_based_profiler/domain_builder/simple_semantic_type_domain_builder.py b/great_expectations/rule_based_profiler/domain_builder/simple_semantic_type_domain_builder.py
--- a/great_expectations/rule_based_profiler/domain_builder/simple_semantic_type_domain_builder.py
+++ b/great_expectations/rule_based_profiler/domain_builder/simple_semantic_type_domain_builder.py
@@ -173,9 +173,9 @@ def infer_semantic_domain_type_from_table_column_type(
         }:
             semantic_column_type = SemanticDomainTypes.CURRENCY
         elif column_type in {
-            type_name.upper() for type_name in ProfilerTypeMapping.IDENTITY_TYPE_NAMES
+            type_name.upper() for type_name in ProfilerTypeMapping.IDENTIFIER_TYPE_NAMES
         }:
-            semantic_column_type = SemanticDomainTypes.IDENTITY
+            semantic_column_type = SemanticDomainTypes.IDENTIFIER
         elif column_type in (
             {
                 type_name.upper()
diff --git a/great_expectations/rule_based_profiler/domain_builder/types/domain.py b/great_expectations/rule_based_profiler/domain_builder/types/domain.py
--- a/great_expectations/rule_based_profiler/domain_builder/types/domain.py
+++ b/great_expectations/rule_based_profiler/domain_builder/types/domain.py
@@ -19,6 +19,7 @@ class SemanticDomainTypes(Enum):
     BINARY = "binary"
     CURRENCY = "currency"
     VALUE_SET = "value_set"
+    IDENTIFIER = "identifier"
     MISCELLANEOUS = "miscellaneous"
     UNKNOWN = "unknown"
 


Test patch: